The top UN aid official in South Sudan, Toby Lanzer, said he was "outraged" by the assault in the war-ravaged town of Bor, in which two peacekeepers were also wounded.
Almost 5,000 civilians are sheltering inside the fortified base of the United Nations Mission in South Sudan (UNMISS), one of the most bitterly contested regions in the four-month-long conflict splitting the country.
UNMISS condemned "heinous murders" in the attack, although it has not officially confirmed any deaths.
The gunmen had initially approached the camp "under the guise of peaceful demonstrators" intending to present a petition to the UN, before opening fire and breaching the compound, the statement added.
More From This Section
The civilians fled into the base weeks ago amid brutal ethnic massacres in the world's newest nation.
Information Minister Michael Makuei said that a "huge number" of gunmen had come seeking revenge for the rebel capture of the oil town of Bentiu two days ago hoping to kill the trapped civilians, many of them children.
Bor, the capital of Jonglei state, has swapped hands several times during the conflict.
The latest clashes in Bor echo an attack by gunmen in December on a UN base in Akobo, also in Jonglei, killing at least 11 civilians and two Indian UN peacekeepers.
More than 67,000 civilians across the country are sheltering inside UN bases for protection from ethnic attacks, with heavy fighting ongoing as the rebels say they are targeting key oil fields.
"Bentiu is still under the hands of the rebels but we are closing in," army spokesman Philip Aguer told AFP. "There is still fighting.