Five of those who died were Malian security guards. The Malian military said the assault had been repulsed and four of the gunmen killed.
No group has claimed Monday's attack. Islamist militants frequently target the UN mission in Mali.
More than 100 members of the force have been killed.
World's most dangerous peacekeeping mission
The country's security has gradually worsened since 2013, when French forces repelled allied Islamist and Tuareg rebel fighters who had much of the north, including Timbuktu.
French troops and a 10,000-strong force of UN peacekeepers have been battling to stabilise the former French colony.
Gunmen have attacked a United Nations peacekeeping base in the city of Timbuktu in northern Mali, killing seven people.