Skip to content

Security Report — Integer Overflow to Heap Buffer Overflow in openMVS PLY Parser (libs/IO/PLY.cpp) #1311

Closed

Description

@ruben0315R

Hi,

I'm reporting two vulnerabilities found in openMVS's PLY file parser (libs/IO/PLY.cpp), verified against develop at commit f98d6c2. I've filed a CVE request with MITRE for these and wanted to notify you directly as well, since I didn't see private vulnerability reporting enabled on the GitHub repo.

Finding 1 — Integer Overflow to Heap Buffer Overflow (Critical)
ascii_get_element() (line 1127) and binary_get_element() (line 1216) compute the allocation size for a list property as item_size * list_count, both 32-bit signed int. A crafted PLY file with an attacker-controlled list_count (e.g. 0x40000001 with item_size=4) causes this multiplication to overflow — new char[4] gets allocated instead of the intended ~4.3 GB — and the following loop then writes the full attacker-controlled size into that 4-byte buffer, corrupting the heap. This is reachable by any application that loads an untrusted PLY file (DensifyPointCloud, ReconstructMesh, RefineMesh, TextureMesh, or any library consumer of PLY::read()).

Suggested fix: cast to size_t before multiplying, and/or reject the property if list_count or the product is out of a sane bound.

Finding 2 — Stack Use-After-Return (Low)
get_words() (line 1282) stores pointers into its own stack-local buffer into a heap-allocated array, then returns that array. The caller (PLY::read(), line 567) dereferences those now-dangling pointers immediately. Confirmed under AddressSanitizer. I haven't demonstrated attacker-observable impact from this on its own — it's undefined behavior that's silent in typical non-ASAN builds — but it's worth fixing, and it's the reason ASAN can't reproduce Finding 1 end-to-end (it aborts on this UAR before ever reaching the overflow code).

I have full technical evidence for both — source excerpts, ASAN traces, an in-parser diagnostic reproduction against the real compiled parser, PoC .ply files, and remediation suggestions — and I'm happy to send the complete write-up.

Let me know if you'd like me to send the full pack, or if you have a preferred channel (e.g. a private security advisory on GitHub) for coordinating a fix before any public disclosure.

Thanks,
Ruban Arumugam Gunavathy

Activity

  1. cdcseacave commented on Oct 13, 2026

    @cdcseacave
    Owner

    Thanks for the careful report — both findings are real and are now fixed in 8f44dac (branch improvemnts, heading to develop via #1314).

    Finding 1 (integer overflow → heap overflow). ascii_get_element and binary_get_element computed the list allocation as item_size * list_count in 32-bit int, so a crafted count wrapped to a tiny buffer that the read loop then overran. The size is now computed in size_t, and the count is validated before allocation: the ASCII path bounds it by the words remaining on the line (a large count also ran past the end of the words array), and the binary path bounds it by the bytes remaining in the file. Negative counts, and the unchecked length in the binary string property, are rejected as well.

    Finding 2 (stack-use-after-return). get_words returned pointers into its own stack-local line buffer. That buffer now lives in the PLY object, so the returned word pointers stay valid until the next get_words call, which is always after the current words have been consumed and freed. This is what ASAN was tripping on first.

    Malformed files now take the reader's existing abort_ply path (diagnostic + exit) instead of corrupting memory.

    Since the report was filed publicly, the fix is public too. If you'd still like to coordinate the MITRE/CVE record, I'm happy to — a GitHub security advisory can be opened on the repo for the reference. Thanks again.

  2. cdcseacave commented on Oct 13, 2026

    @cdcseacave
    Owner

    Follow-up: the reader now also fails gracefully on any malformed PLY. Previously its internal error handler called exit(-1), which would take down the host application (Viewer, the pipeline tools) on a bad file. It now throws, and the two PLY read entry points (Mesh::LoadPLY / PointCloud::LoadPLY, the only read() callers) catch it and return false. A regression test loads PLYs whose face list count overruns the line or overflows the 32-bit allocation size and checks they are refused rather than crashing.

    Both commits are on improvemnts and will close this issue when #1314 merges to develop.

  3. ruben0315R commented on Oct 13, 2026

    @ruben0315R
    Author

    Yes, I'd appreciate that. Please open a GitHub Security Advisory for the finding and coordinate the CVE request through GitHub's CNA process. Please ensure I’m credited as the reporter in the advisory.

    Thank you for your help and for recognizing my efforts. I appreciate it!

    Happy hunting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions