postmortem

My Craft site ran a cryptominer for 24 days. Here's how it got in.

A postmortem of a compromised personal Craft CMS site: an unauthenticated GraphQL bug published on 22 October, exploited three days later, and found 24 days after that. What happened, how to check your own sites, and what I changed.

On 18 November I found a hidden binary in the web root of my personal site. It was a cryptominer, and it had been running inside the Craft CMS container for 24 days.

Nobody logged in. The way in was Craft's GraphQL endpoint, which my site exposed publicly so the Nuxt front end could read content. The likely bug had been fixed in Craft five weeks before the attack and publicly disclosed three days before it. My site was behind.

This is what happened, how to check your own Craft sites, and what I changed. It's one small personal site, so treat it as a field report, not a survey.

The short version

  • What: remote code execution as the PHP user inside the Craft container, used to run a cryptominer on about one CPU core.
  • How: three automated POST requests to Craft's GraphQL action URL, with no authentication.
  • When: first hit on 25 October, return visits on 1, 5 and 15 November, found on 18 November.
  • Why it worked: Craft 5.8.20 with a public GraphQL schema that could read content. That is the exact setup a published advisory needs.
  • Now: Craft is on 5.12.2, GraphQL is no longer public, the container can't change its own code, and every credential the PHP process could read has been rotated.

Timeline

All times UTC.

When What happened
17 Sep Craft 5.11.2 ships, fixing several high-severity bugs. My site stays on 5.8.20.
22 Oct I patch the PHP base image after a PHP security release. Craft is left alone.
22–23 Oct Craft publishes the advisories for the 5.11.2 fixes, including an unauthenticated GraphQL SQL injection.
25 Oct, 09:31 Three POSTs to the GraphQL action URL within five seconds. The miner starts the same second as the third request.
27 Oct A different GraphQL request pattern from another IP, probably a second scanner.
1 and 5 Nov The same three-request pattern returns from a new IP.
15 Nov Same pattern again; a new binary is written to the web root.
18 Nov I notice the binary, capture evidence, stop the container, clean up, patch, harden and rotate everything the same day.

The return visits matter. Whoever runs this keeps coming back to sites they've already compromised, which reads as automation rather than someone targeting me.

How it got in

Each visit was three POST requests to /index.php?p=actions/graphql/api, all returning HTTP 200, with response sizes of 64, 53 and 85 bytes every time. The user agent was python-requests. The miner started as a child of the PHP-FPM process the same second as the third request.

At the time the site ran Craft 5.8.20 in headless mode, with a public GraphQL schema that could read a few sections. The front end used that public schema directly.

I ruled out the usual suspects:

  • Stolen credentials: one admin user, no failed logins, and the last login matched my own activity.
  • A plugin: only Craft's own CKEditor plugin, installed months earlier.
  • A deploy or dependency: nothing was deployed in the window, tracked files were unchanged, and the payload was written at runtime, days after the container started.

The likely cause is GHSA-mjj9-pjh4-r48g, published by Craft on 22 October: an unauthenticated SQL injection through GraphQL, affecting every Craft 5 release before 5.11.2. It needs a public schema with read access to at least one section, which is what my site had.

I can't prove it. nginx doesn't log POST bodies, and Craft's logs for those days had rotated, so I have the endpoint and the timing but not the payload. The advisory describes data access, not code execution, so there was a further step I can't see. Other GraphQL issues fixed in the same release also needed only a public schema. What I'm confident about is the shape: a published, unauthenticated GraphQL bug, a public schema, and an unpatched site.

What the attacker could reach

The miner ran as the PHP user, inside the Craft container. From there it could read anything mounted into that container, and my setup mounted far too much: the whole project directory, read-write, including .env files.

I found no sign of escape to the host, database tampering or data being taken. But reading a file leaves no trace, so I treated everything readable as leaked.

Indicators of compromise

IP addresses rotated between visits, so the request pattern and file names are the stronger signals.

Type Value Notes
Request POST /index.php?p=actions/graphql/api, user agent python-requests/2.x, 3 requests in ~5 s, responses 64, 53, 85 bytes Identical on every visit
Source IP 212.83.162.37 First exploit, 25 Oct
Source IP 45.147.211.164 Return visits, 1, 5 and 15 Nov
Source IP 208.76.40.195 Different GraphQL pattern, 27 Oct
Source IP 85.155.14.49 Probed for .env and cloud credential files one second after the 15 Nov visit
File <webroot>/.sysinit Hidden, 6.1 MB static x86-64 ELF, UPX-packed
File <webroot>/.global/audited Hidden folder; binary deleted after launch
Process audited, xfsd Owned by the PHP user, ~100% of one core, binaries deleted on disk
Network 141.95.126.31:1111 (TCP, outbound) Mining pool
SHA-256 cef2b376f3c8fa718d6f036a02ff08d42106272ba495287e3a94d071caac3ba3 .sysinit as found on disk
SHA-256 5ad3634efd39ad83fd1579e0a1296fd2ee5c50c7b3fe53e49b19a26fbc0eda03 Running xfsd
SHA-256 e15d2363b9e4552250f230c62188cb299ff2570c9ba9589fbc3e190df84768ba Running audited

