top of page
Search

PHP2Shell Explained: The Critical PHP Flaw That Bypasses Smart Contract Audits and How to Protect Your Wallet

Writer: Leo Wong Chin Wai
Leo Wong Chin Wai
21 hours ago
9 min read

For a decade, the crypto industry has operated on a single, comforting assumption: if the contract is audited, the funds are safe. Billions of dollars have been spent on formal verification, bug bounties, and security reviews—all pointed at the code deployed on-chain.


On October 21, 2026, that assumption was proven dangerously incomplete.


A vulnerability in the PHP engine itself, the software that powers a massive share of the internet's backend, allowed unauthenticated attackers to execute code on servers before a single line of application code even ran. No login. No wallet connection. No malicious signature. Just code execution at the server layer, sitting entirely outside the reach of any smart contract audit.


This is the story of PHP2Shell, and why every crypto user should understand it before connecting another wallet.


What PHP2Shell Actually Is

PHP is the language that generates dynamic web pages, handles backend requests, and powers platforms including WordPress, Magento, Drupal, Joomla, and Laravel. When you visit a crypto project's website, there is a meaningful chance that PHP is somewhere underneath it.


The disclosure covered two critical vulnerabilities: CVE-2026-109618 and CVE-2026-109619, collectively named PHP2Shell. Both carry a severity score of 9.2 out of 10.


The mechanism is subtle and severe. When PHP encounters a memory exhaustion condition or a request-handling error, it can misuse memory that has not been properly prepared or has already been released. Under the right conditions, an attacker can exploit this without any authentication to run arbitrary programs on the server, or to read sensitive data residing in memory—passwords, session tokens, API keys.

The most alarming finding came from the PHP team's own demonstration. Under the Apache mod_php deployment model, the attack triggers before the application code runs. Login verification and in-app security plugins may not have even initialized. The server is compromised before the application knows it exists.


According to Wiz, affected versions trace back to PHP 5.4. The flaw has existed for over a decade. And in a detail that should unsettle every security team, Wiz noted that AI models have materially reduced the difficulty of constructing and adapting complex exploits. Exploitation paths were submitted independently by Calif, OpenAI, and Wiz.


Patched versions are 8.2.35, 8.3.36, 8.4.27, and 8.5.12. Anything below those is exposed.


Why Governments Treated This Differently

The response to PHP2Shell was not the usual security advisory cycle. It was treated as an active national emergency.


Cloudflare reported observing attack traffic targeting customers at 07:43 UTC on October 21—hours before the patch was publicly released at 14:00 UTC. The technical details leaked before coordinated disclosure, and public proof-of-concept tools followed shortly after. The window between disclosure and weaponization collapsed to nearly zero.


Censys estimated approximately 1.5 million servers were running a version with no available fix at the moment of disclosure. The NSA, FBI, CISA, UK authorities, and CERT-EU all advised taking systems offline. Japan's Prime Minister Sanae Takaichi posted at 5:55 in the morning urging 48.8 million people to prepare patches or temporarily shut down their sites.


The cascade was visible in real time. The Dutch cybersecurity agency took its own website offline as a precaution. The Dutch parliament went offline. The Port of Rotterdam went offline. Finland, France, and Denmark began pulling government sites. Wikipedia went down. Archive.org went down. Asana, GOG, and Something Awful went down. The University of Vienna's webmail went offline. Japan had already been operating under an official state of emergency in cyberspace since October 9.


Binance founder Changpeng Zhao added a simple warning: be especially careful visiting websites in the coming days. That is the context. A patch existing does not mean a patch has been applied. The exposure window is measured in weeks, not hours.


The Crypto Industry's Direct Exposure

Here is the number that matters most for this audience.


SlowMist scanned 1,488 crypto-related domains and found that 793 carried a direct PHP fingerprint—approximately 53.3%. To be precise: this is a technical usage trace, not proof of vulnerability or compromise. But it establishes the scale of potential exposure across the sector.

The threat model runs along three paths, and none of them require the user to do anything wrong.


Path one: frontend tampering.

If an attacker gains code execution on a server hosting a DeFi frontend, they can modify the page to present a transaction that sends funds to a different address, or to request a malicious approval. The audited contract still behaves exactly as designed. The user signs what they believe is a normal interaction and loses funds anyway.


