Diagon GraphPlanar::Write improper array index validation vulnerability
An improper array index validation in Diagon's GraphPlanar::Write allows a crafted markdown file to cause an out-of-bounds read and write, leading to memory corruption. A victim must open the malicious file to trigger the crash.
Originally disclosed on Cisco Talos
An improper array index validation vulnerability exists in the GraphPlanar::Write functionality of Diagon v1.0.139. A specially crafted markdown file can lead to memory corruption.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the use of boost::vecS for edge storage allows parallel edges, which breaks assumptions in the graph algorithms and causes the ordering vector to be shorter than the number of vertices, leading to an out-of-bounds access.
Impact
A crafted markdown file could cause memory corruption, potentially leading to code execution or a crash, though the CVSS score indicates limited impact.
What the attacker needed
Victim opens a malicious markdown file
The fix
The maintainer has provided a patch in version v1.1.158.
How it was found
- Create a markdown file containing a graph description with repeated edges.
- Run Diagon with the GraphPlanar translator on the file.
- The program crashes due to an out-of-bounds read/write in GraphPlanar::Write.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Diagon is a tool that turns simple text into diagrams. A bug in how it handles certain graph inputs can make it read and write memory outside the intended area, which can crash the program or potentially allow an attacker to run code. The attacker needs the victim to open a specially crafted file.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.