File Systems and MACB Timestamps
"When did the malware arrive on this laptop?" is one of the first questions of every investigation, and the file system holds the first answer: every file carries several timestamps. Read correctly, they say when a file was created on this volume, when its content last changed, when its metadata changed and perhaps when it was last read. Read naively, they mislead: a copied file can be "modified" before it was "created", a tool can set timestamps to whatever it likes, and some timestamps are simply not updated by default. This lesson covers the timestamps of NTFS and the Unix file systems, decodes NTFS timestamps from bytes, and detects a classic anti-forensic trick, timestomping.
Definitions
- MACB: the four timestamps forensic tools display: Modified (content), Accessed (read), Changed (on Unix: metadata/inode change; on NTFS: the MFT entry changed), Born (created on this volume).
- NTFS keeps timestamps in the file's MFT record twice:
$STANDARD_INFORMATION($SI): the times Explorer and most APIs show; programs can set them withSetFileTime.$FILE_NAME($FN): set by the kernel when the file is created, renamed or moved; ordinary user-mode APIs can't set them directly.- Each holds four 64-bit FILETIME values: 100-nanosecond intervals since 1601-01-01 00:00 UTC.
- ext4: inode timestamps
atime,mtime,ctimeandcrtime(birth), with nanosecond precision;statshows birth time where the kernel and tool supportstatx. On Linux,ctimecan't be set directly by user tools (touchsets only atime and mtime); it changes whenever metadata changes. - Access time behaviour: Linux mounts with
relatimeby default (atime updated only if older than mtime or more than a day old); Windows has long disabled or limited last-access updates on NTFS by default for performance. "Accessed" is therefore weak evidence. - Timestomping: changing a file's timestamps to make it blend in (for example, giving a dropped file the dates of system files). ATT&CK T1070.006.
What common actions do to timestamps
| Action (NTFS, typical) | B (born) | M (modified) | A (accessed) | C (MFT changed) |
|---|---|---|---|---|
| File created | now | now | now | now |
| Content changed | – | now | (now, if enabled) | now |
| Copied to another folder or volume | now (the copy is new) | kept from the source | now | now |
| Moved within the volume | – ($SI kept, $FN updated) |
– | – | now |
| Downloaded by a browser | now | now, or the server's date | now | now |
| Extracted from a ZIP | now | from the archive entry | now | now |
The row that matters most: a copy keeps M from the source but gets a new B, so M < B is normal for copied and extracted files. It is not tampering; it is a clue that the file came from somewhere else.
Decoding NTFS timestamps and spotting timestomping
The example builds the two attributes of a synthetic MFT record for three files (as raw little-endian FILETIME values, the way they sit on disk), decodes them, and applies two classic timestomping checks: $SI creation earlier than $FN creation, and $SI times with no sub-second part (many tools set whole seconds, while the real clock gives 100 ns resolution).
import struct
from datetime import datetime, timedelta, timezone
EPOCH_1601 = datetime(1601, 1, 1, tzinfo=timezone.utc)
def to_filetime(dt):
d = dt - EPOCH_1601 # exact integer arithmetic, no floats
return ((d.days * 86400 + d.seconds) * 1_000_000 + d.microseconds) * 10
def from_filetime(v): return EPOCH_1601 + timedelta(microseconds=v // 10)
def attr(b, m, c, a): # $SI and $FN both start with created, modified, MFT changed, accessed
return struct.pack("<4Q", *(to_filetime(t) for t in (b, m, c, a)))
T = lambda s: datetime.fromisoformat(s).replace(tzinfo=timezone.utc)
files = {
# normal file written by an installer
r"C:\Program Files\LabEditor\editor.exe": (
attr(T("2025-11-02 08:15:31.418273"), T("2025-11-02 08:15:31.418273"), T("2025-11-02 08:15:31.552901"), T("2026-01-15 09:00:02.110034")),
attr(T("2025-11-02 08:15:31.418273"), T("2025-11-02 08:15:31.418273"), T("2025-11-02 08:15:31.418273"), T("2025-11-02 08:15:31.418273"))),
# copied from a USB stick: M older than B, consistent in $SI and $FN
r"C:\Users\lab\Documents\budget.xlsx": (
attr(T("2026-01-14 16:02:10.771100"), T("2025-12-30 11:47:55.203300"), T("2026-01-14 16:02:10.771100"), T("2026-01-14 16:02:10.771100")),
attr(T("2026-01-14 16:02:10.771100"), T("2025-12-30 11:47:55.203300"), T("2026-01-14 16:02:10.771100"), T("2026-01-14 16:02:10.771100"))),
# dropped by the lab sample, then timestomped to look like a 2019 system file
r"C:\Users\Public\Libraries\labagent.dat": (
attr(T("2019-12-07 09:10:00"), T("2019-12-07 09:10:00"), T("2026-01-15 10:04:12.402117"), T("2019-12-07 09:10:00")),
attr(T("2026-01-15 10:04:12.351902"), T("2026-01-15 10:04:12.351902"), T("2026-01-15 10:04:12.351902"), T("2026-01-15 10:04:12.351902"))),
}
for path, (si_raw, fn_raw) in files.items():
si = [from_filetime(v) for v in struct.unpack("<4Q", si_raw)]
fn = [from_filetime(v) for v in struct.unpack("<4Q", fn_raw)]
print(path)
for label, ts in (("$SI", si), ("$FN", fn)):
print(f" {label} B {ts[0]:%Y-%m-%d %H:%M:%S.%f} M {ts[1]:%Y-%m-%d %H:%M:%S} C {ts[2]:%Y-%m-%d %H:%M:%S} A {ts[3]:%Y-%m-%d %H:%M:%S}")
findings = []
if si[0] < fn[0]:
findings.append("$SI born before $FN born: timestomping likely")
if all(t.microsecond == 0 for t in (si[0], si[1], si[3])):
findings.append("$SI B/M/A have zero sub-second parts: set by a tool?")
if si[1] < si[0] and fn[1] < fn[0]:
findings.append("M before B in both: copied or extracted (normal)")
print(" ->", "; ".join(findings) or "consistent")
print("raw FILETIME of 2026-01-15 10:04:12.351902 UTC:", hex(to_filetime(T("2026-01-15 10:04:12.351902"))))C:\Program Files\LabEditor\editor.exe
$SI B 2025-11-02 08:15:31.418273 M 2025-11-02 08:15:31 C 2025-11-02 08:15:31 A 2026-01-15 09:00:02
$FN B 2025-11-02 08:15:31.418273 M 2025-11-02 08:15:31 C 2025-11-02 08:15:31 A 2025-11-02 08:15:31
-> consistent
C:\Users\lab\Documents\budget.xlsx
$SI B 2026-01-14 16:02:10.771100 M 2025-12-30 11:47:55 C 2026-01-14 16:02:10 A 2026-01-14 16:02:10
$FN B 2026-01-14 16:02:10.771100 M 2025-12-30 11:47:55 C 2026-01-14 16:02:10 A 2026-01-14 16:02:10
-> M before B in both: copied or extracted (normal)
C:\Users\Public\Libraries\labagent.dat
$SI B 2019-12-07 09:10:00.000000 M 2019-12-07 09:10:00 C 2026-01-15 10:04:12 A 2019-12-07 09:10:00
$FN B 2026-01-15 10:04:12.351902 M 2026-01-15 10:04:12 C 2026-01-15 10:04:12 A 2026-01-15 10:04:12
-> $SI born before $FN born: timestomping likely; $SI B/M/A have zero sub-second parts: set by a tool?
raw FILETIME of 2026-01-15 10:04:12.351902 UTC: 0x1dc86064c5f682c
The editor's times are consistent. The budget file shows the copy pattern, in both attributes. The dropped file is the interesting one: $SI claims 2019 with whole-second values, but $FN (which the timestomping tool couldn't touch) says it was created on 2026-01-15 at 10:04:12, which is exactly when the sandbox and Sysmon saw the sample write it (Process Monitor and Sysmon). And the $SI "MFT changed" time gives it away a third time: setting the timestamps is itself a metadata change.
How timestamps are collected and checked
- MFT parsers (MFTECmd,
analyzeMFT, The Sleuth Kit'sistat, plaso) output both$SIand$FNtimes; compare them for every file of interest. - Other time sources corroborate: the USN change journal (
$UsnJrnl:$J, which records creations, renames and writes with their own timestamps),$LogFile, prefetch files (program execution), the registry (ShimCache, Amcache, UserAssist), event logs, and EDR telemetry. - Timeline tools merge all of them (timelines).
How defenders keep timestamps useful
- Keep accurate, synchronised clocks (NTP) everywhere: a timeline across hosts is only as good as their clocks.
- Forward logs centrally, where an intruder can't edit them; the file system is on the intruder's side of the fence.
- Keep the USN journal large enough to cover days, not hours (its size is configurable).
Pitfalls
- Trusting
$SIalone. It is what Explorer shows and what attackers change. - Reading A as "opened by a person". Access times are often not updated, and anti-virus scans and indexing update them when they are.
- Time zones and formats. NTFS stores UTC; FAT and exFAT historically store local time (exFAT adds an offset field). Convert carefully.
$FNis not tamper-proof. Moving a file after changing$SIcan make$FNcopy the forged values; corroborate with the journal and logs.
Practice
1. A file in System32 has $SI created 2021-06-05 and $FN created 2026-01-15. What do you conclude, and what do you check next?
The file was created on this volume on 2026-01-15 and its $SI times were set back, a strong timestomping sign. Check the USN journal around 2026-01-15 for its creation, the process that wrote it (EDR, Sysmon event 11), and whether it matches a legitimate update.
2. Compute the FILETIME for 1970-01-01 00:00:00 UTC.
to_filetime(datetime(1970,1,1,tzinfo=timezone.utc)) = 116444736000000000 (0x19db1ded53e8000): the number of 100 ns intervals between 1601 and the Unix epoch, a constant every converter uses.
3. Why are whole-second $SI values suspicious but not proof?
The NTFS clock resolution is 100 ns, so a real creation time almost never falls on an exact second. But some legitimate tools (archive extractors, installers, file copies from FAT) set whole seconds too. It is a lead to corroborate.
Test yourself
What does MACB stand for?
- Memory, Access, Cache, Boot
- Modified, Accessed, Changed, Born
- MFT, ACL, Cluster, Block
- Malware, Analysis, Containment, Backup
Why is $FN often more trustworthy than $SI on NTFS?
- It has better precision
- Ordinary user-mode APIs can't set it directly; the kernel writes it on create, rename and move
- It is encrypted
- It is stored in the registry
A file's modified time is earlier than its creation time. What is the most common innocent explanation?
- Disk corruption
- It was copied or extracted, which keeps M from the source and sets a new B
- The clock ran backwards
- It is malware
What is the epoch of an NTFS FILETIME?
- 1970-01-01 UTC
- 1601-01-01 UTC
- 1980-01-01 local time
- 2000-01-01 UTC