The company said unknown hackers infected the machines of some Apple workers when they visited a website for developers that had been infected with malicious software designed to attack Mac computers, according to Reuters.

It added there was no indication that any data had been taken and was working with authorities to investigate the incident. The California-based corporation said: "Apple has identified malware which infected a limited number of Mac systems through a vulnerability in the Java plug-in for browsers."

The same software was used to launch attacks against Facebook, which it disclosed on Friday. Twitter was hacked on 1 February in the same campaign, Reuters was told by a person close to the investigation.

Another person briefed on the case said that hundreds of companies, including defence contractors, had been infected with the same malicious software. Though this person said that the malware could have originated from China, there was no proof.

"This is a new campaign. It's not like the other ones you read about where everyone can tell it's China," the first person said.

A Finnish cyber security firm, F-Secure, said the attackers might have been trying to get access to the code for apps on smartphones, seeking a way to infect millions of end-users. It urged developers to check their source code for unintended changes.

Charlie Miller, an expert on Apple security, who is co-author of the Mac Hacker's Handbook, said the attacks showed criminal hackers were investing more time studying the Mac OS X operating system so they can attack Apple computers.

For example, he noted, hackers recently figured out a fairly sophisticated way to attack Macs by exploiting a flaw in Adobe Systems Inc's Flash software.

"The only thing that was making it safe before is that nobody bothered to attack it. That goes away if somebody bothers to attack it," Miller said.