Diagon Sequence::DrawText heap-based buffer overflow vulnerability
A heap-based buffer overflow exists in Diagon's Sequence::DrawText when a sequence diagram message has the same sender and receiver, causing an infinite loop that inflates actor positions without increasing spacing. An attacker could achieve arbitrary code execution by convincing a victim to open a malicious markdown file.
Originally disclosed on Cisco Talos
A heap-based buffer overflow vulnerability exists in the Sequence::DrawText functionality of Diagon v1.0.139. A specially crafted markdown file can lead to arbitrary code execution.
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 layout loop never increases the distance between an actor and itself, so the actor's position grows without bound while the screen buffer size is based on that inflated position, leading to an out-of-bounds write when drawing text.
Impact
A victim opening a malicious markdown file could trigger a heap buffer overflow, potentially leading to arbitrary code execution.
What the attacker needed
Victim opens a malicious markdown file
The fix
The maintainer provided a patch in version v1.1.158.
How it was found
- Create a markdown file containing a sequence diagram message where the sender and receiver are the same actor.
- Run Diagon with the sequence translator on that file.
- Observe the heap buffer overflow when the message text is drawn.
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 text diagrams into pictures. A bug in how it calculates where to draw names lets a crafted diagram file write past the end of a memory buffer, which can crash the program or let an attacker run their own code if the victim opens the 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.