Can AI Find Software Bugs That Developers Miss? Lessons from PHP2Shell
Some software security vulnerabilities survive for years in plain sight. They sit in code that thousands of developers have read, that professional auditors have examined, and that runs a large part of the web. PHP2Shell is one such case, and it offers a useful answer to a question many teams now ask: can AI vulnerability detection find flaws that people overlook?
In short, yes, but only when skilled people steer it and test what it produces. Researchers used AI models to help uncover two critical flaws in the PHP engine, then did the demanding work of proving them real. As AI-assisted software development becomes routine, the same technology is increasingly used to check code as well as write it.
What Is AI Vulnerability Detection?
AI vulnerability detection uses machine learning models, usually large language models, to help find security weaknesses in software. Instead of matching code against a fixed rulebook, the model reads the source, reasons about what it is meant to do, and points to places where it could misbehave.
Depending on the tool, that can include AI-powered code analysis that spots suspicious patterns, tracing how data travels through a program, suggesting test cases, and helping a researcher develop and check a theory. No single system does all of this well, and results vary with the model and set-up.
It sits alongside older methods. Static analysis scans code against predefined rules. Dynamic testing runs the software and watches what happens. Manual review relies on an experienced person reading carefully. AI is more flexible than rules, but less predictable.
What Is PHP2Shell and Why Does It Matter?
The PHP2Shell vulnerability is a pair of flaws in the core PHP engine, tracked as CVE-2026-109618 and CVE-2026-109619. Both allow remote code execution, meaning an attacker can run commands on a web server, and neither requires a login. PHP, acting as the CVE numbering authority, rates both 9.2 on the CVSS v4.0 scale, which is Critical.
The first involves out-of-memory corruption: PHP runs out of memory part-way through building an internal structure, and later cleanup code trusts the unfinished result. The second involves stale global state, where request data lingers after the memory behind it has been freed.
The PHP project released fixes on 21 October 2026 in PHP 8.5.12, 8.4.27, 8.3.36 and 8.2.35. Calif, the firm that reported the first flaw, says the earliest affected code path dates to PHP 5.4.0, and it confirmed working exploits against tested versions of popular applications such as WordPress and Drupal. Details leaked before the planned disclosure, so PHP brought its release forward.
Because so many sites depend on PHP, these PHP security vulnerabilities matter well beyond specialists. See the PHP security advisory for official guidance.
How AI Helped Researchers Identify PHP2Shell
The clearest account comes from Calif’s own write-up. Calif worked through OpenAI’s Patch the Planet initiative at the PHP Foundation’s invitation. Wiz independently found and reported both flaws, using its own tooling alongside several commercial models.
The researcher did not simply ask a model to find bugs. Calif notes that others had already run extensive AI-assisted audits of PHP. Its advantage was a theory. A memory-limit flaw was published in 2004, a related bug was reported in 2020, and a 2024 audit rediscovered it but could not prove it exploitable. The researcher went looking for relatives.
The AI’s contribution was specific. While reviewing how PHP handles allocation failures, the model noticed an internal function that updated a counter before finishing the entry it described. If memory ran out in between, cleanup treated a half-built entry as valid. The researcher then had the model turn that pattern into a reusable set of instructions, which surfaced a further issue in session upload progress.
People and conventional testing did the rest. Calif built working exploits, tested them against real applications and reported through coordinated disclosure. PHP confirmed the proof of concept on 15 August 2026. Calif also states that no special harness or restricted models were used, and that no model finds every bug from simple prompts.
Can AI Detect Software Bugs That Developers Miss?
Sometimes, yes. AI software bug detection works best when an expert asks a focused question and has a way to test the answer. Three areas stand out.
Finding Complex Code Paths
Some bugs live between components rather than inside one function. PHP2Shell needed a memory failure during request parsing to meet cleanup code elsewhere, and in one variant a second request had to reach state left behind by the first. A model can follow such paths across many files quickly, though it still needs direction.
Investigating Memory Safety and Runtime Issues
A developer building a WordPress plugin never sees PHP’s internal bookkeeping, so flaws there escape ordinary application-level review. These ones depended on exhausting memory at a precise moment. PHP2Shell shows AI can help researchers reason about runtime behaviour like this. It does not show that models reliably find every memory flaw.
Supporting Automated Vulnerability Discovery
AI can help draft test cases, propose hypotheses and sift candidate findings, which supports automated vulnerability detection at scale. These abilities vary widely between systems, and the output is only as good as the checking that follows.
AI Code Review vs Traditional Software Testing
Each method catches different problems:
- Static analysis: fast and consistent on known bug classes, but limited to the patterns it has been given.
- Dynamic testing and fuzzing: runs the real software, so findings are reproducible, but coverage depends on the inputs tried.
- Manual secure code review: brings human judgement about design and logic, but is slow and depends on reviewer attention.
- Penetration testing: tests the deployed system as an attacker would, though only at a point in time.
- AI code review: reasons across files and suggests tests, but can be inconsistent and wrong.
Combined, they cover each other’s blind spots. Relying on one method leaves gaps.
What Are the Limitations of AI-Powered Vulnerability Detection?
AI models produce false positives, flagging code that is safe, and false negatives, missing real flaws. They can also state unsupported conclusions with complete confidence, so every claim needs reproducing before anyone acts on it.
Environment matters too. PHP2Shell’s exploitability depended on PHP version, server interface and configuration, with different paths needed for Apache’s mod_php and PHP-FPM. A model reading source code does not automatically understand how that code is deployed.
Over-reliance is the quieter risk. Calif’s researcher stressed knowing the target and its history, and observed that models tend to drift towards recent, prominent bugs rather than obscure old ones. Human expertise decides where to point the tool, and secure development practices still do most of the work.
How Businesses Can Use AI to Improve Software Security
None of this guarantees security, but a few habits improve the odds:
- Add suitable AI-assisted analysis to the development lifecycle, alongside established static and dynamic security testing.
- Have a person review critical AI-generated findings before changing any code.
- Test fixes and add regression cases so the same flaw cannot quietly return.
- Keep dependencies, runtimes and security patches current. For PHP2Shell, upgrading to a fixed release is the real remedy, and Calif describes configuration changes as temporary, partial mitigations only.
- Set a clear process for triaging, prioritising and resolving findings, with named owners.
Conclusion: What PHP2Shell Teaches Us About AI and Software Security
PHP2Shell shows that AI vulnerability detection can help researchers find complex weaknesses that conventional approaches passed over, even in code audited for years. It worked because skilled people asked good questions, tested the answers and disclosed responsibly. It does not replace experienced developers or rigorous testing.
The sensible way forward is to treat AI as one more capable tool inside a disciplined process. Attackers can use similar tools, so the teams that patch quickly and validate carefully will be best placed.
Also Read: Is Your PHP Website Secure? Lessons from the October 2026 PHP2Shell Vulnerability
Share On :