Malicious code that can take advantage of a newly disclosed hole in Microsoft's MSN Messenger instant messenger program has been published on the internet. The publication of the code could set the stage for a possibly virulent IM worm or virus, according to security experts.

The code attacks a hole in an MSN Messenger component called "libpng," which is used to display PNG (Portable Network Graphics) files that are used to show smiley faces, buddy icons, and other graphics.

More than one example of code to exploit the hole was available on the internet yesterday, along with directions on how to use it to attack vulnerable Messenger applications.

The code can cause Messenger to crash, or allow a remote attacker to run code on vulnerable Windows machines, according to a Vulnerability Alert released by Symantec.

On Tuesday, Microsoft released a patch, MS05-009, that fixed several holes in libpng for the PNG hole and labeled the vulnerability "critical”.

By sending a specially crafted PNG image, an attacker can trigger a buffer overflow and execute arbitrary code on the chat partner's system, according to Max Caceres, director of product management Core Security Technologies in Boston.

Researchers at Core Security discovered the hole and reported it to Microsoft in August, he says.

In buffer overflow attacks, malicious hackers flood temporary data storage areas on a computer with more information than they were intended to hold. Extra information, such as attack code, overflows into other areas of the computer's memory, overwriting other data and causing the system to crash or begin running the attacker's code.

IM worms are not uncommon, but none have caused as much damage or gained the notoriety as the more common email worms, such as MyDoom, Sobig or Blaster. However, experts have long warned that the potential exists for virulent, IM-borne threats.

IM networks are an example of a phenomenon known as "scale-free networks". Epidemiologists use this term to describe systems, including communities of animals or people, in which not all members are connected to each other, but are highly susceptible to virus infections. Just a few users connected to popular instant messaging networks can cause worms to spread very rapidly, outpacing traditional signature-based protections offered by antivirus software.

MSN Messenger users are advised to download and install the MS05-009 patch as soon as possible to fix the PNG vulnerability, says Stephen Toulouse, security program manager at Microsoft's Security Response Center.