Hackers backed by the Chinese government have reportedly attacked Apple's popular iCloud storage and backup service, potentially gaining access to user credentials and private data in connection with the protests in Hong Kong.

Greatfire.org, a group that conducts research on Chinese internet censorship, in a blog post, accused the Chinese government of staging a man-in-the-middle (MITM) attack on Apple's iCloud. The attack on Apple comes after similar attempts on Github, Google, Yahoo and Microsoft websites.

The man-in-the-middle attack is a form of active eavesdropping in which the attacker makes independent connections with the victims and relays messages between them.

Thereby, the attacker makes the victims believe that they are talking directly to each other over a private connection, when in fact the entire conversation is controlled by the attacker.

"This is clearly a malicious attack on Apple in an effort to gain access to usernames and passwords and consequently all data stored on iCloud such as iMessages, photos, contacts, etc," Greatfire wrote in the blog.

It added that the attack is nationwide and coincides with the launch of iPhone 6 in China.

While the attack on Google and Yahoo allowed authorities to snoop on the search habits of the people in China, the hacking of iCloud was to steal private information, such as iMessages, photos and contacts.

"This may also somehow be related again to images and videos of the Hong Kong protests being shared on the mainland," the blog said.

It also alleged that China's delay in approving iPhone 6 sales in the mainland might be due to the model's increased encryption features to prevent snooping. It is unclear if Apple made changes to the iPhones they are selling in mainland China, it said.

China's government has been accused by the US of hacking government and corporate websites to gain sensitive information. China has denied all the claims and noted that the US is fabricating all the cyber attacks.

In May, the US charged five members of the People's Liberation Army for hacking US companies for trade secrets, escalating tensions between the two countries over cyber-espionage.

James Comey, director of the US Federal Bureau of Investigation (FBI), earlier said that state-backed hackers in China might have hacked every big US company, stealing corporate secrets worth billions of dollars.