Mkdir Buffer Overflow Vulnerability

BID:10462

Info

Mkdir Buffer Overflow Vulnerability

Bugtraq ID: 10462
Class: Boundary Condition Error
CVE:
Remote: No
Local: Yes
Published: Jun 02 2004 12:00AM
Updated: Jun 02 2004 12:00AM
Credit: Credit for this vulnerability goes to Tim Newsham <[email protected]>.
Vulnerable: Bell Labs Unix Seventh Edition
Not Vulnerable:

Discussion

Mkdir Buffer Overflow Vulnerability

It is reported that mkdir is susceptible to a buffer overflow vulnerability. An attacker with local access passes a long path to mkdir, which overflows a fixed buffer.

Mkdir is installed setuid root by default, as the mknod() system call can only be called by root. There is no mkdir() system call, so the mkdir command must use mknod to create a directory node, then populate the node with "." and ".." itself.

A local attacker can exploit this issue to execute arbitrary code as root.

Exploit / POC

Mkdir Buffer Overflow Vulnerability

Tim Newsham <[email protected]> has provided an exploit for this issue.

Solution / Fix

Mkdir Buffer Overflow Vulnerability

Solution:
Tim Newsham suggests adding:

if(strlen(d) >= 126) {
fprintf(stderr, "mkdir: path is too long\n");
++Errors;
return;
}

to the start of the mkdir() function in /usr/src/cmd/mkdir.c

This has not been tested.

References

Mkdir Buffer Overflow Vulnerability

References:

© CVE.report 2026

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report