From 9a4cc56b781b3863afc5bc63b52b11243f65a8ea Mon Sep 17 00:00:00 2001 From: h4x0r Date: Sat, 8 Aug 2026 09:06:35 -0700 Subject: [PATCH 1/2] docs: record that ImageFileName is truncated by Windows, not by us MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ps` reports `coreupdater.ex` for a process whose executable is `coreupdater.exe`, and that reads like a byte-loss bug. It is not — I filed it as one and had to retract it, so the finding is written down where the next reader will meet it rather than re-derive it. `_EPROCESS.ImageFileName` is `UCHAR[15]` and the kernel NUL-terminates it, reserving the final byte, so the field carries at most 14 CHARACTERS. Windows truncates a longer executable name when populating it, before any tool reads it. Confirmed in the artifact rather than reasoned from the struct definition. In the Case-001 dump, for PID 3644: 0x02082cb38 coreupdater.ex\0 inside the _EPROCESS (PID as u64 within +/-0x400) 0x0195086ea coreupdater.exe\0 a different structure, not near that PID So "read 15, stop at the first NUL" is correct and the short name is the evidence. Documented in three places, because each catches a different reader: * docs/interpreting-process-names.md — for the examiner reading the output: what the short name means, that it is not a reliable identifier for names of 15+ characters, where the full path actually lives, and why corroboration from a filesystem or registry artifact is needed before naming a file. * process.rs at the read site, and psscan.rs on decode_image_name — for whoever next reads `15` and wonders whether it should be 16. * The page is registered in mkdocs nav; an unlisted page is an undiscoverable one. The decode is deliberately unchanged. Rewriting the field to the expected filename would fabricate evidence: the tool would report a value that is not in the dump. Fuller names belong as separate, attributed enrichment from SeAuditProcessCreationInfo.ImageFileName or RTL_USER_PROCESS_PARAMETERS. Refs #13. Co-Authored-By: Claude Opus 5 --- crates/memf-windows/src/process.rs | 7 ++++ crates/memf-windows/src/psscan.rs | 7 ++++ docs/interpreting-process-names.md | 58 ++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 4 files changed, 73 insertions(+) create mode 100644 docs/interpreting-process-names.md diff --git a/crates/memf-windows/src/process.rs b/crates/memf-windows/src/process.rs index 437c0cd9..7cf0bdef 100644 --- a/crates/memf-windows/src/process.rs +++ b/crates/memf-windows/src/process.rs @@ -51,6 +51,13 @@ fn read_process_info( ) -> Result { let pid: u64 = reader.read_field(eproc_addr, "_EPROCESS", "UniqueProcessId")?; let ppid: u64 = reader.read_field(eproc_addr, "_EPROCESS", "InheritedFromUniqueProcessId")?; + // `ImageFileName` is `UCHAR[15]` and the kernel NUL-terminates it, so it + // carries at most 14 CHARACTERS: `coreupdater.exe` is stored as + // `coreupdater.ex\0`. Verified in the raw bytes of the Case-001 dump, not + // inferred. Reading 15 and stopping at the NUL is therefore correct and the + // short name is the EVIDENCE -- do not "repair" it to an expected filename. + // The untruncated path lives in SeAuditProcessCreationInfo.ImageFileName or + // RTL_USER_PROCESS_PARAMETERS.ImagePathName; surface those as enrichment. let image_name = reader.read_field_string(eproc_addr, "_EPROCESS", "ImageFileName", 15)?; let create_time: u64 = reader.read_field(eproc_addr, "_EPROCESS", "CreateTime")?; let exit_time: u64 = reader.read_field(eproc_addr, "_EPROCESS", "ExitTime")?; diff --git a/crates/memf-windows/src/psscan.rs b/crates/memf-windows/src/psscan.rs index d7912774..533f678d 100644 --- a/crates/memf-windows/src/psscan.rs +++ b/crates/memf-windows/src/psscan.rs @@ -75,6 +75,13 @@ fn plausible_pid(pid: u64) -> bool { /// Decode a 15-byte `ImageFileName` to a validated process name, or `None`. /// Requires printable ASCII, at least one letter, and NUL-or-end termination. +/// +/// The field holds at most 14 CHARACTERS: it is `UCHAR[15]` and the kernel +/// reserves the final byte for the NUL, so a longer executable name is +/// truncated by Windows before any tool reads it (`coreupdater.exe` is stored +/// as `coreupdater.ex\0`). A short name here is the evidence, not a decode +/// defect. The `..=15` bound still admits an unterminated 15-byte field, which +/// some kernels do write. fn decode_image_name(raw: &[u8]) -> Option { let end = raw.iter().position(|&b| b == 0).unwrap_or(raw.len()); // A real `ImageFileName` is an executable base name — never a single diff --git a/docs/interpreting-process-names.md b/docs/interpreting-process-names.md new file mode 100644 index 00000000..19f84539 --- /dev/null +++ b/docs/interpreting-process-names.md @@ -0,0 +1,58 @@ +# Interpreting process names + +## A 14-character process name is not a truncation bug + +`ps` may report `coreupdater.ex` for a process whose executable on disk is +`coreupdater.exe`. That is the evidence, reported verbatim. Nothing was lost by +the reader. + +Windows stores the process name in + +```c +UCHAR ImageFileName[15]; // _EPROCESS +``` + +and the kernel NUL-terminates it, **reserving the final byte for the +terminator**. The field therefore carries at most **14 characters**, and any +longer executable name is truncated by Windows when the field is populated — +before any forensic tool sees it. + +### Confirmed in the artifact, not inferred + +From the DFIR Madness Case-001 memory image (`citadeldc01.mem`), PID 3644: + +| offset | bytes | inside the `_EPROCESS` for PID 3644? | +|---|---|---| +| `0x02082cb38` | `coreupdater.ex\0` | **yes** — PID present as a `u64` within ±0x400 | +| `0x0195086ea` | `coreupdater.exe\0` | no — a different structure | + +The `_EPROCESS` copy is 14 characters plus a NUL, filling all 15 bytes. The full +name does exist in the dump, but in a structure unrelated to that process object. + +### What this means for an examiner + +- **The short name is a faithful observation.** Cite it as what + `_EPROCESS.ImageFileName` contained, not as the filename on disk. +- **It is not a reliable identifier for names of 15+ characters.** Two different + executables whose first 14 characters match are indistinguishable in this + field. +- **The full path is elsewhere.** `SeAuditProcessCreationInfo.ImageFileName` + holds the NT path; `RTL_USER_PROCESS_PARAMETERS.ImagePathName` and + `CommandLine` hold the launch path and arguments (both reachable through the + PEB, so they need the process address space). +- **Corroborate before naming a file.** A filesystem or registry artifact from + the same host will give the untruncated name; the memory field alone will not. + +### Why we do not "fix" it + +Rewriting `coreupdater.ex` to `coreupdater.exe` because the longer name is +expected would fabricate evidence — the tool would be reporting a value that is +not in the dump. The field is reported as found; fuller names are surfaced as +separate, attributed enrichment. + +### Same shape elsewhere + +Linux `task_struct.comm` is `char[16]` with the same reserve-a-byte behaviour +(15 usable characters), so long process names truncate there too. Treat any +fixed-size kernel name field as a candidate: check the raw bytes before +concluding a parser is at fault. diff --git a/mkdocs.yml b/mkdocs.yml index 3daf53c7..d25b87af 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -42,6 +42,7 @@ markdown_extensions: nav: - Home: index.md - Validation: validation.md + - Interpreting process names: interpreting-process-names.md - Privacy Policy: privacy.md - Terms of Service: terms.md From e06c1d814d762b1eaacfe6cf92d40d752cf67ada Mon Sep 17 00:00:00 2001 From: h4x0r Date: Sat, 8 Aug 2026 09:16:48 -0700 Subject: [PATCH 2/2] docs: the truncated name is a PREFIX, not an identity Follow-up to the previous commit. Truncation is lossy, so the consequence is sharper than "the name may be short": distinct executables collide in this field. MicrosoftEdgeUpdate.exe (23) -> MicrosoftEdgeU MicrosoftEdgeUpdateCore.exe (27) -> MicrosoftEdgeU coreupdaterupdater.exe (22) -> coreupdaterupd coreupdaterupdater2.exe (23) -> coreupdaterupd The first pair is not contrived -- two real, separately signed Microsoft binaries that _EPROCESS.ImageFileName cannot tell apart. Two things follow, and both are worse than a cosmetic truncation: * The stored value often does not look like a filename at all. `MicrosoftEdgeU` has lost its extension, so an examiner who does not know the 14-byte limit gets no cue that anything was cut. `coreupdater.ex` at least hints at it via the mangled `.ex`. * It is a masquerading vector. Naming a binary so its first 14 characters match a legitimate process yields an identical ImageFileName, and a process list alone cannot separate them. No trickery is needed beyond a long enough name. Documented as a collision table in docs/interpreting-process-names.md with the practical rule -- a stored name of exactly 14 characters is the tell that truncation may have occurred; treat it as a prefix and resolve against the full path or a filesystem artifact before attributing behaviour to a named program. The same point is noted on psscan's decode_image_name, where a caller is most likely to treat the returned name as identifying a specific executable. fmt clean, clippy -D warnings clean. Refs #13. Co-Authored-By: Claude Opus 5 --- crates/memf-windows/src/psscan.rs | 7 +++++- docs/interpreting-process-names.md | 37 +++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/crates/memf-windows/src/psscan.rs b/crates/memf-windows/src/psscan.rs index 533f678d..0a570ab4 100644 --- a/crates/memf-windows/src/psscan.rs +++ b/crates/memf-windows/src/psscan.rs @@ -80,7 +80,12 @@ fn plausible_pid(pid: u64) -> bool { /// reserves the final byte for the NUL, so a longer executable name is /// truncated by Windows before any tool reads it (`coreupdater.exe` is stored /// as `coreupdater.ex\0`). A short name here is the evidence, not a decode -/// defect. The `..=15` bound still admits an unterminated 15-byte field, which +/// defect. +/// +/// Because truncation is lossy, this value is a PREFIX and not an identity: +/// `MicrosoftEdgeUpdate.exe` and `MicrosoftEdgeUpdateCore.exe` — two real, +/// separately signed binaries — both store as `MicrosoftEdgeU`. Callers must +/// not treat a match here as identifying a specific executable. The `..=15` bound still admits an unterminated 15-byte field, which /// some kernels do write. fn decode_image_name(raw: &[u8]) -> Option { let end = raw.iter().position(|&b| b == 0).unwrap_or(raw.len()); diff --git a/docs/interpreting-process-names.md b/docs/interpreting-process-names.md index 19f84539..a393a07d 100644 --- a/docs/interpreting-process-names.md +++ b/docs/interpreting-process-names.md @@ -33,9 +33,8 @@ name does exist in the dump, but in a structure unrelated to that process object - **The short name is a faithful observation.** Cite it as what `_EPROCESS.ImageFileName` contained, not as the filename on disk. -- **It is not a reliable identifier for names of 15+ characters.** Two different - executables whose first 14 characters match are indistinguishable in this - field. +- **It is not a unique identifier.** Any two executables sharing their first 14 + characters are indistinguishable here — see the collision table below. - **The full path is elsewhere.** `SeAuditProcessCreationInfo.ImageFileName` holds the NT path; `RTL_USER_PROCESS_PARAMETERS.ImagePathName` and `CommandLine` hold the launch path and arguments (both reachable through the @@ -43,6 +42,38 @@ name does exist in the dump, but in a structure unrelated to that process object - **Corroborate before naming a file.** A filesystem or registry artifact from the same host will give the untruncated name; the memory field alone will not. +## Different executables collide in this field + +Truncation is lossy, so distinct filenames can share one stored value: + +| executable | length | stored in `ImageFileName` | +|---|---|---| +| `MicrosoftEdgeUpdate.exe` | 23 | `MicrosoftEdgeU` | +| `MicrosoftEdgeUpdateCore.exe` | 27 | `MicrosoftEdgeU` | +| `coreupdaterupdater.exe` | 22 | `coreupdaterupd` | +| `coreupdaterupdater2.exe` | 23 | `coreupdaterupd` | + +The first pair is not contrived: those are two real, separately signed Microsoft +binaries that this field cannot tell apart. + +Two consequences follow. + +**The stored value often is not recognisable as a filename.** `MicrosoftEdgeU` +has lost its extension entirely. An examiner who does not know the 14-byte limit +gets no cue that anything was cut — unlike `coreupdater.ex`, where the mangled +`.ex` hints at it. + +**It is a masquerading vector.** An attacker who names a binary so that its first +14 characters match a legitimate process produces an identical `ImageFileName`. +A process list alone cannot separate them, and the collision needs no trickery +beyond choosing a long enough name. + +So for any process whose stored name is exactly 14 characters — the tell that +truncation may have occurred — treat the name as a **prefix**, not an identity, +and resolve it against the full path (`SeAuditProcessCreationInfo.ImageFileName`, +`RTL_USER_PROCESS_PARAMETERS.ImagePathName`) or against a filesystem artifact +before attributing behaviour to a named program. + ### Why we do not "fix" it Rewriting `coreupdater.ex` to `coreupdater.exe` because the longer name is