What happened
How one visit takes over a server, and what updating doesn't fix
Every time someone opens a page, PHP builds it on the server. It does not keep a ready-made page waiting — it assembles a fresh one for each visitor, pulling in things like the right prices, the person's name and what is in their cart, then sends back the finished page. It does all this before the website's own code runs and before anyone logs in. A visit built to run PHP out of memory at exactly the wrong moment leaves it half-finished. PHP then treats the half-built data as real, and that lets the visitor run their own commands on the server. Where PHP is part of the web server (IT calls this mod_php), that one visit is enough.
Get that far, and the stranger can reach whatever the server can — the customer list, orders, payment settings — to copy it, change the site, or leave a hidden way back in. This is no longer hypothetical: CISA now lists both flaws as used in real attacks.
A customer
Sees the page
The attacker
The server runs their commands, no password
The leak is why the clock matters. The details went public on 20 October, a day before PHP's fix; when CISA issued its alert on 21 October it had not yet seen a successful attack, and by 26 October it did. Updating now is how you stay on the right side of that line.
You would expect the update to end it there. It doesn't, for two reasons. First, it can't reach PHP built into products you bought — the maker has to fix those, and days after the release some still had no fix. Second, it can't undo a break-in that happened first, so any server that sat unpatched for days needs checking.
Almost every company runs PHP somewhere, often where no one remembers putting it. The update is the easy part; knowing every place PHP runs is the hard part. Start that list today.
Join free to read the rest
Join free to read how they did it, the exposure check, the fix step by step, how to be ready for the next one, and what we don't know yet.
Are you exposed?
Am I exposed to the PHP flaw?
Check your company in under a minute. Answer for your own company. Each answer narrows what to do next.
A PHP error with "Allowed memory" and " in Unknown " in it
Where IT looksThe PHP error log. CISA's detection rule looks for this trace
The website's PHP starting commands or downloading tools
Where IT looksServer process logs. CISA has published detection rules for this
New or changed .php files, or one containing system($_GET
Where IT looksWeb folders sorted by date changed, especially upload, cache and temp folders
New user accounts, scheduled tasks or login keys
Where IT looksThe server's accounts and task list
New admin users on the website itself
Where IT looksThe website's admin panel
The server connecting to addresses it never used before
Where IT looksFirewall logs
Visits from the 14 addresses and 3 domains CISA lists, or the names of public attack tools
Where IT looksFirewall and web logs; the list is in CISA's detection rule (Fix it, "After the fix")
If you've been hit
The first hour
Our view: the sources give no recovery steps for these flaws, so this is standard incident practice. Work in this order: contain it, keep the evidence, then rebuild.
-
IT, with the cyber-security head's approvalCut the server off from the internet, but don't switch it off
For example: the shop shows a maintenance page from another server. The server's memory holds evidence of what ran, and switching it off loses it.
-
ITBlock the server from reaching anything else
You should see: The server can't reach the internet or any other system.
For example: the database, file shares and other servers. An attacker's next move is from this server to the next one.
-
ITCopy the disk and logs before changing anything
For example: a full copy of the server, kept somewhere the attacker can't reach. Wiping first destroys the record of what was taken.
-
ITChange every password and key the server held, from a clean computer
For example: database passwords, payment-provider and API keys, admin and email logins. Assume they were copied.
-
ITCheck the neighbours for the same signs
For example: any server on the same network, or sharing the same passwords, gets the break-in checks above.
-
the cyber-security headCall an incident response firm and your lawyers
For example: in India, CERT-In requires a cyber incident to be reported within 6 hours of noticing it. Under the GDPR, a personal-data breach goes to the regulator within 72 hours. In the UK, NCSC lists approved incident response firms.
-
ITBring the site back only on a rebuilt server
You should see: The new server runs a fixed PHP and shows none of the signs above.
For example: a fresh server on a fixed PHP, with data restored from a backup made before the break-in. Updating the old server would not remove a backdoor.
Fix it
The fix, by deadline
Step by step, with who does each one.
Update every PHP you run
By tonight, every PHP you run is on a fixed version or offline. Work through internet-facing sites first, and sites where PHP is part of the web server (mod_php) before the rest.
-
ITList every place PHP runs
You should see: One list, internet-facing systems at the top.
For example: websites, staging copies, admin tools, and the server images and containers the team builds. NCSC says check every version, not just old ones.
-
IT or your web hostUpdate PHP to a fixed version, by the route that fits each system
You should see: 8.5.12, 8.4.27, 8.3.36 or 8.2.35, or the supplier's fixed package.
For example: on shared hosting or managed WordPress, the web host updates it; get the fixed version confirmed in writing. On your own Linux server, install the supplier's security update; the version number may not change, so trust the supplier's notice (our view).
-
ITRestart PHP and the web server
You should see: The website itself reports the fixed version, not just the server.
Our view: until they restart, servers keep running the old, unfixed PHP. This is the step most often missed.
-
developersRebuild and redeploy every container
You should see: No running container on an old image.
Our view: updating a server does not change images already built. Rebuild each image on a fixed PHP, redeploy it, and delete the old images.
-
IT, with the cyber-security head's approvalMove anything on PHP 8.1 or older to a newer version; until then, take it offline
You should see: Nothing on old PHP is reachable from the internet.
For example: an old customer portal on PHP 7.4 goes offline until it is moved. PHP has published bare-bones fixes for 7.4, 8.0 and 8.1, for teams that build PHP themselves; some suppliers offer fixed packages.
-
ITCheck bought products against the Dutch NCSC's list and each maker's notice
You should see: Every product shows the maker's fix installed, or is offline.
For example: check the Dutch NCSC's list for your products and ask each maker. As of 27 October it still flagged products that bundle PHP as vulnerable. Install fixes as they arrive; keep anything unfixed offline.
Stop-gaps until you can
These buy time for a server that can't be updated straight away. PHP says they reduce the risk but do not make a server safe. Updating is the only full fix.
-
ITTurn off session upload progress, then restart every PHP worker
You should see: Upload progress shows as off in the settings PHP is actually running with.
For example: set it in php.ini, the FPM pool or the server settings, never with ini_set() or .user.ini. Keep it after updating too: PHP's 23 October notice says leave it until its next regular release.
Show the command
session.upload_progress.enabled=0
-
ITRemove PHP's memory limit, in a way websites can't override
You should see: No memory limit in PHP, and a container limit in its place.
For example: set it with php_admin_value and check no other setting puts a limit back. Cap memory with a container limit instead; PHP says not to use RLIMIT_AS or RLIMIT_DATA, as they can trigger the flaw.
Show the command
memory_limit=-1
-
ITLower the largest upload PHP accepts
For example: use 32M if the site needs file uploads, and keep upload_max_filesize below it.
Show the command
post_max_size = 8M
-
ITOn PHP 8.5 only: turn off fatal error backtraces, then restart every worker
Show the command
fatal_error_backtraces=0
-
ITPut a web application firewall in front of the website
For example: CISA says a web application firewall may give some protection until the update is done.
Prove it's fixed and clean
By Friday, you can tell the board every server is fixed and none was broken into.
-
ITRe-check every system on the list for its version and a restart
You should see: The list from today's step 1 is 100% fixed or offline.
-
securityRun the break-in checks on every server that was unfixed after 20 October
For example: the signs and where to look are under "Are you exposed?". NCSC advises this; if the team can't, bring in an incident response firm.
How much does fixing the PHP flaw cost?
IT or web-host time per system; the sources give no price
Lost sales or service while a system is down
Developer time; the sources give no figure
Only if needed; the sources give no price
After the fix
Keep it from coming back
The fix is in. These are the checks that tell you it stays that way.
What to watch
CISA asks every company to watch for PHP launching command lines or downloading tools, and has published a detection rule that looks for five signs. Steps 1-5 put each sign on watch; step 6 is our view. Keep them on for at least three months (our view).
-
security, or your IT providerLoad CISA's detection rule into your security monitoring
You should see: The rule runs on a schedule, and every hit reaches a named person.
For example: download this file from CISA's SIGMA Rules repository on GitHub (cisagov/SIGMA_Rules), convert it to your monitoring tool's format with a Sigma converter (CISA allows an online one for this rule), run it over web, server and PHP logs back to 20 October, then schedule it. CISA warns some branches give many false alarms, so tune it; every hit gets a look.
Show the command
CISA_SIGMA_261429_CVE_2026_109618-109619_PHP2Shell_TLP_CLEAR.yaml
-
securityAlert when PHP or the web server starts a command line or a download tool
You should see: An alert, or a daily list that is normally empty.
For example: CISA's rule flags php-fpm, php-cgi, apache2 or httpd starting sh, bash, cmd, powershell, python, curl, wget, nc, whoami, id or uname. With a security agent (EDR), set that as an alert. Without one, the Linux commands above log every program the web user starts; 33 is the web user on Ubuntu and Debian (find yours with id -u www-data). Our view: few websites ever need to start a program, so each entry is worth a look.
Show the command
auditctl -a always,exit -F arch=b64 -S execve -F euid=33 -k php-exec ausearch -k php-exec -i
-
ITSearch PHP's error log daily for CISA's memory-error pattern
You should see: No matches. Any match means someone tried; check that server for a break-in.
For example: CISA's rule flags a fatal error that combines "Allowed memory" with " in Unknown " — the trace this attack leaves. Use the path of your own PHP error log. If you removed the memory limit as a stop-gap, this error stops appearing, so rely on steps 1 and 2 instead.
Show the command
grep "PHP Fatal error" php_error.log | grep "Allowed memory" | grep " in Unknown "
-
ITSearch the website's folders for the one-line backdoor CISA describes, and watch them for new files
You should see: The first command finds nothing; every file the second lists is one your team changed.
For example: CISA's rule looks for a planted file that runs whatever command a visitor puts in the web address. Use your own website folder in place of /var/www. The second command lists .php files changed since 20 October; each should match a release your team made. Then switch on file-change alerts in your security agent, or a file checker such as AIDE (our view).
Show the command
grep -rl 'system($_GET' /var/www find /var/www -name '*.php' -newermt 2026-10-20
-
ITBlock the attack addresses and markers CISA lists, and search your logs for them
You should see: The addresses are blocked, and no log line matches since 20 October.
For example: CISA's rule lists 14 internet addresses and 3 web domains seen in attacks, and the names of public attack and scanning tools. Copy the addresses and domains from the rule into the firewall's and DNS's block lists, and search firewall and web logs back to 20 October for them. The command above finds the tool names in a web log.
Show the command
grep -E "php2shell|B7kQpoc|BGCTXBOUNDARY" access.log
-
ITCheck every week for new admin accounts and new passwords or keys
You should see: Every account, task and admin is one your team set up.
Our view: an attacker who got in usually leaves a way back — a new user, a scheduled task or a website admin. The commands list the server's user accounts, the web user's scheduled tasks and, on WordPress, the site's administrators. If you changed passwords after a break-in, any attempt to use an old one means it was copied: block that address and widen the check.
Show the command
awk -F: '$3>=1000' /etc/passwd crontab -l -u www-data wp user list --role=administrator
Keep it fixed
The next PHP flaw will need the same list and the same speed.
-
ITKeep watching for PHP updates and makers' notices
For example: a weekly check of php.net and each maker's security page. PHP plans a further advisory with its next regular release.
-
IT, with budget from the cyber-security headMove off PHP 8.2 before 31 December 2026
For example: put the move in this quarter's budget. PHP says 8.2 gets no security fixes after that date.
-
ITKeep the list of every place PHP runs up to date
Our view: add each new site, product and container as it arrives, so the next update takes hours, not days.
Precautions
What would have reduced the impact
No update could have stopped this before 21 October: the details leaked a day before the fix. What decided the damage was four things: how fast a company found its PHP, whether it saw the attempt, whether the attacker's commands could run, and how far one taken-over server could reach.
Treat every internet-facing server that runs PHP as exposed by default. The companies that move fastest on the next PHP flaw will be the ones that already know where PHP runs, and that built their servers so one break-in stays one break-in.
Each row below is a defence that would have limited this attack. Tick "We already do this" on the ones your company has; this score counts them. Every row left unticked is listed under "Your gaps", with the Fix it step that closes it.
What would have caught the PHP attack early?
- 1
A list of every place PHP runs, kept up to date
ITWith it, IT could update everything on 21 October, the day the fix came out. Without it, IT is still hunting for PHP — the first thing CISA asks for — while attack code circulates.
- 2
Security notices the day they come out, and automatic security updates
ITWith them, the fix could be in within a day. Without them, a company hears from the news days later — after CISA said on 26 October that attacks are under way.
- 3
Alerts on what PHP does
SecurityWith them, an attempt can show up the hour it happens. Without them, a break-in is found weeks later, or never. How to set them up: Fix it, "After the fix".
What would have limited the damage
- 1
Run PHP separately from the web server (PHP-FPM) where you can
ITWith PHP-FPM one visit is not enough: the attacker also needs a weak spot in the website's own code. PHP rates mod_php the highest risk.
- 2
Run PHP as a user that cannot change the website's files
ITOur view: an attacker's commands run with PHP's rights. If PHP can't write to the website's folders, it can't plant the backdoor CISA describes.
- 3
Turn off the PHP functions that run commands, where the website doesn't need them
ITOur view: setting disable_functions to exec, system, shell_exec, passthru, proc_open and popen makes the simplest backdoor fail. It slows a skilled attacker; it does not stop one.
- 4
Stop web servers starting connections to the internet
ITCISA's warning sign is PHP downloading tools. Our view: a web server answers visitors and rarely needs to call out, so blocking it stops the download and the theft of data.
- 5
Connect each web server only to what it needs
IT, with securityA taken-over server reaches whatever it is connected to — customers, orders, payment settings. Our view: give it a database login that can read and write only its own tables, and keep payment keys off it.
- 6
Run websites from containers rebuilt on every release
ITOur view: a planted file disappears at the next redeploy, and a read-only container can't be written to at all.
- 7
Put a web application firewall in front of public websites
ITCISA says it may give some protection while an update is done — not all.
- 8
Keep tested backups out of the web server's reach
ITOur view: a clean backup from before the break-in is what lets you rebuild in hours, not weeks. Test a restore every quarter.
- 9
Budget to stay on a supported PHP
IT / cyber-security headPHP 8.1 and older get no fix for these flaws at all. PHP 8.2 gets no security fixes after 31 December 2026.
- 10
Have an incident response firm and a plan ready before you need them
IT / cyber-security headOur view: in India, CERT-In's 6-hour reporting clock starts when you notice. A firm on call and a one-page plan turn a panic into a checklist.
Each one is closed by the Fix it step named on its row.
Facts about these flaws in the right-hand column are from NCSC, CISA and PHP. Everything marked "Our view" is our advice.
For the CEO
What should I ask IT about the PHP flaw?
- Where do we run PHP, including inside products we bought?
- Is every one on a fixed version and restarted, and if not, when will it be?
- Which products are we waiting on a maker for, and are they offline meanwhile?
- Did any server stay unfixed after 20 October, and has it been checked for a backdoor?
- Is CISA's detection rule running, and who gets the alert at 2 a.m.?
How they did it
How does the PHP flaw let attackers take over a server?
Follow one online shop (our example) through two visits at the same moment: a customer's and an attacker's.
- 1
Two visits arrive
Both look like ordinary visits to the shop's website, and neither has logged in — PHP handles a visit before the website asks for a password. Every visit carries some data: the page wanted, and anything typed into a form or attached as a file. PHP sets aside a fixed amount of room to hold it.
A customerFills in the checkout form — name, email, one item. A few lines of data, well inside the room PHP keeps.
The attackerSends the same kind of visit, but pads one field (say a file upload) with millions of junk characters — far more than any real visit, filling the room to the brim.
- 2
PHP runs out of room and stops with an error
PHP keeps a fixed amount of room for each visit. The customer's visit fits. The attacker's does not, so PHP stops the visit and writes an "Allowed memory" error to its log. So far, PHP is working as designed.
A customerPHP builds the page
The attackerPHP stops halfway and logs the error
- 3
The clean-up after the error goes wrong
After stopping a visit, PHP closes it down: it puts away what the visit was using and hands the memory back for the next visitor. This is the flaw. Some of that data was only half-written when PHP stopped, and the clean-up reads it as if it were complete. The attacker chose what went into it — and what they put there is an instruction for the server to run. For example: "read the file that stores the database password and send it to this address." PHP carries it out. The second flaw reaches the same point through memory PHP had already handed back.
A customerNo error, nothing to clean up: sees the page
The attackerThe server runs the instruction, reads the database password and sends it back to the attacker — in the reply to the very same visit, or out to a computer the attacker names. No password was ever asked of the attacker.
The attacker gets their answer the same way any website replies — so nothing looks out of place. If instead the instruction sends the data out to the attacker's own computer, the server makes a connection it normally never would. That outbound connection is one of the signs to watch for under "Are you exposed?".
- 4
The attacker is inside
The server now does whatever the attacker tells it, with PHP's rights. Where PHP is part of the web server (mod_php), that took one visit; where PHP runs separately (PHP-FPM), the attacker also needed a weak spot in the shop's own code.
What the server can reachWhat the attacker can do with itWhat the server can reachThe customer list What the attacker can do with itCopy names, emails and addressesWhat the server can reachThe orders and payment settings What the attacker can do with itRead them, or change where payments goWhat the server can reachThe website itself What the attacker can do with itChange pages, or hide a backdoor to come back later - 5
The fix closes the door, not the backdoor
On 21 October PHP released fixed versions, in which the clean-up no longer uses half-written data. The shop installs one (Fix it, "Today"), and the trick stops working.
After the updateWhat it meansAfter the updateNew attempts What it meansFail. The visit still stops with an error, but nothing the attacker sent gets carried out.After the updateA backdoor left before the update What it meansStill works. Updating PHP does not remove it — that is why NCSC says check any server not updated straight away.
So two things end this attack: the update, which stops new break-ins, and the backdoor check, which finds the old ones. Fix it walks through both.
What we don't know yet
Limits, and what would change our mind
What the sources leave open, and how to act anyway.
Attacks are confirmed
On 26 October CISA added both flaws to its list of flaws known to be used in real attacks
Stop-gap settings are partial
PHP says they reduce the risk but don't make a server safe
Bought products depend on their makers
Some products that bundle PHP still had no fix; the maker sets the date
A third, smaller issue is still open
PHP says it needs an unusual setup and will fix it in its next regular release
Facts here are as reported by NCSC, CISA, PHP and the Dutch NCSC. We have not tested them independently.
What would change our mind
Attacks are confirmed in the wild
Anything not yet updated should go offline at once, not this week.
PHP confirms the stop-gap settings fully block both flaws
They become an acceptable bridge, not a partial one.
A maker confirms its product can't be reached through these flaws
That product drops off the to-fix list.
Sources
Check our working
- NCSC alert: Critical security issue affecting PHP (21 Oct 2026)
- CISA alert: Critical Vulnerabilities in PHP Require Immediate Patching (21 Oct 2026, updated 23 Oct)
- PHP security advisory: Critical remote code execution vulnerabilities, update now (21 Oct 2026)
- The PHP Foundation: Today's PHP Security Release, and How We're Strengthening PHP Security (21 Oct 2026)
- NCSC-NL: php2shell vulnerabilities, software list (updated 23 Oct 2026)
Found this useful? Send it to someone who should read it.