Joyent SmartOS Hyprlofs FS IOCTL Native File System name Buffer Overflow Privilege Escalation Vulnerability
A stack buffer in the Hyprlofs ioctl handler is sized MAXPATHLEN, but the length check allows a name of exactly MAXPATHLEN bytes, so the terminating null byte is written one byte past the buffer. A local attacker with the required privilege could use this out-of-bounds write to potentially escalate privileges or cause a denial of service.
Originally disclosed on Cisco Talos
An exploitable buffer overflow exists in the the Joyent SmartOS OS 20161110T013148Z Hyprlofs file system. The vulnerability is present in the Ioctl system call with the command HYPRLOFSADDENTRIES when dealing with native file systems.
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
The length validation uses a greater-than comparison against MAXPATHLEN instead of greater-than-or-equal, so a name of exactly MAXPATHLEN bytes passes and the null terminator is written one byte beyond the stack buffer.
Impact
A local attacker holding the Hyprlofs control privilege could potentially escalate privileges or cause a denial of service; the text hedges this as 'could result in potential privilege escalation'.
What the attacker needed
Local access to SmartOS; Hyprlofs control privilege
The fix
The length check should reject names of MAXPATHLEN bytes or more, or the buffer should be sized to leave room for the terminator.
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.
A program keeps a fixed-size space in memory for a file name. The code checks that the name is not longer than that space, but it forgets that it also needs room for the zero byte that marks the end of the text. So a name of exactly the maximum length pushes that final zero byte just past the space, corrupting nearby memory. Someone who can already run code on the machine may be able to turn that small corruption into more control over the system.
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.