step-examples/12-11-adversarial/Ad112.stp
Sources
- bug-reporter language: "stpz inside stpz crashes loader", "recursive gzip stack overflow on STEP"
- CWE-674 (uncontrolled recursion)
- ISO 10303-21 §12 (compressed-archive transfer)
Sender
deduced — adversarial input that wraps a Part-21 body in N stacked gzip layers
Description
A receiver that auto-detects gzip framing (magic `1F 8B`) and decompresses transparently before tokenising will, on input that is gzip-of-gzip-of-..-of-Part-21, recurse into each layer. With N stacked layers of trivially-compressible content, the receiver allocates a buffer per layer; if recursion is implemented by recursive function calls the call-stack overflows. The aggregate decompression ratio is the product of per-layer ratios; 8 layers at 1:100 each yields 1:10^16. Distinct from Ad110 (single-layer ratio bomb): this entry attacks the layering depth, not the per-layer ratio. Bug-reporter language: "nested gzip in STEP", "recursive .stpz unwrap", "stack overflow on stpz-of-stpz".
Reproducer recipe
a Part-21 body wrapped in 8 successive gzip layers (each layer's input is the previous layer's gzip output); compressed final size is a few KB, decompressed final size is 100 MB+, and unwrapping requires 8 sequential gunzip passes.
Expected kernel behavior
cap the gzip-layer recursion depth at 1 (or a small bounded N) with a precise diagnostic when exceeded; refuse files whose decompressed body still has the gzip magic at offset 0; treat the wrapper layer as adversarial.
Notes
Companion to Ad110 (single-layer ratio bomb); orthogonal axis (depth, not ratio). **See also**: Ad027, Ad105, Ad110, Ad111, Pf030. Provenance tier: cross-file-state; bytes alone (a Part-21 body) cannot demonstrate this defect; the bomb is in the stack of gzip wrappers. **OCC behavior**: OCC accepts and loads a valid shape(1); the declared nested-gzip recursion bomb lives in the stacked `.stpz` wrapper layers, not in this innermost Part-21 body. Base and clean give identical shape-counts and validity; shape(1) does not witness a kernel bug.
Expected validation
occt=shape(1)/shape(1) gmsh=shape(1) ifc=schema_n/a
Provenance tier
cross-file-state — defect not fully embodied in fixture bytes.
Byte assertions
contains(b'gzip') or contains(b'nested') or contains(b'recursive')contains(b'.stpz') or contains(b'recursion') or contains(b'depth')
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/* Ad112: nested gzip-of-gzip-.stpz triggers N-level recursive decompression; Part-21 body wrapped in 8 successive gzip layers; each layer ~1:100 ratio; aggregate ratio 1:10^16; unwrapping requires 8 sequential gunzip passes; recursive auto-detect implementation overflows call stack at layer depth N; distinct from Ad110 (single-layer ratio bomb) â attacks depth not ratio; receiver must cap gzip-layer recursion depth at 1 or small bounded N; must refuse files whose decompressed body has gzip magic at offset 0; must reject with a precise diagnostic when depth cap exceeded; CWE-674; ISO 10303-21 §12 compressed-archive transfer; GEOMETRIC_CURVE_SET IS model entity â OCC yields empty */ 3HEADER; 4FILE_DESCRIPTION(('Ad112'),'2;1'); 5FILE_NAME('Ad112.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','',''); 6FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }')); 7ENDSEC; 8DATA; 9#9000=APPLICATION_CONTEXT('mechanical design'); 10#1=CARTESIAN_POINT('',(0.0,0.0,0.0)); 11#2=GEOMETRIC_CURVE_SET('',(#1)); 12#9050=PRODUCT_CONTEXT('',#9000,'mechanical'); 13#9051=PRODUCT('Ad112','Ad112','',(#9050)); 14#9052=PRODUCT_DEFINITION_FORMATION('','',#9051); 15#9053=PRODUCT_DEFINITION_CONTEXT('part definition',#9000,'design'); 16#9054=PRODUCT_DEFINITION('','','',#9052,#9053); 17#9055=PRODUCT_DEFINITION_SHAPE('','','',#9054); 18#9056=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.)); 19#9057=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.)); 20#9058=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT()); 21#9059=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.0E-7),#9056,'distance_accuracy_value',''); 22#9060=(GEOMETRIC_REPRESENTATION_CONTEXT(3)GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#9059))GLOBAL_UNIT_ASSIGNED_CONTEXT((#9056,#9057,#9058))REPRESENTATION_CONTEXT('','3D')); 23#9061=MANIFOLD_SURFACE_SHAPE_REPRESENTATION('',(#2),#9060); 24#9062=SHAPE_DEFINITION_REPRESENTATION(#9055,#9061); 25#9063=/* Nested gzip recursion bomb (.stpz stack; cross-file-state): 26 Wrapper structure (outermost first): 27 Layer 8: gzip(Layer 7) magic: 1F 8B ratio ~1:100 28 Layer 7: gzip(Layer 6) magic: 1F 8B ratio ~1:100 29 Layer 6: gzip(Layer 5) magic: 1F 8B ratio ~1:100 30 Layer 5: gzip(Layer 4) magic: 1F 8B ratio ~1:100 31 Layer 4: gzip(Layer 3) magic: 1F 8B ratio ~1:100 32 Layer 3: gzip(Layer 2) magic: 1F 8B ratio ~1:100 33 Layer 2: gzip(Layer 1) magic: 1F 8B ratio ~1:100 34 Layer 1: gzip(Part-21) magic: 1F 8B ratio ~1:100 35 Layer 0: this Part-21 body (innermost) 36 Aggregate ratio: 1:10^16 across 8 nested .stpz layers. 37 A receiver that auto-detects gzip magic (1F 8B) and recurses 38 into each layer: (a) overflows call stack at depth N if recursion 39 is via function calls; (b) allocates one buffer per layer. 40 Receiver must: cap gzip recursion depth at 1; refuse .stpz files 41 whose decompressed body still starts with gzip magic 1F 8B; 42 reject with precise diagnostic when depth cap exceeded. */ 43CARTESIAN_POINT('nested_gzip_recursion_depth_note',(0.0,0.0,0.0)); 44ENDSEC; 45END-ISO-10303-21;