At around 1030 GMT, the attackers on three motorbikes opened fire on a group of men as they walked back from a funeral in Nganzai district near the state capital Maiduguri, local militia leader Bunu Bukar Mustapha said.
"Our men recovered 23 dead bodies from the scene of the attack, which happened this morning," Mustapha told AFP.
The men were returning to Badu Kuluwu from nearby Goni Abachari village where they had attended funeral prayers for a relative, Mustapha said.
A Nganzai district official confirmed both the incident and death toll.
"I received calls from Nganzai that Boko Haram killed 23 people near Badu Kuluwu this morning," said the official, who asked not to be identified for his own safety.
Local hunters and militia recovered the bodies after survivors returned to the village and alerted them, Nganzai resident Saleh Masida said.
Boko Haram fighters have been repeatedly attacking Nganzai district.
In September last year, the group killed eight people and stole livestock in two villages in the area after residents tried to stop them from taking their animals.
Boko Haram and its IS-supported ISWAP splinter have intensified attacks on civilian and military targets in recent months.
Late Thursday, Boko Haram fighters attacked a camp for displaced people outside Maiduguri, killing two residents and looting food supplies after burning a nearby military base.
The decade-long jihadist conflict has spilled over into neighbouring Chad, Niger and Cameroon, claiming around 27,000 lives and forcing more than two million people to flee their homes.