A process named cron is running on this machine. It has never done a cron job in its life. One command put it there; one command proves it is lying. This file runs both.
MITRE ATT&CK T1036: adversaries name their tools after trusted system processes, so a human scanning the process list reads straight past them. This file forges the name, then checks the one thing the name cannot change.
Why this technique. The process list is the first thing every triage reads: ps, top, htop, every SIEM process feed. Operators scan names, not hashes; nobody hashes ten thousand processes on a glance. The name is the index the defender reads, and it is the cheapest thing on the system to forge. Renaming the binary renames the process for free, and nothing in the kernel objects.
Why not just check every hash. At fleet scale you can: the defender hashes every running binary, the hash of /tmp/gh004/cron matches no trusted inventory entry, and the mismatch flags the impostor. But the human in the loop still triages by name first, and the human is who this technique targets. The name said cron, and for most operators that would have been enough.
Why the name is not the process. In the demo's ps -C cron -o pid,comm,args, the two columns both headed COMMAND are different things: the first is comm, the kernel's 16-byte name derived from the executable's basename at exec time; the second is args, the command line, which begins with argv[0], the invocation name, data the process supplies about itself. Both are labels. The executable itself is the file the kernel mapped and ran, and the kernel remembers which one: /proc/<pid>/exe is a symlink the kernel maintains to that file. Rename the file and the labels follow; the symlink still points at the truth.
The concrete case, before the abstraction. cp sleeper cron && ./cron & puts a process on the box. ps -C cron -o pid,comm,args prints a row that says cron. readlink /proc/<pid>/exe prints /tmp/gh004/cron. Same process, two answers. Only the second one is the kernel's.
Terms, earned. argv[0] is the name a program was invoked with; ps shows it as COMMAND, and whoever launches the process chooses it. comm is the kernel's 16-byte process name, set from the executable's basename when it starts (a process can also rewrite it with prctl, which is why the blue phase does not trust comm either). /proc/<pid>/exe is the symlink the kernel keeps to the file that was actually executed. Masquerading is T1036: presenting hostile code under a trusted name.
Scope. T1036 covers renamed files, spoofed paths, mismatched icons, and more. This file works the process-name case end to end: the label every operator reads first, and the one check that sees through it.
Ubuntu 24.04.5 LTS with gcc 13, x86-64, in a disposable VM used only for this lab. The attack needs no privilege at all: any user can name a file cron and run it. Run it on a throwaway box anyway, because you are about to practice lying to your own tools.
One C file for the payload: sleeper.c. It does nothing but sleep, because the payload's behavior is irrelevant; only its name matters.
$ gcc -O2 -o sleeper sleeper.c
Nine lines. It sleeps forever, so it stays on the process list long enough to be inspected. Everything interesting about this file happens to its filename, not its code.
/* sleeper.c - GH-004 lab payload: sleeps forever.
* Its behavior is irrelevant; only its name matters.
* The red phase copies it to ./cron and runs it. */
#include <unistd.h>
int main(void) {
for (;;) pause();
return 0;
}
Three commands. Copy the payload, rename it to cron, run it. Then ask the process list who is running, and believe the answer the way a tired operator would.
The whole attack is a filename. No exploit, no privilege, no code change: the binary is byte-identical to the harmless sleeper.
$ cp sleeper cron
$ setsid ./cron &
$ ps -C cron -o pid,comm,args
PID COMMAND COMMAND
16946 cron ./cron
There it is: a cron process, pid 16946. ps -C matched on comm, which the kernel set from the basename cron at exec time. Nothing about this row is false except the implication. An operator skimming for anomalies sees a daemon name they expect and moves on; that moving on is the entire technique.
An unprivileged user put a process named cron on the box with three commands, and the standard process listing vouches for the name. The forgery cost nothing and the listing detected nothing, because the listing was never checking.
ps printed the process's name and you believed it. Here is the precise mechanism, because the imprecision is the vulnerability: ps reads comm from /proc/<pid>/stat, where the kernel stores it in the task struct. But the process chooses that value: exec sets it from the file's basename, and the process can rewrite it any time with prctl(PR_SET_NAME). Try it: rename any sleeper to totally-legit via prctl and ps vouches for the new name while the binary is unchanged. So the name is kernel-stored but process-supplied. Now ask the kernel the question the process cannot answer for itself: which file did you actually execute. That answer lives in /proc/<pid>/exe, written at exec time, and the process has no call to rewrite it. Compare the claim (comm) against the record (exe), and believe the record.
Here is the trap: opening htop, seeing cron, and closing htop. The name is data the process supplied, laundered through a trusted tool. The check that works does not read any label. It reads the kernel's own record of the execution.
Same pid ps just vouched for. Two different questions, two different answers.
$ CPID=$(pgrep -x cron); echo "suspect pid: $CPID" suspect pid: 16946 $ readlink /proc/$CPID/exe /tmp/gh004/cron
The name said cron. The kernel says the executed file is /tmp/gh004/cron: a user-compiled binary sitting in a world-writable temp directory. The real cron lives in /usr/sbin and is started by PID 1, not by a shell in /tmp. The process did not lie about anything it controls; it simply never controlled the exe link. That is the whole detection: compare what the process claims with what the kernel recorded, and believe the kernel.
One readlink exposed the forgery ps could not see. The check costs nothing, needs no baseline, and works on any Linux: the name is the process's claim, the exe link is the kernel's record.
Three moves, in order: remove it, sweep for its siblings, make the trick harder to run. Each is one way, not the way.
It is an ordinary unprivileged process. Killing it ends the masquerade; there is no persistence here, no rootkit, no reinfection. Confirm the exe path first, so you kill the impostor and not the real daemon. If a real cron daemon is running, kill by PID, not by name: kill $CPID takes only the suspect, while pkill -x cron would take the real daemon too.
$ readlink /proc/$(pgrep -x cron)/exe /tmp/gh004/cron $ pkill -x cron
The tell was not the name; it was the address. System daemons usually do not execute from /tmp, /dev/shm, or /var/tmp, so a hit here is a lead, not a verdict: installers and user services legitimately stage in these directories. Run the Blue 1 comparison on every hit before acting. And know what this net catches: it finds executables in the wrong place. A process can also lie about its name while its exe sits somewhere respectable (a prctl-renamed interpreter in /usr/bin will not match this sweep); the name-vs-exe comparison is the detector, this sweep is the wide net. One line lists every process whose executable lives in a world-writable directory.
$ ls -l /proc/[0-9]*/exe 2>/dev/null | grep -E '/(tmp|dev/shm|var/tmp)' lrwxrwxrwx 1 root root 0 Sep 16 15:27 /proc/17306/exe -> /tmp/gh004/cron
Run it on a timer across the fleet and you have the whole monitor; production versions add alerting, not new ideas. D3FEND names the heavier forms File Hashing (D3-FH) and File Integrity Monitoring (D3-FIM): hash what runs, and notice when a trusted name points at an untrusted file.
The forgery needs two things: a writable directory and permission to execute from it. Mount /tmp, /dev/shm, and /var/tmp with noexec and the copy-rename-run sequence dies at the exec step. AppArmor or SELinux profiles do the same job per-application.
Honest limit. noexec breaks legitimate installers that stage in /tmp, and a determined attacker writes elsewhere: $HOME, /var/tmp on a lazy admin's box, a mounted USB. And noexec does not stop the interpreter route at all: bash /tmp/x.sh runs fine on a noexec mount (verified), because noexec blocks execve while a legitimate interpreter just reads the file as data. A shebang script is blocked (the kernel execs the script itself), but sh, python3, or perl invoked explicitly are not. This control raises the cost of the trick; it does not remove the trick. The exe check in Phase Blue works regardless of where the file sits, which is why detection outlives prevention here.
The impostor is an ordinary process, so killing it is trivial. The writable-directory sweep finds its siblings fleet-wide with one line. noexec and mandatory access control narrow where the trick can run. None of them changes the core fact: names are claims, and claims get checked against the kernel.
ps reads the name from comm, a field the kernel stores but the process supplies: exec sets it from the basename, and prctl(PR_SET_NAME) rewrites it at will. /proc/PID/exe is the kernel's own record, written at exec, with no call to rewrite it. When the claim and the record disagree, believe the record.
IOC checklist: signs this technique was used
Reproducibility checklist
Sources
MITRE ATT&CK T1036: Masquerading
proc(5) (the /proc/<pid>/exe symlink)
ps(1) (the comm and args output columns)
MITRE D3FEND: D3-FH, D3-FIM
A payload dated 2019 was created nine minutes ago. The timestamp said so; the kernel disagrees.