Path two: signing key exposure.

If a server-side signing key is compromised, an attacker may be able to move assets without any further user confirmation at all.


Path three: session and API key exposure.

Leaked sessions or API credentials enable account impersonation and data exfiltration, with damage determined entirely by the permissions attached to those credentials.


Contract audits cover none of these. They cannot cover the website, the deployment platform, or the signing server. A real domain name can still serve a tampered page.


The Railway Incident: Where Secrets Actually Live

The PHP flaw was the loudest event. The Railway breach was the most financially direct.


Railway is a cloud deployment platform widely used by crypto projects to run bots, indexers, keeper services, and API infrastructure. On October 21, Railway disclosed that a third party had accessed its system storing customer environment variables, and had read some of the decrypted contents. Railway believes the incident belongs to a broader series of attacks targeting AI inference providers.

Environment variables typically hold database passwords, API keys, and—in crypto—project signing private keys. Railway paused builds and deployments during the investigation and advised all users to rotate relevant credentials. On October 22, it added a critical clarification: stored Google Cloud and AWS credentials may also be usable to access other cloud resources, so the investigation should not be confined to Railway itself.


The financial evidence came fast. Blockchain investigator Taylor Monahan identified the first known theft transaction on October 21—more than two hours before Railway's public disclosure. By the time the disclosure was live, approximately $371,000 had been drained across more than 500 transactions on at least 19 EVM-compatible networks.


Several projects responded with precautionary measures. TokenWorks reported that all of its indexers and on-chain keepers ran on Railway; it took the keepers offline and moved 1.17 ETH out of the operational wallet—a preventive transfer, not a disclosed theft. PeekPeak confirmed that worker environment variables and an encrypted keystore password were exposed, and treated the executor private key as compromised, noting that the key had no authority over vaults or custody withdrawals and that user funds were not at risk. TheGoblinn rotated or disabled API keys and used a multisig to remove on-chain permissions from old keys.


Other projects confirmed they were unaffected by the specific vector. Pendle, Boros, Definitive, and Predict.fun stated they do not run on Railway and do not use PHP. Intersect preventively closed its members area.


The pattern is instructive. The difference between a nuisance and a catastrophe was not the platform. It was the permission design. A leaked secret that can only read data is a problem. A leaked secret that can move treasury funds is an ending.


LiteLLM and the Supply-Chain Vector

The third component of the cascade targeted credentials at the moment of delivery.


LiteLLM version 1.107.0 was pushed to PyPI and Docker Hub carrying embedded malware. The malicious PyPI wheels were live from 11:39 to 13:23 UTC. The compromised Docker images—including the latest tag—were live from 11:46 to 14:20 UTC. The payload combined a credential stealer with a remote access trojan.


The compromise traced to stolen GitHub CLI OAuth tokens belonging to three developers. Malicious packages and affected image tags have since been removed or repointed to clean builds, but the full intrusion path remains under investigation.


For crypto teams building AI-integrated tooling, analytics, trading agents, automated content pipelines, this is a direct threat. The stealer does not care what the application does. It harvests SSH keys, cloud credentials, and API tokens from the environment, and those credentials become pivot points into everything the team can reach.


Running an affected version requires full incident response, not a simple uninstall or upgrade. The environment must be treated as compromised.


A Footnote That Should Terrify Everyone

Also on October 21, Node.js patched ten vulnerabilities, four of them high severity. These included a remote code execution flaw in the Brotli decompressor (CVE-2026-111497), TLS certificate validation bypasses (CVE-2026-105483, CVE-2026-106069), and a DNS resolution flaw (CVE-2026-105482). Node.js also began blocking certificate chains associated with the eMudhra intermediate CA, whose private keys are known to be compromised.


That last detail deserves a moment. eMudhra is a certificate authority that has issued more than 60 million certificates. Its core function is proving that websites are who they claim to be. The private keys protecting that function are supposed to be random numbers over a hundred digits long. One of them was 4. Others were 66 and 237.


GitLab separately disclosed a CVSS 10.0 vulnerability—the maximum score it issues—present since 2014, affecting self-hosted instances for twelve years.


