Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Tools/GitHubGitHub/zeetee1235/cve-2026-126497
Memory ForensicsVulnerability AnalysisExploitationFuzzingPapers & ResearchBinary Exploitation
GitHubzeetee1235/cve-2026-126497

CVE-2026-126497

Proof-of-concept and analysis for CVE-2026-126497, a heap out-of-bounds write in LibreCAD/libdxfrw R2004 DWG section-page parsing, with ASan reproducer, RCE lab, and patch.

View Repository
8 days agoNot yet reviewed
Share

CVE-2026-126497 — LibreCAD R2004 DWG section-page offset heap out-of-bounds write

NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-126497

CVE.org: https://www.cve.org/CVERecord?id=CVE-2026-126497

CVSS: 7.8 (High) CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H · 8.5 (High) CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Summary

dwgReader18::parseDataPage() in LibreCAD's bundled libdxfrw allocates a section buffer from the DWG header and then uses a per-page startOffset from the section map as a raw destination offset:

objData.reset(new duint8[si.pageCount * si.maxSize]);
...
duint8* oData = objData.get() + pi.startOffset;
pi.uSize = si.maxSize;
comp.decompress18(cData.data(), oData, pi.cSize, pi.uSize);

startOffset is never checked against the allocation size, and the decompressor is told to write maxSize bytes. A crafted AC1018 (DWG R2004) file can therefore write past the heap buffer. In LibreCAD and Fedora 44 builds startOffset is duint64, so startOffset = 2^64 - delta also writes before the buffer (backward write).

The base PoC corrupts the glibc top chunk and aborts. In LibreCAD/Fedora builds the 64-bit startOffset also allows a backward write to a C++ object placed before the buffer; a controlled lab demonstration against Fedora 44's dwg2dxf is included.

Affected versions

Version / buildResult
LibreCAD 2.2.0Reproduced (bundled libdxfrw)
LibreCAD 2.2.1.5Reproduced
LibreCAD 2.2.1.6Reproduced
codelibs/libdxfrw @ bf80b74Reproduced (forward write)
Fedora 44 libdxfrw-1.1.0-0.11.rc1.fc43Reproduced (dwg2dxf + libdxfrw.so.1)
LibreCAD commit 17ba2b2 and laterFixed
LibreCAD/libdxfrw 0c55959 and later masterFixed

The official fix is in LibreCAD commit 17ba2b2 (“Bound R2004 DWG page decoding”, PR #3257). No fixed 2.2.x release was available at publication time.

Root cause

The section map is parsed by readDwgHeader() / parseSysPage(). Each page descriptor contains startOffset, read with getRawLong64(). parseDataPage() does not verify that:

  1. pageCount * maxSize does not overflow the allocation size,
  2. startOffset is inside the allocation,
  3. startOffset + maxSize is inside the allocation,
  4. the compressed page data is inside the file.

decompress18()'s output-size guard only bounds writes relative to the caller-supplied destination and dsize; it cannot know that the destination itself is outside the real allocation. This is also why the earlier decompress18() fix for CVE-2021-21898 does not prevent this issue: the compressed stream is valid.

The PoC changes only the Header section page startOffset, from 0 to 0x1000. The allocation is 0x7400 bytes and the write starts at objData + 0x1000, so the final 0x1000 bytes land past the allocation.

Proof of concept

poc.dwg is a stock AC1018 file with one 8-byte change:

size:        187890
sha256:      70ae31f77d4a657dfa4f489de46048e17b41ef8046f15a48dd6beb2649eb33de
offset:      0x2dc74
change:      00 00 00 00 00 00 00 00
          -> 00 10 00 00 00 00 00 00   (startOffset = 0x1000)

Verify the committed artifact, or rebuild it from the original seed:

./generate_poc.py --verify
./generate_poc.py --seed /path/to/example_2004.dwg

Reproduce with ASan:

LIBDXFRW_DIR=/path/to/libdxfrw ./verify.sh
LIBDXFRW_DIR=/path/to/LibreCAD/libraries/libdxfrw ./verify.sh

Expected output:

[PASS] dwgReader18::parseDataPage heap-buffer-overflow reproduced

The full ASan log is written to out/asan.txt:

ERROR: AddressSanitizer: heap-buffer-overflow
WRITE of size 1
dwgCompressor::decompress18
dwgReader18::parseDataPage
dwgReader18::readDwgHeader
dwgR::processDwg
dwgR::read
0 bytes after 29696-byte region

Patched negative control:

LIBDXFRW_DIR=/path/to/patched/libdxfrw EXPECT_SAFE=1 ./verify.sh

On unmodified Fedora 44 dwg2dxf and libdxfrw.so.1, the PoC aborts without ASan:

exit=134 (SIGABRT)
Fatal glibc error: malloc.c:2371 (sysmalloc): assertion failed ...

Exploitability

Proven:

  • Deterministic heap-buffer-overflow on the public dwgR::read() path.
  • Heap corruption / SIGABRT on real Fedora 44 dwg2dxf and libdxfrw.so.1, with ASLR enabled and no root.
  • Backward write on LibreCAD/Fedora builds: startOffset = 2^64 - delta targets objData - delta. In Fedora 44 dwg2dxf, dx_iface sits about 0x51e0 bytes before objData and its first qword is a C++ vtable pointer. run_rce_lab.sh overwrites that pointer with a fake vtable supplied by LD_PRELOAD; the next virtual call executes a payload.

Expected lab output:

[PASS] RCE via backward write: delta=0x51f0 exit=0
uid=1000(dev) ...
RCE_OK

Not proven / limitations:

  • The RCE demonstration requires LD_PRELOAD to map a fake vtable at a fixed address (a lab condition).
  • No heap leak, PIE bypass, or ASLR bypass without preload.
  • No standalone file-only remote exploit.
  • The LibreCAD GUI import path was not confirmed in the headless test environment; the confirmed path is dwg2dxf / libdxfrw.so.1.

The base PoC is best classified as heap corruption / denial of service. The backward-write experiment proves the primitive can reach a live C++ vtable, but a weaponized preload-free exploit remains future work.

To run the lab, extract Fedora 44 librecad/libdxfrw RPMs into a directory and point DISTRO_ROOT at it:

DISTRO_ROOT=/path/to/fedora44/root ./run_rce_lab.sh

Fix

fix-parseDataPage.patch is a minimal codelibs-compatible patch:

  • rejects zero pageCount/maxSize,
  • detects pageCount * maxSize overflow,
  • allocates exactly the computed size,
  • rejects pages where startOffset > dataSize || maxSize > dataSize - startOffset.

The authoritative LibreCAD fix (17ba2b2) additionally validates the section size, compression type, page capacity, file bounds, cSize, and uSize, and uses a capped allocation (0x2f000000).

Credit

  • Finder: Lee Keon-Hyeong, Park-Jung-Hyun
  • Reporter: Lee Keon-Hyeong
  • Remediation developer: Dongxu Li (dxli)
  • CNA: VulnCheck
Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    936
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    555
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    353
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    348
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    336
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    288

Explore all tools

Browse our collection of tools

View all tools →