The process list says /usr/bin/ssh-agent is running on this machine. It has never held a key in its life. One command forged the testimony; one command reads the record. This file runs both.
MITRE ATT&CK T1564.010: adversaries launch processes with spoofed arguments, so the command line that every operator and every SIEM reads tells the attacker's story. This file forges the story at launch, then checks the one thing the story cannot change. Two actors: the attacker, who owns the launcher and the forged argument vector; and the defender, who owns every read, hunt, quarantine, and rule in the blue phases.
Why this technique. The command line is the process's testimony about itself, and it is the most-read text on the system: ps aux, htop, top, every EDR process-creation event, every SIEM process log. Operators triage by reading stories ("ssh-agent -s, that is fine") rather than verifying them, because verification costs attention and the story is usually true. Forging the story costs one argument to one system call, and then the entire monitoring stack vouches for the fiction, because printing the testimony is its job.
Why not just read ps carefully. The obvious alternative is the careful listing: run ps -o pid,args, read each row, move on. Break it on the concrete input from this file: the row reads /usr/bin/ssh-agent -s GHOSTLIGHT-CANARY-021. Nothing in that row is misrendered; it is exactly what the process said, byte for byte. The failure is not in the tool, it is in the trust: ps prints the process's testimony, and testimony is evidence only when something corroborates it. (Renaming the binary forges the kernel's short name instead; this technique leaves the binary's name alone and forges only the argument vector, so name-based checks pass clean.)
The mechanism, in one line. execve(path, argv, envp) is the system call that starts a program: path selects the file the kernel maps and runs, and argv is an array of strings the caller supplies. Convention says argv[0] names the program, but the kernel does not check: it copies argv onto the new process's stack as given. /proc/<pid>/cmdline exposes those bytes (NUL-separated), and ps prints them. /proc/<pid>/exe is the kernel's own symlink to the executed file, set from path at exec time, never from argv. The testimony and the record have different authors, and only one of them is the kernel.
The concrete case, before the abstraction. In /tmp/gh021: ./testify & starts the lab binary, which re-executes itself with a forged vector. ps -o pid,args prints /usr/bin/ssh-agent -s GHOSTLIGHT-CANARY-021: the daemon's story. tr '\0' '\n' < /proc/<pid>/cmdline shows the forged bytes, three NUL-separated strings. readlink /proc/<pid>/exe prints /tmp/gh021/testify: the kernel's record. Same process, two authors, two answers.
Terms, earned. argv is the argument vector: the process's words about itself, supplied by whoever launched it. argv[0] is the first word, conventionally the program name, chosen by the launcher, not the kernel. execve is the system call that starts a program from a file path plus an argv. cmdline is /proc's view of argv, the testimony in raw bytes. The exe link is /proc/<pid>/exe, the kernel's symlink to the file it actually executed. Process argument spoofing is T1564.010: launching with a forged argv so the testimony tells the attacker's story.
Scope. T1564 covers hiding artifacts broadly: hidden files, hidden users, and more. This file works the process-argument-spoofing case end to end: the launch-time forgery, the testimony-vs-record check, the fleet hunt, the evidence-first containment, and the execve audit rule. The canary is a benign token: it marks the lab payload and touches nothing else. The lab runs in a disposable namespace under /tmp because the blue phase hunts, kills, and quarantines for real.
Ubuntu 24.04.5 LTS with gcc 13, x86-64, in a disposable namespace used only for this lab. The attack needs no privilege at all: any user may pass any argv to execve. Run it on a throwaway box anyway, because you are about to practice forging testimony.
The recording starts from an empty private /tmp inside its own mount namespace, so every take begins identical. rm -rf /tmp/gh021 starts clean; mkdir -p and cd set up the lab directory. The heredoc writes testify.c (quoted 'EOF', so the shell passes the source through untouched); gcc -O2 builds it; ls -l shows the lab binary. The attacker needs no privilege: forging argv is a caller-supplied argument, not a capability.
$ rm -rf /tmp/gh021; mkdir -p /tmp/gh021; cd /tmp/gh021
cat > testify.c <<'EOF'
/* testify.c - GH-021 lab: launch-time argument spoofing (T1564.010).
* Launcher mode (no canary in argv): re-exec self with a forged argv.
* Payload mode (canary present): print the benign canary, then sleep. */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
static int has_canary(int argc, char **argv) {
for (int i = 0; i < argc; i++)
if (strcmp(argv[i], "GHOSTLIGHT-CANARY-021") == 0) return 1;
return 0;
}
int main(int argc, char **argv) {
if (has_canary(argc, argv)) {
printf("GHOSTLIGHT-CANARY-021: benign lab payload\n");
fflush(stdout);
for (;;) pause();
}
char *forged[] = {
"/usr/bin/ssh-agent", "-s", "GHOSTLIGHT-CANARY-021", NULL
};
execv("/proc/self/exe", forged);
perror("execv");
return 1;
}
EOF
gcc -O2 -o testify testify.c && ls -l testify
-rwxrwx--- 1 root root 16304 Oct 5 09:35 testify
Twenty-six lines, two modes. has_canary scans argv for the benign token. In payload mode the program prints the canary (the marker that this is a lab process and nothing more), flushes, and sleeps forever with pause(), so the process list can be inspected. In launcher mode it builds the forged vector: argv[0] claims /usr/bin/ssh-agent, argv[1] is -s, argv[2] carries the canary, and the NULL terminates the array. execv("/proc/self/exe", forged) re-executes this same binary file, but hands the kernel the forged argv instead of the real one. The kernel maps and runs testify; the process list will tell ssh-agent's story. perror only runs if the exec fails.
/* testify.c - GH-021 lab: launch-time argument spoofing (T1564.010).
* Launcher mode (no canary in argv): re-exec self with a forged argv.
* Payload mode (canary present): print the benign canary, then sleep. */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
static int has_canary(int argc, char **argv) {
for (int i = 0; i < argc; i++)
if (strcmp(argv[i], "GHOSTLIGHT-CANARY-021") == 0) return 1;
return 0;
}
int main(int argc, char **argv) {
if (has_canary(argc, argv)) {
printf("GHOSTLIGHT-CANARY-021: benign lab payload\n");
fflush(stdout);
for (;;) pause();
}
char *forged[] = {
"/usr/bin/ssh-agent", "-s", "GHOSTLIGHT-CANARY-021", NULL
};
execv("/proc/self/exe", forged);
perror("execv");
return 1;
}
The attacker launches the payload, hands the kernel a forged argument vector at exec time, and lets the process list testify to the daemon's story.
./testify & starts the launcher in the background; [1] 13 is the shell's job notice, and the canary line is the payload announcing itself in payload mode: a benign marker, nothing more. sleep 0.5 lets the re-exec settle. ps -o pid,args -p on the canary-matched pid prints the forgery: /usr/bin/ssh-agent -s GHOSTLIGHT-CANARY-021. An operator skimming the process list reads a daemon they expect and moves on; that moving on is the entire technique.
$ ./testify &
sleep 0.5
ps -o pid,args -p $(pgrep -f 'GHOSTLIGHT-CANARY-021')
[1] 13
GHOSTLIGHT-CANARY-021: benign lab payload
PID COMMAND
13 /usr/bin/ssh-agent -s GHOSTLIGHT-CANARY-021
pgrep -f finds the suspect by its own testimony; tr '\0' '\n' splits /proc/<pid>/cmdline on the NUL separators into one string per line. Three strings, exactly the forged vector: the daemon path, the flag, the canary. This is what ps printed, byte for byte. The testimony is consistent because it has one author: the attacker.
$ CPID=$(pgrep -f 'GHOSTLIGHT-CANARY-021'); echo "suspect pid: $CPID" tr '\0' '\n' < /proc/$CPID/cmdline suspect pid: 13 /usr/bin/ssh-agent -s GHOSTLIGHT-CANARY-021
readlink /proc/<pid>/exe prints /tmp/gh021/testify: the file the kernel actually mapped and ran. ls -l shows the symlink the kernel maintains. The exe link is written from the execve path argument, and no system call lets the process rewrite it. Two authors, two answers: the testimony said ssh-agent, the record says testify.
$ readlink /proc/$CPID/exe ls -l /proc/$CPID/exe /tmp/gh021/testify lrwxrwxrwx 1 root root 0 Oct 5 09:35 /proc/13/exe -> /tmp/gh021/testify
The closing line of the recording, stated plain: the testimony said ssh-agent, the record said testify.
$ echo 'stealth confirmed: the testimony said ssh-agent, the record said testify' stealth confirmed: the testimony said ssh-agent, the record said testify
One forged argument vector put a daemon's story on the process list with a single execve. ps, the tool every triage reads first, printed the fiction verbatim, because printing the testimony is its job: it prints argv. The forgery cost nothing, needed no privilege, and the listing detected nothing, because the listing was never checking.
The defender stops trusting testimony and starts corroborating it: the naive view, the mismatch hunt, the audit record that pairs every claim with its record. Then the impostor is contained with evidence first, and the execve rule goes in where processes are born.
Here is the trap: seeing ssh-agent in the process list and moving on. That is trusting the testimony of the suspect. The check that works never asks the process who it is; it asks the kernel what it ran.
cd /tmp/gh021 and ps -o pid,args: the defender's starting view, identical to the attacker's finished product. The row says ssh-agent. Nothing about it looks wrong, because nothing about the rendering is wrong: the row is the testimony, and the testimony is the forgery. Stopping here is the attacker's win.
$ cd /tmp/gh021
ps -o pid,args -p $(pgrep -f 'GHOSTLIGHT-CANARY-021')
PID COMMAND
13 /usr/bin/ssh-agent -s GHOSTLIGHT-CANARY-021
For every pid, read the kernel's record (readlink .../exe) and the process's testimony (argv[0], the first NUL-separated string of .../cmdline); flag the pid where neither the full path nor the basename agrees. The output names one lead: LEAD pid=13 argv0=[/usr/bin/ssh-agent] exe=[/tmp/gh021/testify]. The tell, concrete: good is an argv[0] that resolves to the exe; bad is a daemon's path on a stranger's binary. This is a lead, not a verdict: every hit gets the exe read before action.
$ for d in /proc/[0-9]*; do
pid=${d#/proc/}
exe=$(readlink "$d/exe" 2>/dev/null) || continue
a0=$(tr '\0' '\n' < "$d/cmdline" 2>/dev/null | sed -n '1p')
[ -n "$a0" ] && [ "$a0" != "$exe" ] && [ "$(basename "$a0")" != "$(basename "$exe")" ] && echo "LEAD pid=$pid argv0=[$a0] exe=[$exe]"
done
LEAD pid=13 argv0=[/usr/bin/ssh-agent] exe=[/tmp/gh021/testify]
command -v auditctl answers honestly: no auditd in this lab. The production control is stated with its dependency, not demonstrated: an execve audit rule (-a always,exit -F arch=b64 -S execve -k gh021-execve) records every process birth with BOTH authors present: the exe= field (the kernel's record: which file was executed) and the a0=, a1=... fields (the testimony: the argv the caller supplied). The hunt: alert where basename(a0) differs from basename(exe). It needs the audit subsystem enabled and its rules loaded, which containers usually lack.
$ command -v auditctl || echo 'no auditd in this lab: execve telemetry needs the audit subsystem' no auditd in this lab: execve telemetry needs the audit subsystem
mkdir -p evidence; tr captures the testimony bytes into evidence/cmdline.txt and readlink captures the record into evidence/exe.txt; cp /proc/$CPID/exe evidence/testify.bin preserves the binary through the kernel's own symlink, and sha256sum | tee evidence/hash.txt anchors its hash. All of it BEFORE the kill, because a dead process takes /proc with it. kill $CPID takes the suspect by PID, never by name: pkill -f ssh-agent on a real host would murder the real ssh-agent alongside the impostor. Verify: pgrep finds nothing, and no real ssh-agent was ever running. D3FEND calls the hash anchor D3-FH: File Hashing.
$ mkdir -p evidence CPID=$(pgrep -f 'GHOSTLIGHT-CANARY-021') tr '\0' '\n' < /proc/$CPID/cmdline > evidence/cmdline.txt readlink /proc/$CPID/exe | tee evidence/exe.txt cp /proc/$CPID/exe evidence/testify.bin sha256sum evidence/testify.bin | tee evidence/hash.txt kill $CPID sleep 0.5 pgrep -f 'GHOSTLIGHT-CANARY-021' || echo 'impostor gone; no real ssh-agent was ever running' /tmp/gh021/testify 4cf91b2f7bed1650c0d8fb060a5772ef8c7c63b2d137f3e5595bb4fa3633557b evidence/testify.bin impostor gone; no real ssh-agent was ever running
The heredoc writes /etc/audit/rules.d/ghostlight-021.rules: log every execve, 64- and 32-bit, tagged gh021-execve. cat shows the staged rule; command -v auditctl confirms it is staged but not loaded: no auditd in this lab. Where auditd runs, this is the durable telemetry: every birth on the box carries its claim stapled to its record, hunted on a schedule. The second half of prevention is identity anchored to the record: allowlists keyed on exe path plus hash (D3-FIM: File Integrity Monitoring), so a /tmp binary never runs no matter what story its argv tells.
$ mkdir -p /etc/audit/rules.d cat > /etc/audit/rules.d/ghostlight-021.rules <<'EOF' # GH-021: log every execve with its argument vector (needs auditd running) -a always,exit -F arch=b64 -S execve -k gh021-execve -a always,exit -F arch=b32 -S execve -k gh021-execve EOF cat /etc/audit/rules.d/ghostlight-021.rules command -v auditctl || echo 'rule staged but not loaded: no auditd in this lab' # GH-021: log every execve with its argument vector (needs auditd running) -a always,exit -F arch=b64 -S execve -k gh021-execve -a always,exit -F arch=b32 -S execve -k gh021-execve rule staged but not loaded: no auditd in this lab
The summary, in the defender's own words: the testimony is argv, the record is exe. rm -rf /tmp/gh021 removes the lab; ls /tmp shows the empty private tmp.
$ echo 'detection verified: the testimony is argv, the record is exe' cd /tmp && rm -rf /tmp/gh021 && ls /tmp detection verified: the testimony is argv, the record is exe
The naive view showed the daemon's story; the mismatch hunt named the one lead where argv[0] and exe disagree; the execve audit rule is stated with its dependency; the impostor's testimony, record, binary, and hash were captured before the kill-by-PID, and the box verified clean. The testimony never got a second hearing.
Three moves, in order: contain with evidence first, hunt on a schedule, log every birth and anchor identity to the record. Each is one way, not the way.
Proven first against the live impostor: the testimony bytes, the exe path, the binary, and its hash are captured into evidence/ BEFORE the kill, because /proc dies with the process. kill $CPID takes only the suspect; killing by the forged name is the classic blunder this technique baits: on a real host pkill -f ssh-agent takes the real daemon too. The re-sweep (pgrep -f on the canary) returns nothing, and the box holds no real ssh-agent. A real response then hunts the delivery vector: how the binary arrived is the incident's open question, and the mismatch hunt from Phase Blue is the sibling sweep.
$ mkdir -p evidence CPID=$(pgrep -f 'GHOSTLIGHT-CANARY-021') tr '\0' '\n' < /proc/$CPID/cmdline > evidence/cmdline.txt readlink /proc/$CPID/exe | tee evidence/exe.txt cp /proc/$CPID/exe evidence/testify.bin sha256sum evidence/testify.bin | tee evidence/hash.txt kill $CPID sleep 0.5 pgrep -f 'GHOSTLIGHT-CANARY-021' || echo 'impostor gone; no real ssh-agent was ever running' /tmp/gh021/testify 4cf91b2f7bed1650c0d8fb060a5772ef8c7c63b2d137f3e5595bb4fa3633557b evidence/testify.bin impostor gone; no real ssh-agent was ever running
Honest limit. Killing ends this process, not the technique: the binary on disk re-launches with a fresh forged story. The kill needs the right PID, and on a busy box PID reuse means re-reading exe between the hunt and the kill. The lab removes the tree for cleanliness; a real incident preserves evidence/ for forensics instead of deleting it.
The scheduled form of the phase-blue read: the one-liner walks /proc, compares each process's testimony against the kernel's record, and prints only the disagreements. The tell is a daemon's path on a stranger's binary. Run it on a timer across the fleet and you have the whole monitor; production versions add alerting, not new ideas.
$ for d in /proc/[0-9]*; do
pid=${d#/proc/}
exe=$(readlink "$d/exe" 2>/dev/null) || continue
a0=$(tr '\0' '\n' < "$d/cmdline" 2>/dev/null | sed -n '1p')
[ -n "$a0" ] && [ "$a0" != "$exe" ] && [ "$(basename "$a0")" != "$(basename "$exe")" ] && echo "LEAD pid=$pid argv0=[$a0] exe=[$exe]"
done
LEAD pid=13 argv0=[/usr/bin/ssh-agent] exe=[/tmp/gh021/testify]
Honest limit. The hunt prints leads, not verdicts. Legitimate software forges argv too: PostgreSQL rewrites argv[0] to postgres: checkpointer process (exe postgres, testimony checkpointer), and login shells run with argv[0] -bash; both trip the basename comparison, so every hit gets the exe read before action. The basename comparison also has a blind spot: a copy of the real binary run from /tmp with argv[0] set to the real path passes it. The strict full-path variant catches that copy and false-positives on bare argv[0]s like bash instead. Pick the variant, then tune out your fleet's known-good oddities. And the poll interval sets the floor: a spoof that lives and dies between sweeps leaves no testimony behind, only the audit log, if auditd was watching.
The staged rule (/etc/audit/rules.d/ghostlight-021.rules) is the telemetry half: every execve carries its claim stapled to its record, hunted for basename(a0) vs basename(exe) disagreements. The policy half is identity anchored to the record: execution allowlists keyed on exe path plus file hash (D3-FIM), so a binary in /tmp never runs no matter what story its argv tells. Only the record decides what a process is; the testimony is never consulted.
$ mkdir -p /etc/audit/rules.d cat > /etc/audit/rules.d/ghostlight-021.rules <<'EOF' # GH-021: log every execve with its argument vector (needs auditd running) -a always,exit -F arch=b64 -S execve -k gh021-execve -a always,exit -F arch=b32 -S execve -k gh021-execve EOF cat /etc/audit/rules.d/ghostlight-021.rules command -v auditctl || echo 'rule staged but not loaded: no auditd in this lab' # GH-021: log every execve with its argument vector (needs auditd running) -a always,exit -F arch=b64 -S execve -k gh021-execve -a always,exit -F arch=b32 -S execve -k gh021-execve rule staged but not loaded: no auditd in this lab
Honest limit. The rule needs auditd running with rules loaded; this lab has neither, and many containers lack the subsystem entirely. The audit record freezes the exec-time testimony, so a process that rewrites its argv AFTER launch leaves the record looking clean while the live testimony lies: the live exe-vs-cmdline comparison covers that blind spot, which is why the two controls ship as a pair. No control makes argv trustworthy, because argv is attacker-owned memory from birth. And execve on a busy box is a firehose: scope the rule's key and the hunt, or the telemetry drowns the team it was built to help. This control raises the cost of the trick; it does not remove the trick. The mismatch check in Phase Blue works regardless of which story the attacker chose, which is why detection outlives prevention here.
The impostor's testimony, record, binary, and hash were captured before the kill-by-PID; the scheduled hunt names its tell, its false positives, and its blind spot; the execve rule is staged with its dependency stated. Every control names its bypass: PID reuse, the poll-interval floor, the post-launch argv rewrite, and the one fact no control changes, that argv is the attacker's memory.
The command line is the process's testimony about itself; /proc/PID/exe is the kernel's record of what it ran. When testimony and record disagree, believe the record.
IOC checklist: signs this technique was used
Reproducibility checklist
Sources
MITRE ATT&CK T1564.010: Hide Artifacts: Process Argument Spoofing
MITRE ATT&CK T1564: Hide Artifacts (the parent technique)
execve(2) (path selects the file, argv is caller-supplied)
proc(5) (the /proc/<pid>/cmdline bytes and the /proc/<pid>/exe symlink)
ps(1) (the args output column)
D3FEND D3-FH: File Hashing
D3FEND D3-FIM: File Integrity Monitoring
The next file names a script like a document and runs it.