Check your own Craft sites

Run these on any internet-facing Craft 5 site, starting with ones that have GraphQL enabled. Paths assume a standard Craft layout.

1. Version. Anything below 5.11.2 should be updated now; 5.12.2 is current at the time of writing. Check with composer show craftcms/cms or under Settings → Updates.

2. The request pattern in your web logs, whatever the IP:

grep -E 'POST /(index\.php\?p=)?(actions/)?graphql/api' access.log* | grep -i 'python-requests'

3. Hidden files in the web root. Executable or binary dotfiles have no business there:

find <craft>/web -name '.*' -type f -newermt '2026-09-01' -exec file {} +
find <craft>/web -name '.*' -type d

4. Processes owned by the PHP user that aren't PHP-FPM, especially ones using a lot of CPU or running from deleted files:

ps -eo user,pid,ppid,%cpu,etime,args --sort=-%cpu | head
ls -l /proc/*/exe 2>/dev/null | grep deleted

5. Outbound connections from the web tier to unusual ports. Mining pools often use 1111, 3333, 4444, 5555 or 14444. In Docker, look inside the container's network namespace (nsenter -t <pid> -n ss -tunp), because ss on the host won't show it.

6. Your GraphQL exposure. Can an anonymous client query your schema, and what can the public schema read? If only your own front end uses GraphQL, turn the public token off and query Craft from your server with a private-schema token. Craft then answers anonymous requests with "Missing Authorization header" on every route.

7. What the PHP process can read and write. If application code or vendor/ is writable, a code execution bug becomes persistent. If other apps' .env files are visible, it becomes a credential leak.

If anything matches, keep the evidence (hashes, process list, logs) before you clean up, then rotate every secret the PHP process could read.

What I changed

The goal was that the same bug, if it still exists in some form, could no longer persist anything or read secrets.

  • Patched. Craft 5.8.20 → 5.12.2, with migrations tested on a copy first, and PHP moved to 8.3. composer audit is clean apart from a few Twig advisories that every Craft 5.12 release still pins; those need a logged-in user who can write templates.
  • Made GraphQL private. The public token is off, so Craft refuses anonymous queries. The browser asks my own server for named, pre-defined queries; only the server holds a token and talks to Craft.
  • Cleaned up. Removed the miner and the dropped files, and reinstalled vendor/ from the lock file, because the attacker could write to it.
  • Made the code read-only. The PHP container can now write only to Craft's storage and uploads. Temporary storage can't execute programs, the container can't gain new privileges, and it can no longer see other apps or their secrets.
  • Rotated everything the PHP process could read: database passwords, Craft's security key, the admin password (now with two-factor), mail and third-party API credentials, and server access.
  • Tightened access and deploys. Deploy keys can only run the deploy, SSH is key-only, and every deploy backs up the database first and smoke-tests the site afterwards.

I also fixed my open-source craft-nuxt-starter, which shipped the same public-GraphQL pattern. It now keeps Craft's GraphQL private and routes the browser through a server-side allowlist.

What I'm taking away

Patch the CMS, not just the runtime. I updated PHP within a day of a PHP security release and left Craft behind. The bug that mattered was in Craft.

A public GraphQL schema is an attack surface, not a convenience. If only your own front end reads the data, there's no reason for anyone else to reach it.

Assume code execution will happen, and decide in advance what it can touch. Read-only code and a container that can't see other secrets would have turned a 24-day compromise into a miner that died with its container.

Watch for the boring signals. A CPU core pinned for three weeks is not subtle. I didn't have anything watching for it.

Caveats

  • This is one small personal site. It says nothing about anyone else's exposure; the checks above are how to find out.
  • The exact vulnerability is unconfirmed. The evidence shows the endpoint and the timing, not the payload.
  • "No data taken" can't be proven, so everything readable was treated as leaked and rotated.
  • The malware family isn't identified. The hashes above can be looked up on VirusTotal or similar.

Check Craft's security advisories for current version cut-offs before relying on the ones here.