step-examples/12-11-adversarial/Ad114.stp
Sources
- bug-reporter language: "STEP loader followed symlink to /etc/passwd", "fixture path resolves outside research root"
- CWE-59 (symlink following)
- CWE-22 (path traversal)
Sender
deduced — adversarial filesystem context where a `.stp` fixture path is a symlink to a file the receiver should not read
Description
A receiver that opens a fixture by name without checking whether the path traverses a symlink will follow symlinks transparently. If an attacker can place a symlink at the fixture path (or anywhere along its resolution chain) pointing at a privileged file (`/etc/passwd`, `~/.ssh/id_rsa`, `/proc/self/environ`), the receiver reads the privileged file's bytes and feeds them to the Part-21 tokeniser. Most privileged files do not parse as Part-21 and the load fails benignly, but the bytes have already been read into the receiver's address space and may appear in error messages, crash dumps, or telemetry. Bug-reporter language: "STEP fixture leaks /etc/passwd", "symlink in research tree", "kernel reads non-STEP file as STEP".
Reproducer recipe
a `.stp` path in the research tree is a symlink to `/etc/passwd`. The receiver opens the path and reads ~3 KB of `root:x:0:0:..` bytes into its tokeniser. The fixture in this catalog documents the scenario in a header comment but does NOT actually create a symlink in the repo.
Expected kernel behavior
refuse to open paths whose resolved location is outside a configured root; refuse to follow symlinks within the research tree unless explicitly enabled; check `O_NOFOLLOW`-style flags on open; refuse to dump bytes from a non-Part-21 file in error messages or telemetry.
Notes
Companion to Ad106 (TOCTOU on EXTERNAL_FILE) and Ad113 (sibling-pair race) — a different angle on the same filesystem-trust defect class. Provenance tier: cross-file-state — bytes alone cannot demonstrate this defect; the symptom requires a symlink in the receiver-side filesystem. The static fixture is document-only: no real symlink is created in the repo (cross-platform-unfriendly). **See also**: Ad106, Ad113, Ad115. **OCC behavior**: silently accepts (no diagnostic, empty result); outside catalog's allowed set ({reject}). Kernel-bug witnessed: receivers must reject this fixture per the catalog's stated invariant.
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Provenance tier
cross-file-state — defect not fully embodied in fixture bytes.
Byte assertions
contains(b'symlink') or contains(b'passwd') or contains(b'/etc/')contains(b'O_NOFOLLOW') or contains(b'symlink') or contains(b'/etc/passwd')
Tier-3 assertions
load == "ok"
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes
1ISO-10303-21; 2/* Symlink-following attack payload (CWE-59 / CWE-22): 3 Attack scenario: fixture path Ad114.stp is a symlink 4 pointing to /etc/passwd (or ~/.ssh/id_rsa, /proc/self/environ). 5 6 ln -s /etc/passwd /path/to/research/step-examples/12-11-adversarial/Ad114.stp 7 8 A receiver that opens the fixture path without O_NOFOLLOW 9 will read ~3 KB of 'root:x:0:0:..' bytes into its Part-21 tokeniser. 10 The load fails (non-Part-21 content) but the privileged bytes have 11 already been read into the process address space and may appear in: 12 - error messages logged to disk or transmitted over the network 13 - crash dumps captured by the OS or monitoring systems 14 - telemetry payloads sent to the vendor 15 16 Required mitigations: 17 1. Open with O_NOFOLLOW (POSIX) or CreateFile with 18 FILE_FLAG_OPEN_REPARSE_POINT (Windows) to refuse symlink targets. 19 2. Resolve the real path and verify it is within the configured root 20 before reading any bytes (Path.resolve() + is_relative_to()). 21 3. Never include raw file bytes from a failed parse in error messages. 22 23 Static fixture is document-only: no real symlink is created in the repo 24 (cross-platform-unfriendly). See also: Ad106 (TOCTOU on EXTERNAL_FILE), 25 Ad113 (sibling-pair race), Ad115 (directory-entry race). 26 Target path: /etc/passwd, /proc/self/environ, ~/.ssh/id_rsa 27*/ 28/* Ad114: STEP fixture path is a symlink to /etc/passwd or other privileged file; receiver that opens path without O_NOFOLLOW reads privileged bytes into Part-21 tokeniser; bytes may appear in error messages or telemetry; receiver must refuse to open paths whose resolved location is outside a configured root; refuse to follow symlinks unless explicitly enabled; check O_NOFOLLOW-style flags on open; CWE-59 (symlink following); CWE-22 (path traversal); provenance tier: cross-file-state â static fixture is document-only: no real symlink created in repo; GEOMETRIC_CURVE_SET IS model entity â OCC yields empty */ 29HEADER; 30FILE_DESCRIPTION(('Ad114'),'2;1'); 31FILE_NAME('Ad114.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','',''); 32FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 33ENDSEC; 34DATA; 35#1=CARTESIAN_POINT('',(0.0,0.0,0.0)); 36#2=GEOMETRIC_CURVE_SET('',(#1)); 37ENDSEC; 38END-ISO-10303-21;