(CVE-2020-1664) Juniper Junos OS dcd create_debug_data() buffer overflow
The dcd daemon, which runs as root, reads a string from a world-writable file into a fixed-size stack buffer without checking its length. A low-privileged attacker could write a long string to that file to crash the daemon or possibly run code as root.
starlabs.sg
Published on starlabs.sg
The buffer overflow vulnerability is caused by reading content in /var/tmp/dcddebug.txt to a stack-based buffer. With the low privilege user, an attacker could put the long string to /var/tmp/dcddebug.txt file to trigger the vulnerability.
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The create_debug_data() function reads an unbounded string from a file into a fixed-size stack buffer using fscanf with a bare %s format.
Impact
A low-privileged attacker could crash the root-run daemon (denial of service) or potentially execute arbitrary code with root privileges.
What the attacker needed
Local low-privileged access to the device; ability to write to /var/tmp/dcd_debug.txt
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 write-up has not been written yet. The Original tab links to the source.
A background program called dcd runs with the highest permissions on the device. It opens a file that ordinary users can write to and copies text from it into a small reserved space in memory without checking how long the text is. Writing too much text overflows that space, which can crash the program or let the attacker take control of it.
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.