Al Shabaab fighters attacked a remote Somali army base northwest of the capital Mogadishu on Tuesday, killing several government soldiers, officials and the militants said.