None of this is presented to induce panic. It is presented to establish the environment we are now operating in: the perimeter is soft, the credentials are the target, and the response window is compressed.


What You Can Actually Do

The instinct after a news cycle like this is either paralysis or performative panic. Neither helps. What helps is a structured triage based on where your exposure genuinely lies.


Audit your approvals, not your beliefs

Connecting a wallet grants permissions. Those permissions persist after you disconnect.

Open Revoke.cash, or the token approval checker on the relevant block explorer. Review every active allowance. Look specifically for unlimited approvals to contracts you no longer use, stale approvals from protocols you interacted with long ago, and any Permit2 allowances you do not recognize.


Permit2 deserves particular attention. It is a legitimate standard, but its off-chain signature mechanism means an approval can be granted without a visible on-chain transaction. If you signed a Permit2 permit on a site that is now compromised, that allowance may still be live.


Revoking an approval requires an on-chain transaction and gas. Disconnecting a wallet revokes nothing.


Separate your keys by function

This is the most underrated defense in crypto, and Railway made the reason impossible to ignore.


If the wallet you use for daily activity, website connections, and deployment environments is the same wallet that holds your long-term treasury, a single compromise is terminal. Build a hierarchy instead.


A hot wallet with minimal funds for active use. An operational wallet for bot signing and API-driven services, holding only what that function requires. Cold storage or a multisig for the majority of assets, with signing authority that is never stored in an environment variable on any cloud platform.


The projects that reported minimal damage were the ones whose operational keys had no authority over user funds. That architectural discipline is available to individuals, not just teams.


Treat signatures as seriously as transactions

Permit2 drainers exploit a behavioral gap: users scrutinize transactions but skim signatures. A signature request that looks like a login or a gasless approval can grant full spending authority over a token balance.


Before signing, verify the domain and the contract address. If the interface is unfamiliar or the request is unusual, stop. A hardware wallet helps because it displays the actual data being signed, but only if you read what it shows. Hardware isolates the private key; it does not prevent you from approving a malicious operation yourself.


Know what a compromised key actually requires

If a private key or seed phrase has been exposed, whether through a platform breach, a malicious package, or any other route, the recovery steps are different from a compromised approval.


Changing passwords and revoking approvals does not restore security. Create a new wallet with a new seed phrase on a trusted device and move remaining assets there. Adding a new account to the compromised wallet does not help; the seed phrase controls every account derived from it. If deposited fees are drained immediately, stop depositing—the wallet is being actively monitored.


For non-custodial users, monitoring platform announcements and account anomalies is sufficient. There is no need to replace your on-chain wallet because of a news cycle. For readers running trading bots, node tools, or AI services, the risk extends to software version, deployment platform, and the API keys you provided. Check the provider's advisory and confirm whether you are affected.


The Enzac Assessment

The October 2026 cascade is not a story about PHP, or Railway, or LiteLLM. It is a story about the gap between where the industry believes trust resides and where it actually resides.


Smart contract audits protect one layer of a multi-layer system. They do not protect the server that serves the interface. They do not protect the deployment platform holding the signing key. They do not protect the package registry delivering the tooling. They do not protect the environment variable containing the API secret.


The attacker does not need to break the contract. The attacker needs to break anything around the contract that already holds authority the user has granted.


For the individual, the defense is not technical sophistication. It is permission hygiene: knowing what you have approved, limiting what each key can do, and treating signatures with the same suspicion you reserve for transactions.


For the industry, the implication is structural. The next phase of crypto security will not be won by auditing more contracts. It will be won by reducing the authority attached to any single secret, and by treating operational infrastructure—cloud platforms, package registries, deployment pipelines—as first-class security surfaces rather than background utilities.


The attack surface has moved. The defense has to move with it.


Enzac Research will continue monitoring PHP2Shell exploitation activity, the downstream effects of the Railway incident on affected protocols, and the evolving threat model at the intersection of cloud infrastructure and on-chain authority. Users who interacted with any crypto project that has disclosed reliance on Railway or PHP-based infrastructure should prioritize approval audits and key rotation immediately.


 
 
 

Comments


© 2025 Enzac Research

bottom of page