The al-Qaida-aligned militants said one of their fighters rammed a car bomb into the base, in Janale, about 90 km (55 miles) south of the capital, Mogadishu, and then gunmen poured inside.
The African Union peacekeeping mission, known as AMISOM, did not immediately release casualty figures for the attack, which came roughly a year after al Shabaab leader Ahmed Abdi Godane was killed in a US air strike.
Al Shabaab often exaggerates the success of its attacks, and officials played down losses. But Somalia-focused diplomatic sources said the death toll was expected to be "very large".