A 3D-printed logo for Twitter is seen in this picture illustration made in Zenica, Bosnia and Herzegovina on January 26, 2016.REUTERS

Hundreds of Twitter accounts, including those of some major media outlets and celebrities, were hacked on Wednesday to post tweets with the Turkish flag and swastikas.

The tweets, which appeared to be political defacement, used the hashtags #Nazialmanya and #Nazihollanda, meaning Nazi Germany and Nazi Holland. The attackers posted anti-Nazi messages in Turkish, and also referred to April 16, when a referendum will take place in Turkey to give President Recep Tayyip Erdoğan more power.

The hackers also posted a link to a YouTube video and the Twitter account sebomubu.

The compromised Twitter accounts included those of Forbes, World Meteorological Organization, bitcoin wallet Blockchain, Germany soccer club Borussia Dortmund, Justin Bieber's Japanese account and the U.K. Department of Health.

The attackers also hijacked the Twitter accounts of BBC North America, the European Parliament, Reuters Japan, Amnesty International, UNICEF USA and Duke University.

Some Twitter users claimed that hackers compromised a third party analytics app called Twitter Counter, which allowed intruders to post tweets from anyone using that software.

Meanwhile, Twitter Counter admitted that its service was hacked and that it was investigating the matter.

"Before any definite findings, we've already taken measures to contain such abuse of our users' accounts, assuming it is indeed done using our system – both blocking all ability to post tweets using our system and changing our Twitter app key," a Twitter Counter spokesperson told CNBC. "One thing is important to note – we do not store users' Twitter account credentials (passwords) nor credit card information. The abuse risk is limited to posting or following on Twitter and as I've mentioned — the first part is already contained."

If you have ever used Twitter Counter, here's what you should do right now:

  • Go to "Settings and Privacy" on Twitter
  • Click on the "Apps" section.
  • Disable the third-party access to Twitter Counter.