The short version
- React2Shell (December 2025): CPU, egress and cost alerts fired and were explained away. Containment took four days.
- PHP2Shell (October 2026): a decoy AWS key in the container's environment was used by the attacker. Alert in under a minute, container replaced within another minute, zero harm.
- The difference was one signal with no innocent explanation, and one automatic response that can be undone.
- The restart didn't fix PHP. It ended the attacker's session; the patched image closed the vulnerability.
1. The first time: React2Shell, four days
We were hit by React2Shell (CVE-2025-55182) on a Friday night in December 2025. The setup was ordinary: apps in containers, in a private network, behind a load balancer, with Dependabot pull requests waiting to be merged.
The attacker read the secrets from .env, used them to reach the database, and tried to export data.
Our alerts did fire. CPU at 95%. An outbound traffic spike. AWS Cost Anomaly emails. None of them said what was happening. The engineer on call had a plausible explanation, a database migration that week, acknowledged the alerts and went on with the weekend. Nobody looked again until Monday. Containment finished on Tuesday night.
The alerts worked. That was the uncomfortable part. They measured symptoms, and symptoms have innocent explanations.
2. What we changed
We didn't add more alerts. We added one signal that has no innocent explanation.
Every container got two extra environment variables next to the real ones: a decoy AWS access key and a decoy database login. The application never reads them. Nothing legitimate has a reason to use them. The AWS key belongs to an IAM user that is denied everything, so using it achieves nothing except a CloudTrail record.
Three details mattered:
- One decoy per task definition. Each key is planted in exactly one place, so the key ID tells you which workload was compromised. No investigation needed to find the source.
- An EventBridge rule on the decoy. Any CloudTrail event from that key is delivered to the agent and to Slack.
- One response that can be undone. Restart the task. A clean container from the image replaces the compromised one. If the trip turns out to be a mistake, a restart costs a few seconds of capacity.
3. The second time: PHP2Shell, under two minutes
PHP2Shell is a pair of memory-safety bugs in the PHP interpreter, reachable with one unauthenticated request. PHP shipped fixes on 21 October 2026. Amazon's MadPot honeypots had recorded exploitation on 17 October, four days earlier. No patch process could have closed that window.
On our sites it went like this:
| Step | What happened | Time |
|---|---|---|
| 1 | The attacker gets code execution through PHP2Shell and reads the environment | 0 |
| 2 | The attacker tries the decoy AWS key. CloudTrail logs the call | seconds |
| 3 | EventBridge matches the decoy; the alert reaches Slack, naming the task | under 1 minute |
| 4 | The agent restarts that task; a clean container replaces it | about 1 more minute |
Under two minutes from the attacker's first move to containment. Zero harm.
Nobody was paged to make a decision. Nobody had to work out whether a CPU spike was a migration.
4. Why it was safe to let software act alone
I call the principle automate on certainty.
If one CPU alert in a thousand is an attack, an automatic kill switch on CPU alerts is wrong 999 times. So a human has to look, and at 11pm on a Friday the human has a plausible explanation.
A decoy key is different. No legitimate process uses it, so when it is used, the chance that it's an attack is close to one. And the response we automated, a restart, can be undone. A near-certain signal plus an undoable action is the case where a human adds delay and little else.
Everything else stays with people: the patch, the review of what the attacker reached, the decision to rotate real credentials.
5. What the restart did not do
It didn't fix PHP. The image was still vulnerable, and the same attacker could have come back through the same bug. The restart ended that session before it could become four days. Only the patched image closed the door.
A honeytoken also doesn't see an attacker who never touches a decoy. It's a tripwire on the most predictable move, the credential grab. We kept GuardDuty and every alert we had. When the honeytoken tripped, those alerts became the context around it: the honeytoken decided, the alerts explained.
6. If you want to do the same
- Build one by hand in Terraform: AWS canary credentials: how to set up an IAM honeytoken. The module is on GitHub: terraform-aws-honeytoken.
- Or let Compass plant them. It's the open-source (Apache 2.0) agent in this story. It adds decoys as Terraform pull requests and has two undoable responses: restart an ECS task, deactivate an access key.
- The PHP2Shell details, affected versions and fixes are on our PHP2Shell page.
- The talk this comes from: One Fake Password Is Worth More Than 10,000 Alerts, DevOpsDays Barcelona, 14 November 2026.
One fake password did more for us than every alert we had that weekend.
7. FAQ
How was PHP2Shell detected so quickly?
By a honeytoken: a decoy AWS access key in the container's environment that the application never uses. The attacker read the environment after exploiting PHP2Shell and tried the key, CloudTrail logged the call, and an EventBridge rule sent the alert in under a minute.
Why restart the container instead of paging someone?
A decoy key that nothing legitimate uses is a near-certain sign of an attacker, and a restart can be undone. With a near-certain signal and an undoable action, waiting for a person only adds delay.
Does restarting the container fix PHP2Shell?
No. The restart replaces the compromised container with a clean one from the same image, which is still vulnerable. Only installing a fixed PHP release (8.5.12, 8.4.27, 8.3.36 or 8.2.35) and redeploying closes it.
Would the alerts alone have caught it?
They fired during React2Shell ten months earlier and were dismissed as a database migration. Alerts measure symptoms such as CPU and egress, which usually have innocent causes. Keep them as context around the honeytoken.
Written by Ilia Dubovskii, founder of Beamreach. Details are anonymised and simplified. Last checked: 24 November 2026.
Related: *2Shell vulnerabilities · PHP2Shell · React2Shell · AWS canary credentials · Honeytokens vs GuardDuty · One Fake Password (talk)
Beamreach