The accounts were taken over just before midnight on Sunday evening by an Anonymous hacker using the @Anon_0x03 Twitter handle.
Since the defence forces' account was taken over there have been almost 50 messages posted with most critical of the Kenyan government and the country's president Uhuru Kenyatta, pointing out that he has not done enough to prevent hunger, human trafficking and poachers in the country.
As well as the official defence forces account, the @Anon_0x03 account was also able to take control of the Twitter account belonging to the spokesperson for the Kenyan defence forces Major Emmanuel Chirchir.
While the account of Major Chirchir has now been restored, the Kenyan defence forces account still appears to be under the control of the hackers.
Speaking to Techworm, the hacker behind the @Anon_0x03 account claimed to have breached the security of the accounts using phishing emails which are designed to trick people into clicking on links which are malicious.
The hacker says he has access to the email account associated with the Twitter accounts, providing Techworm with a screenshot of the inbox of Major Chirchir's email account.
This is not the first time Anonymous affiliated hackers have targeted African governments with a group called Anonymous Africa last year breaching the security of the Zimbabwean defence ministry Twitter account as well as attacking the website of the African National Congress in South Africa.