Militant fighters stormed the base at Sasawa village, some 45 kilometres from the Yobe state capital, Damaturu, on Tuesday, in the third such attack on the military in two weeks.
The Nigerian Army has confirmed the attack and said only there were "casualties on both sides".
But a military source said: "So far, 15 bodies of soldiers killed in the attack at Sasawa have been recovered, including that of an officer.
"Seven more bodies were found in the course of search and rescue operations by 27 Brigade and 233 Battalion. More (soldiers) are still missing and their fate is unknown."
More From This Section
According to the SITE Intelligence Group, the raid was claimed by the Islamic State's West Africa Province (ISWAP).
That indicates fighters loyal to Abu Mus'ab al-Barnawi were responsible. IS designated al-Barnawi leader of the group last year instead of long-time figurehead Abubakar Shekau.
The al-Barnawi faction is known to have been operating just across the border in Borno state and has been blamed for a number of similar raids.
Tuesday's attack in Yobe also saw Boko Haram fighters seize grain from food stores in the village after a six-hour firefight with troops.
Security analysts have suggested the increase in attacks on military posts is linked to the end of the rainy season plus the need to restock depleted supplies of food and weapons.