Al-Shabab has claimed an attack that killed four Emirati troops and a Bahraini military officer at the General Gordon Military Base in Mogadishu, the Somali capital.