A bug in the Java Runtime Environment (JRE) can leave corporate systems open to attack if a user visits a site containing malicious code, security researchers have warned.
The bug affects Windows, Linux and Solaris, and Sun has released a patch.
The JRE includes the Java Virtual Machine and supporting executables and files, and contains safeguards that prevent applets from causing trouble on the wider system. The newly disclosed flaw allows applets to upgrade their privileges, effectively giving them free access to the rest of the system, Sun said in an advisory.
"For example, an applet may grant itself permissions to read and write local files or execute local applications with the privileges of the user running the untrusted applet," Sun said.
The specific bug is to do with the processing of GIF image components, according to the Zero Day Initiative (ZDI), a bounty-oriented program run by 3Com's TippingPoint, which bought rights to disclosure from an anonymous researcher.
"When the image width in an image block of a valid GIF file is set to 0, the Java runtime will allocate the specified size but subsequently copy all data to the under allocated memory chunk," ZDI said in its advisory. "The overflow results in the corruption of multiple pointers, at least one of which is later dereferenced and can therefore result in execution of arbitrary code."
ZDI originally informed Sun of the problem back in June, the organization said.
Secunia, a third-party security company based in Denmark, said the problem was one of the most serious to have affected Java in some time. Secunia said the bug was "highly critical".
The bug affects Java Development Kit (JDK) and JRE 5.0 Update 9 and prior, Java Software Development Kit (SDK) and JRE 1.4.2_12 and prior, and SDK and JRE 1.3.1_18 and prior.