mailing list archives
Bypassing libsafe format string protection
From: Wojciech Purczynski <cliph () isec pl>
Date: Wed, 20 Mar 2002 11:35:04 +0100 (CET)
-----BEGIN PGP SIGNED MESSAGE-----
Version: up to 2.0-11
Author: Wojciech Purczyński <cliph () isec pl>
Date: March 14, 2002
Libsafe provides ineffective protection against format string exploit
attacks that may be trivially bypassed.
The libsafe library protects a process against the exploitation of buffer
overflow vulnerabilities in process stacks. Libsafe works with any
existing pre-compiled executable and can be used transparently, even on a
system-wide basis. The method intercepts all calls to library functions
that are known to be vulnerable. A substitute version of the corresponding
function implements the original functionality, but in a manner that
ensures that any buffer overflows are contained within the current stack
frame. Libsafe has been shown to detect several known attacks and can
potentially prevent yet unknown attacks.
Libsafe protection against format string exploits may be easily bypassed
using flag characters that are implemented in glibc but are not
implemented in libsafe.
These flags definied in SUSv2 are not defined in C standard (quoting from
' For decimal conversion (i, d, u, f, F, g, G) the
output is to be grouped with thousands' grouping
characters if the locale information indicates any.
Note that many versions of gcc cannot parse this
option and will issue a warning. SUSv2 does not
I For decimal integer conversion (i, d, u) the output
uses the locale's alternative output digits, if any
(for example, Arabic digits). However, it does not
include any locale definitions with such outdigits
defined. (glibc 2.2 only)
Libsafe *printf function wrappers incorrectly parse argument indexing in
format strings. They always assume that the n-th conversion specification
uses n-th argument and does not properly count real number of arguments
used. Thus, arguments, whose index numbers are above the total number of
conversion specifications, are not verified at all.
printf("%2$n", "unused argument", &target);
Total number of % format string used: 1 ("%2$n")
Number of argument used: 2
On March 18, 2002 new version of libsafe 2.0-12 has been released fixing
above security issue.
iSEC Security Research
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----
- Bypassing libsafe format string protection Wojciech Purczynski (Mar 20)