Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email email@example.com
Off-by-one Buffer Overflow Vulnerability in BSD libc realpath(3)
From: Dave Ahmad (dasecurityfocus.com)
Date: Mon Aug 04 2003 - 12:33:43 CDT
Originally reported as affecting only WU-FTPD. It seems that the bug
is in code borrowed from the BSD C library. NetBSD, FreeBSD and OpenBSD
David Mirza Ahmad
8D 9A B1 33 82 3D B3 D0 40 EB AB F0 1E 67 C6 1A 26 00 57 12
The battle for the past is for the future.
We must be the winners of the memory war.
attached mail follows:
[ this version has some typos fixed ]
An off-by-one error exists in the C library function realpath(3).
This is the same bug that was recently found in the wu-ftpd ftpd
server by Janusz Niewiadomski and Janusz Niewiadomski.
The OpenBSD ftp daemon does not use realpath(3) in a way that could
be exploited, however a number of other system binaries also use
the function. It is not currently known whether or not this bug
results in an exploitable security hole on OpenBSD. Since the bug
led to an exploitable hole in wu-ftpd, it is entirely possible that
some program using realpath(3) under OpenBSD may be vulnerable to
attack. For OpenBSD 3.3 and higher, the ProPolice stack protector
should provide some protection from this bug, but this cannot be
This bug has been fixed in OpenBSD-current as well as the 3.2 and
3.3 stable branches. Patches are available for OpenBSD 3.2 and 3.3.
Patch for OpenBSD 3.2:
Patch for OpenBSD 3.3:
For versions of OpenBSD prior to 3.2, users may simply fetch
the current revision of realpath.c from:
then rebuild and install libc with the new realpath.c.
For more details, see the description of the wu-ftpd fp_realpath bug:
- TEXT/PLAIN attachment: FreeBSD-SA-03:08.realpath
- TEXT/PLAIN attachment: NetBSD-SA2003-011.txt.asc