This file was last modified in 2019. It was created nine minutes ago. One command forged the date; one command catches the forgery. This file runs both.
MITRE ATT&CK T1070.006: adversaries rewrite file timestamps so a fresh payload looks years old. This file forges the date with the standard tool, then reads the timestamp the forgery cannot touch.
Why this technique. After a breach, the first question is "what changed recently," and the answer comes from timestamps. A responder sorts /tmp by date, and everything from 2019 scrolls past unexamined. Timestomping forges the answer to that first question: the payload sits in plain sight, wearing the date of an innocent era.
Why the default view loses. ls -l shows one timestamp, the modification time, and nothing else. The other timestamps exist, but you have to ask for them with stat. The forgery targets the default view, because the default view is what gets read at 3 AM.
Why one timestamp survives. A file on Linux carries four timestamps. atime is the last read. mtime is the last content write, and the owner may set it freely with the utimensat syscall (that is what touch -d calls). ctime is the last time the file's metadata changed, and the kernel sets it itself on every metadata write: there is no syscall that sets ctime to an arbitrary value. btime, the birth time, records creation where the filesystem supports it. Forging mtime is one syscall the owner is allowed to make; it updates ctime to right now as a side effect, and the kernel keeps the receipt.
The concrete case, before the abstraction. touch -d '2019-06-11 03:14:00' .systemd-cache backdates a file created today. ls -l reports 2019. stat reports Modify: 2019, Change: today. Same file, two stories; only the second one was written by the kernel.
Terms, earned. mtime is the modification timestamp, the one ls shows, settable by the file's owner. ctime is the change timestamp, set by the kernel whenever the file's metadata changes, not settable to an arbitrary value. btime is the birth timestamp, the file's creation time. Timestomp is T1070.006: rewriting timestamps to mislead forensic timelines.
Scope. T1070, Indicator Removal, has eight sub-techniques, from clearing logs to deleting files. This file works the timestamp one end to end: the forgery every responder's first sort is vulnerable to, and the receipt that survives it.
Ubuntu 24.04.5 LTS, x86-64, in a disposable VM used only for this lab. The attack is one coreutils command and needs no privilege: any user can set the timestamps on their own files. The lab directory is /tmp/gh005.
There is nothing to compile. The payload is eighteen bytes of text with an inconspicuous name, because the filename and the date do all the work.
$ mkdir -p /tmp/gh005 && cd /tmp/gh005 $ echo 'staged payload v3' > .systemd-cache
A dotfile named like a systemd cache entry, in /tmp. Nothing about it demands attention, and after Phase Red, nothing about its date will either.
One command reaches seven years into the past. Then ask the directory listing when the file was modified, and believe the answer the way a tired responder would.
The payload was created minutes ago. After this command, every default listing will say 2019.
$ echo 'staged payload v3' > .systemd-cache $ touch -d '2019-06-11 03:14:00' .systemd-cache $ ls -l --time-style=long-iso .systemd-cache -rw-rw---- 1 root root 18 2019-06-11 03:14 .systemd-cache
June 2019. A responder sorting /tmp by modification date to find "what changed recently" scrolls straight past it; the file predates the incident window, the investigation, and possibly the responder's employment. The forgery is complete, it used a standard tool, and it left the file's contents untouched. Nothing about this file looks new, because new was the one attribute the attacker was allowed to rewrite.
One touch command gave a minutes-old payload a seven-year-old date, and the standard directory listing vouches for it. The forgery is a legitimate syscall doing exactly what it was designed to do, which is why no permission was denied and no alarm fired.
ls showed the timestamp the file's owner chose. Now read all four timestamps, including the one the owner cannot choose.
Here is the trap: sorting by date, seeing 2019, and moving on. The modification time is the file's own story about itself, and the owner is allowed to edit their own story. The kernel keeps a separate receipt, and the receipt cannot be edited with touch.
Same file ls just vouched for. Three timestamps, and they do not agree.
$ stat -c 'access: %x' .systemd-cache access: 2019-06-11 03:14:00.000000000 +0000 $ stat -c 'modify: %y' .systemd-cache modify: 2019-06-11 03:14:00.000000000 +0000 $ stat -c 'change: %z' .systemd-cache change: 2026-09-19 19:22:25.971542372 +0000
Modify says 2019, exactly as forged. Change says today, down to the nanosecond: the moment the touch command rewrote the metadata. The attacker set the clock on the file, and the kernel timestamped the act of setting it. A file whose modification date is years older than its change date is not old; it is edited. The full stat output adds a fourth witness, the birth time, also today. Two timestamps the owner set, two the kernel wrote, and the kernel's are the ones that matter.
One stat command exposed the forgery ls could not see. The check needs no baseline and no tooling: mtime is the claim, ctime is the receipt, and the receipt is written by the kernel.
Four moves, in order: hunt by the receipt, baseline the metadata, stop trusting the claim, freeze the evidence. Each is one way, not the way.
If you are hunting the payload, do not sort by mtime; the attacker chose that sort order. Sort by ctime: the kernel's record of when the metadata was actually touched.
$ find /tmp /var/tmp /dev/shm -newerct '2026-09-01' -type f -printf '%p change=%C+ modify=%T+\n' 2>/dev/null /tmp/gh005/.systemd-cache change=2026-09-16+15:26:23.0247667980 modify=2019-06-11+03:14:00.0000000000
One line, and the "2019" file is the newest thing in /tmp. Printing change and modify side by side turns every timestomped file into a self-confession: the wider the gap, the louder the lie.
A hash-only baseline is blind to timestomping: the bytes never change, so the hash never changes. Record the metadata the attacker cannot forge instead: inode, size, mtime, and ctime. The check below is copy-pasteable.
$ find /tmp /var/tmp /dev/shm -type f -printf '%p|%i|%s|%T@|%C@\n' 2>/dev/null | sort > /root/fim-baseline.txt $ # ...later, after the window you care about... $ find /tmp /var/tmp /dev/shm -type f -printf '%p|%i|%s|%T@|%C@\n' 2>/dev/null | sort > /root/fim-check.txt $ diff /root/fim-baseline.txt /root/fim-check.txt
What a catch looks like (real output: baseline taken, file re-forged, baseline re-taken):
1c1 < .systemd-cache inode=3 size=18 mtime=2018-01-01 00:00:00.000000000 +0000 ctime=2026-09-19 19:22:25.989542372 +0000 --- > .systemd-cache inode=3 size=18 mtime=2019-06-11 03:14:00.000000000 +0000 ctime=2026-09-19 19:22:27.100542415 +0000
Inode and size identical, ctime moved: someone touched the metadata. An mtime-only check sees the same 2019 date before and after and reports nothing.
Good vs bad: a legitimately old file has change and modify dates close together; a timestomped file has them years apart, and a re-forged file has a ctime newer than its baseline entry. Alert on ctime newer than baseline with mtime unchanged or older.
Honest limit. FIM sees only what changed after the baseline was taken; a file timestomped before the first scan looks legitimately old to it. ctime trusts the system clock: an attacker who can set the clock (root, or the VM host) can narrow the gap. And ctime is per-filesystem: copying the file elsewhere mints fresh stamps, so a payload smuggled in as a copy carries no gap to find (verified: cp -p preserved the forged 2019 mtime with fresh birth and change stamps). The receipt is honest, not omniscient.
First principle: distrust the claim, read the receipt. mtime is the file's own story about itself; ctime is the kernel's record of the edit, and the two are written by different authors.
There is no prevention here, and that is the point. Setting timestamps is a legitimate syscall; touch is coreutils, utimensat is how backups and build tools preserve dates. You cannot remove the capability without breaking the system. The control is procedural: never let mtime alone decide what is old. Triage sorts by ctime, FIM baselines include metadata, and timelines are built from the receipt, not the claim.
Hunting finds the file; mitigation preserves what it proves. On a live box:
1. Capture the receipt before it ages: stat the suspect file now. ctime only tells you the last metadata change; every later touch overwrites it.
$ stat /tmp/.systemd-cache > /root/evidence-stat.txt
2. Do not trust any local timeline built from mtime. Rebuild from sources the attacker could not rewrite with touch: the off-host log collector, network flow records, and the FIM baseline diff above.
3. Isolate the host from the network before cleanup. Deleting the file ends the payload but also ends the evidence; image or snapshot first if the incident warrants it.
What this does not do: it does not prevent the next forge. Prevention is the baseline above, run on a schedule. Mitigation buys you the true story of this one.
First principle: evidence has a half-life. ctime is overwritten by the next touch, so the containment step is capture, not analysis.
The capability cannot be removed without breaking the system, so the forgery is seen through, not prevented. Hunting by ctime finds the payload despite its 2019 costume, FIM baselines catch the metadata change, and the procedural fix costs nothing: read the receipt, not the story.
mtime is the file's own story about itself. ctime is the kernel's receipt for the edit. touch cannot rewrite the receipt.
IOC checklist: signs this technique was used
Reproducibility checklist
Sources
MITRE ATT&CK T1070.006: Timestomp
utimensat(2) (the syscall touch uses; note what it cannot set)
stat(1) (reading all four timestamps)
MITRE D3FEND: D3-FIM
The log says nothing happened. A second copy of the log, written as each event happened, disagrees.