On July 13, 2001, a worm began propagating across the internet by exploiting a buffer overflow in Microsoft's Internet Information Services (IIS) web server. Within 19 hours of initial activation on July 19, Code Red had infected approximately 359,000 machines. The worm defaced websites with the message "HACKED BY CHINESE!" and, in some variants, launched a distributed denial-of-service attack against the White House's IP address. It caused an estimated $2 billion in damage.
Code Red was not the first internet worm - the Morris Worm predated it by thirteen years - but it demonstrated something the security community had been warning about: that a single critical vulnerability in widely-deployed server software could produce an internet-scale incident within hours, and that the speed of worm propagation would outpace any human response capability. The window between Code Red's vulnerability disclosure and the worm's deployment was 27 days. Most of those 359,000 servers had been given 27 days to patch and had not.
The Vulnerability: IIS Buffer Overflow
The Code Red worm exploited CVE-2001-0500, a stack buffer overflow in the Index Server component of IIS 4.0 and 5.0. The vulnerable component was the .ida (Internet Data Administration) ISAPI extension - a component that handled searches against IIS-hosted content. Microsoft had released a patch for this vulnerability on June 18, 2001, exactly 27 days before Code Red began its rapid spread phase on July 19.
The overflow was triggered by sending an HTTP GET request with an excessively long .ida query string. IIS copied this string into a fixed-size stack buffer without bounds checking, overwriting the return address with attacker-controlled data. The worm's shellcode then executed at IIS process privilege - typically running as LocalSystem on Windows 2000, which meant full administrative access to the machine.
Propagation: 359,000 Machines in 19 Hours
Code Red's spread was driven by its scanning methodology. Each infected host generated 99 threads: 99 simultaneous scanning threads probing random IP addresses for vulnerable IIS servers on port 80. This produced a roughly exponential growth curve - early phase limited by the number of infected hosts, later phase limited by the total population of vulnerable servers. The worm's scanning rate was aggressive enough that network operators noticed anomalous ICMP and TCP traffic patterns in transit networks before many administrators had detected infections.
The worm's behavior was time-triggered. Between the 1st and 19th of each month, Code Red scanned and propagated. Between the 20th and 27th, it launched DDoS attacks against fixed target IP addresses including the White House website at 198.137.240.91. The White House changed its IP address in response to the threatened attack. After the 27th of the month, it entered a dormant phase. This monthly cycle meant Code Red effectively reactivated itself each month as long as infected machines remained unpatched.
Code Red II and the Backdoor Variant
Approximately two weeks after the original Code Red, a second variant appeared that shared the same IIS vulnerability but had significantly different behavior. Code Red II dropped a backdoor (a root.exe shell) on infected systems, creating persistent unauthorized access. Where the original Code Red used infected machines primarily for scanning and DDoS, Code Red II created a persistent foothold on hundreds of thousands of IIS servers that remained exploitable for follow-on attacks.
Code Red II was written separately from the original worm - it was not an evolution by the original author but an independent author exploiting the same vulnerability with different objectives. The existence of two separate worms exploiting the same vulnerability within weeks of each other demonstrated that once a reliable exploit existed for a widely-deployed service, multiple threat actors would use it near-simultaneously. This "vulnerability pile-on" dynamic had been theorized but Code Red was among the first clear demonstrations of it at scale.
The Patching Gap
The 27-day interval between Microsoft's patch release and Code Red's major outbreak encapsulated what would become one of the persistent structural problems of internet security: the gap between vulnerability disclosure and enterprise patching. In 2001, many organizations had no formal patch management process. IIS servers were often deployed, connected to the internet, and then largely left unmanaged. The absence of automatic updates for server software (Windows Update in 2001 was focused on desktop Windows) meant administrator action was required for every security patch.
Code Red and its contemporaries (Nimda followed six weeks later, also targeting IIS) were significant factors in Microsoft's internal security reckoning that produced the Trustworthy Computing initiative in 2002 - Bill Gates's memo that initiated the security review of all Windows products and eventually produced Windows XP SP2's security improvements, automatic updates, the Windows Security Center, and the beginning of Microsoft's shift from treating security as a feature to treating it as a foundational requirement.