Security & privacy

AI tools expose critical PHP2Shell vulnerability in legacy web infrastructure

Researchers used AI to turn a minor PHP memory bug into a critical remote code execution flaw, prompting urgent patches for major sites.

Illustration of a vulnerable server being analyzed and repaired by automated tools
Illustration generated for this article

In late October 2026, cybersecurity researchers disclosed the PHP2Shell vulnerability, a critical flaw affecting a vast portion of the internet including NASA, Wikipedia, and the White House. The discovery was made possible by AI-assisted analysis that transformed a previously ignored memory error into a severe remote code execution risk. A patch was released quickly after the PHP Foundation was notified, preventing active exploitation by malicious actors.

What happened

The underlying issue originated from a bug reported to the PHP Foundation as early as 2024. This bug caused out-of-memory errors, which typically result in program crashes rather than security breaches. Because crashes are often viewed as stability issues rather than security threats, the bug remained unaddressed for years. It sat among many other low-priority reports, waiting for attention that never came due to the sheer volume of legacy code maintenance required.

The situation changed when the cybersecurity firm Calif, sponsored by OpenAI, conducted an independent audit of PHP. Within two weeks, a researcher using AI tools identified a method to exploit this out-of-memory condition. Instead of just crashing the server, the exploit allowed attackers to run arbitrary code on the host system. This escalation turned a benign bug into a critical vulnerability capable of installing malware or stealing sensitive data. The team immediately alerted the PHP Foundation, triggering an emergency response.

Following the disclosure, a team of four engineers spent two months developing a comprehensive patch. The urgency was driven by the potential impact on widely used platforms like WordPress and Drupal. While no bad actors exploited the vulnerability before the fix was released, the incident highlighted how AI can rapidly uncover dangers in older software stacks that human reviewers might overlook or deprioritize.

How it works

Exploiting the PHP2Shell vulnerability required precise manipulation of server memory. The attacker had to calculate exactly how to jump to a specific memory location and determine which bits to overwrite in a specific order to gain control of the system. This process involves complex, specific reasoning that is tedious and error-prone for humans. As Suman Jana, an associate professor at Columbia University, noted, it is not rocket science but requires painful, detailed logical steps.

AI tools assisted the researchers by handling this intricate reasoning process. The models helped map out the memory layout and identify the exact sequence of operations needed to achieve remote code execution. This does not mean AI acted alone; the researchers possessed deep expertise in both cybersecurity and PHP. However, the AI accelerated the discovery process, allowing experts to bypass some of the manual grunt work involved in tracing memory corruption paths.

The patching process also leveraged emerging AI capabilities. According to Jana, new formal verification tools can now generate patches and even produce proofs that those patches are correct. In this workflow, an LLM generates the code fix and a mathematical proof of its validity, while a separate formal checker verifies the proof. This approach aims to reduce the asymmetry between finding bugs and fixing them, ensuring that repairs do not introduce new errors or break existing functionality.

Key details

  • The vulnerability affected major sites including NASA, Wikipedia, and the White House, as well as any site running WordPress or Drupal.
  • The root cause was an out-of-memory bug reported in 2024 that was initially treated as a low-priority crash issue.
  • Cybersecurity firm Calif, sponsored by OpenAI, used AI tools to discover the exploit within two weeks of starting their audit.
  • The exploit allowed for remote code execution, enabling attackers to read sensitive data or install malware on host servers.
  • A team of four engineers spent two months developing and testing the patch to ensure it closed all attack vectors without breaking functionality.
  • Formal verification tools are being integrated into the patching process, with LLMs generating both fixes and correctness proofs.

Why it matters

This incident signals a shift in the threat landscape for developers maintaining legacy systems. For decades, technical debt in older languages like PHP has been manageable because exploiting deep memory bugs required immense human effort. AI lowers that barrier, allowing skilled researchers to find and weaponize vulnerabilities much faster. This means that old, neglected codebases are now exposed to a level of scrutiny they have never faced before, turning minor stability issues into critical security risks.

For software builders, this highlights the urgent need to address technical debt. The asymmetry between attack and defense remains a challenge, especially for open-source projects with limited funding. Defenders must now contend with adversaries who have access to powerful AI assistants. This dynamic puts pressure on organizations to invest in better maintenance practices and to support the open-source infrastructure they rely on, rather than assuming obscurity will protect them.

Furthermore, the role of AI in both attacking and defending is becoming central. While AI accelerates vulnerability discovery, it also offers new ways to verify fixes through formal methods. However, reliance on these tools requires careful oversight, as models can hallucinate. The industry must adapt by integrating formal verification into development workflows and ensuring that security updates are applied immediately, as delays can be catastrophic in this new era of automated exploitation.

What you can do

  • Update all PHP-based systems, including WordPress and Drupal installations, to the latest patched versions immediately.
  • Prioritize the resolution of old bug reports related to memory errors or crashes, as these may hide exploitable vulnerabilities.
  • Invest in formal verification tools for critical code paths to automate the validation of security patches.
  • Monitor security advisories from the PHP Foundation and other open-source maintainers closely for new disclosures.
  • Allocate budget for regular security audits of legacy codebases, potentially leveraging AI-assisted testing services.
  • Encourage immediate installation of security updates across your organization to minimize the window of exposure.
  • #php
  • #cybersecurity
  • #ai-security
  • #legacy-code
  • #vulnerability-management

Tools from the Bytechap store

Keep reading

All stories