Free 20-point conversion & SEO audit for export stores — Free website audit — claim yours

hello@woo.one Mon–Fri · 9:00–18:00 (UTC+8)

Anatomy of a Mail-Triggered Server Compromise: From a DMARC Report to a Crypto Miner

How a single forged DMARC report email turned a world-writable container directory into remote code execution, a PHP web shell and a Monero miner — plus the exact fixes we applied.

Summary

On 22 November 2026 our monitoring surfaced something no hosting dashboard warns you about: load average climbing from 2 to 77 within minutes. Two unknown processes were consuming every available core. What followed was a full incident response — and a root cause that turned out to be one email.

This post documents the intrusion mechanism, the evidence trail, and the fixes we applied, so other WooCommerce and OpenCart operators running a self-hosted mail stack can check for the same exposure.

Scope and limitations

Two parts of this account rest on inference rather than direct evidence. The write that created the first symlink was not captured: the HTTP logs for that interval contain no matching request, and the tooling that performed it had already been removed when the investigation began. The conclusion that the forged report email triggered the overwrite rests on a 37-second gap between delivery and the file modification time, the two symlinks recovered from the spool, and the parser’s documented behaviour — not on a captured execution trace. Journal retention on the host covered roughly one day, which further limited the reconstruction.

What we saw first

The symptoms were classic cryptojacking:

  • load average: 77.47, 47.32, 23.72 on a machine that normally sits below 1.
  • A process named kk started from /var/tmp/.sysd, its binary already deleted from disk while still running.
  • A second process, falsed, running as the web user from a hidden directory, holding 1.6 GB of RAM.
  • Inbound connections to gulf.moneroocean.stream:10001 — a Monero mining pool.

The miner was the symptom. The interesting part was how it got there.

Timeline of the mail-triggered server compromise: web shell, forged DMARC report, overwritten command, crypto miner, detection and rebuild
Incident timeline: from a forged report email to containment and rebuild.

The entry point: a fake DMARC report

The mailbox dmarc-reports@ on the domain existed only to receive aggregate DMARC reports. It accepted mail from anyone, and the mail server’s report parser automatically unpacked every attachment it received.

Two emails arrived 26 seconds apart. Both failed SPF, DKIM and DMARC (RFC 7489). Both were still delivered, because the report address is not a normal mailbox with policy checks attached to it.

The first email carried a 1,233-byte shell script with an innocuous attachment name. The second carried a 7-byte text file containing a single word, used to nudge the parser into processing the queue.

The attachment names were not random. Inside the report spool directory, the attacker had placed symlinks:

.i9jkt1l      -> /opt/admin/bin/extract-report
awt441xu.php  -> /opt/www/.well-known/acme-challenge/awt441xu.php

When the parser unpacked an attachment whose name matched an existing symlink, it wrote through the link. That is how a mail attachment overwrote a system command and dropped a PHP file into a web-served directory — the classic CWE-61 symlink-following pattern.

Why a single email was enough

Nothing in this chain required a password, an SSH session, or an exploit against a CVE. It required only that the container shipped with world-writable directories (CWE-732):

drwxrwxrwx  /etc/cont-init.d
-rwxrwxrwx  /opt/admin/bin/extract-report
-rw-rw-rw-  /opt/admin/.env
drwxrwxrwx  /opt/www/.well-known

With those permissions, the mail user could replace a root-owned command, plant a PHP web shell that the container’s PHP-FPM would execute as its web user, and register a start-up script that survives restarts.

Persistence and privilege

Two persistence mechanisms were found:

  1. /etc/cont-init.d/99-sysd — executed on every container start, re-downloading and launching the miner.
  2. A hidden spool directory under /var/tmp holding the binary and a log file, owned by the mail user (uid 88 inside the container).

Note the uid: the miner did not run as root. It ran as the container’s mail user. The reason it looked privileged is that the 777 permissions let that user modify root-owned files. This distinction matters during forensics — it changes both the blast radius and the remediation steps.

Distinguishing container compromise from host compromise

Host ps shows processes from every container, which can look like a host infection. Two checks settle it:

readlink /proc/<pid>/ns/mnt
ls -l /proc/<pid>/root/opt

If the mount namespace differs from PID 1’s and the paths exist only under the process’s own root, the process lives inside a container. In our case the host had no /opt/www, no /opt/admin and no spool directory at all — everything was container-local, and no escape primitives were present (no --privileged, no added capabilities, no Docker socket mount).

Remediation

In order of execution:

  1. Contain: stop the container, archive the tampered files and the spool directory as evidence, keep the compromised container stopped rather than deleted.
  2. Rebuild from a clean image: do not repair the container filesystem in place. Recreate it from the original image and remount only the data volume.
  3. Bake permissions into the image: chmod inside a running container disappears when the container is recreated. A derived image (FROM the pinned digest, RUN chmod 755 …) makes the fix permanent.
  4. Close the input: remove the report-only address or disable automatic report parsing.
  5. Rotate credentials: mail accounts, mail administrator, database users, CMS administrators, panel and SSH keys — anything readable from the compromised data volume.
  6. Block egress: null-route the mining pools so a re-infection fails fast and loudly.
  7. Harden access (see the Docker engine security guide): key-only SSH, FTP off in favour of SFTP, admin panels rate-limited or restricted by source address, and portal ports closed to the public internet.

What we changed afterwards

  • Every world-writable path in the mail container is now 755 or 644, baked into a derived image.
  • The report spool is 750 and owned by the service account, so the parser can no longer write through symlinks.
  • The report-only mailbox no longer exists.
  • Mining pool domains are null-routed at the host level.
  • All mailbox passwords were reset and verified by an actual IMAP login.
  • Log retention was reviewed: the host journal was capped at 300 MB and had rotated away the relevant window, so retention is now part of the checklist.

Lessons for anyone running mail next to a shop

  1. 777 is a vulnerability, not a convenience. In a container, world-writable paths turn any file-write primitive into code execution.
  2. Report mailboxes are an attack surface. Anything that automatically unpacks untrusted attachments is parsing attacker-controlled input on your behalf.
  3. Deadlines beat dashboards. The dashboard showed green while load average was 77. Process-level monitoring and egress alerts catch what uptime checks miss.
  4. Know which namespace you are looking at. Container and host processes appear side by side in ps; namespace inspection prevents both panic and premature relief.
  5. Patch the primitives, not the payload. Removing the miner is not remediation. Removing the writable path that allowed it is.

Related reading

Closing

Total time from detection to a rebuilt, hardened service was under an hour, and no shop data was exposed — the compromise was confined to the mail container and never reached the web application or database. The uncomfortable lesson is how little the attacker needed: one email, one writable directory, one overlooked permission bit.

If you run a self-hosted mail server, check your container images for world-writable directories (CWE-732) today. It takes one command:

docker exec <container> find / -xdev -perm -0002 -type d 2>/dev/null
S

Infrastructure and security engineer at woo.one, based in Foshan, China. Works on WordPress, WooCommerce and OpenCart systems, self-hosted mail, and the operational side of running stores for exporters.

More about the team

No pressure · No sales script

Ready for a store that sells while you sleep?

Send us your current site or product list. You will receive a fixed-scope proposal, a 20-point audit and a realistic timeline within two business days.

Reply within 1 business day NDA on request 100% code ownership
Chat with us
WhatsApp Get a quote