"Apple has identified malware which infected a limited number of Mac systems through a vulnerability in the Java plug-in for browsers. The malware was employed in an attack against Apple and other companies, and was spread through a website for software developers. We identified a small number of systems within Apple that were infected and isolated them from our network. There is no evidence that any data left Apple. We are working closely with law enforcement to find the source of the malware," the company said in a statement to CNBC.
The company said it would release a Java malware removal tool that checks a Mac's systems and removes any found malware.
(Read More: 10 Ways Companies Get Hacked )
Java, which is a widely used programming language, has a history as being used as a point of entry for cyber criminals. In fact, according to a report by the security firm Kaspersky Labs, half of all detected attacks in 2012 were caused by exploiting vulnerabilities in Java software.
(Read More: This Company Profits From Cyberwars )
In January, Oracle (ORCL) said it fixed a flaw in its Java software, but the Department of Homeland Security still urged people to disable the feature unless absolutely necessary.
On Friday, Facebook said that it was the victim of a "sophisticated attack" that infected a small number of employees' computers when they visited a mobile developer website. But the company said that they had found no evidence that user data was jeopardized.
More From CNBC
Who's Hacking the US? Signs Point to China
Einhorn Digs in Against Apple as Hearing Looms
Apple Is Building Something Bigger Than a TV