step-examples/12-11-adversarial/Ad110.stp
Sources
- bug-reporter language: "stpz file blows up loader memory", "gzip ratio crashes STEP reader"
- CWE-409 (decompression bomb)
- ISO 10303-21 §12 (compressed-archive transfer)
Sender
deduced — adversarial input that exercises the .stpz gzip-wrapper decompression path with a highly-compressible payload
Description
The `.stpz` extension denotes a gzip-wrapped Part-21 file. Gzip compresses long runs of identical bytes at ratios approaching 1:1024 per DEFLATE block, and a multi-block stream can chain to an aggregate ratio of 1:10000 or more. An attacker ships a .stpz file of ~3 KB whose decompressed body is 30+ MB of repeated `;` or whitespace; with multiple stacked gzip members or a single very-redundant payload, the decompressed size reaches gigabytes. A receiver that calls a streaming gunzip into a single buffer exhausts RAM. Distinct from Ad027 / Pf030 (instance-count bombs at the parser layer): the bomb is at the gzip layer and triggers before any Part-21 token is seen. Bug-reporter language: "stpz decompression bomb", "gzip ratio explodes", "Part-21 reader OOMs on tiny .stpz".
Reproducer recipe
a `.stpz` file consisting of a gzip stream whose payload is e.g. 4 GB of repeated `' '` bytes plus a minimal Part-21 envelope; the compressed file is ~4 KB. The fixture in this catalog is the embedded Part-21 body for cataloguing only; the bomb itself lives in the gzip wrapper.
Expected kernel behavior
cap the per-stream decompressed-byte budget; abort decompression when the budget is exceeded with a precise diagnostic; treat the gzip layer as adversarial. Stream the decompressed bytes through the Part-21 tokeniser rather than buffering the whole expansion.
Notes
Distinct from Ad027 (instance-count bomb at parser layer) and Ad105 (archive header lies about size — Ad105 is detectable from the header alone, this entry's gzip stream actually produces the bytes when decoded). **See also**: Ad027, Ad105, Ad111, Ad112, Pf030. Provenance tier: cross-file-state — bytes alone (a Part-21 body) cannot demonstrate this defect; the bomb is in the gzip wrapper.
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'.stpz') or contains(b'decompression')contains(b'bomb') or contains(b'ratio') or contains(b'.stpz')
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/* Ad110: stpz gzip wrapper expands at ratio 1:10000 into multi-gigabyte body; attacker ships ~3 KB .stpz file decompressing to 30+ GB of repeated bytes; receiver that gunzips into a single buffer exhausts RAM before parsing; bomb triggers at the gzip layer before any Part-21 token is seen; distinct from Ad027/Pf030 (instance-count bombs at parser layer); receiver must cap per-stream decompressed-byte budget; must abort decompression when budget exceeded with precise diagnostic; must stream decompressed bytes through tokeniser rather than buffering; CWE-409; ISO 10303-21 §12 compressed-archive transfer; GEOMETRIC_CURVE_SET IS model entity â OCC yields empty */ 3HEADER; 4FILE_DESCRIPTION(('Ad110'),'2;1'); 5FILE_NAME('Ad110.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('Ad110','Ad110','',(#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=/* stpz gzip decompression bomb (gzip-wrapper layer; cross-file-state): 26 .stpz gzip stream structure: 27 gzip magic: 1F 8B 28 compression method: deflate (8) 29 compressed size: ~3 KB (highly-compressible repeated bytes) 30 decompressed size: ~30 GB (ratio 1:10000) 31 payload: 4294967296 repeated ' ' bytes + Part-21 envelope 32 A receiver that buffers the full gunzip output allocates 30 GB of RAM 33 before seeing a single Part-21 token â OOM before parsing begins. 34 Receiver must: cap per-stream decompressed-byte budget; reject .stpz 35 files whose decompression ratio exceeds a configurable limit; stream 36 rather than buffer. This .stp file is the embedded STEP body (tiny; 37 the bomb is in the gzip wrapper, not the STEP content inside it). */ 38CARTESIAN_POINT('stpz_gzip_ratio_bomb_note',(0.0,0.0,0.0)); 39ENDSEC; 40END-ISO-10303-21;