Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 90552 - sys-libs/libsafe: Libsafe Safety Check Bypass Vulnerability
Summary: sys-libs/libsafe: Libsafe Safety Check Bypass Vulnerability
Status: RESOLVED DUPLICATE of bug 89246
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Security
URL: http://www.securiteam.com/unixfocus/5...
Whiteboard: B4
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-26 15:52 UTC by Adir Abraham
Modified: 2005-07-17 13:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adir Abraham 2005-04-26 15:52:34 UTC
from securiteam.com:

Libsafe is "a library that protect critical elements of stacks". Due to a bug in libsafe attackers can bypass libsafe checking and exploit a vulnerability contained inside libsafe protected multi-threaded application.

Reproducible: Always
Steps to Reproduce:




Vulnerable Systems:
 * libsafe version 2.0.16

As a example look at the code situated at the safe function strcpy():
char *strcpy(char *dest, const char *src)
{
    ...
    if (!real_strcpy)
      real_strcpy = (strcpy_t) getLibraryFunction("strcpy");
    ...
    if ((max_size = _libsafe_stackVariableP(dest)) == 0) {
      LOG(5, "strcpy(<heap var> , <src>)\n");
      return real_strcpy(dest, src);
    }
    ...
    if ((len = strnlen(src, max_size)) == max_size)
      _libsafe_die("Overflow caused by strcpy()");
    ...

Function _libsafe_stackVariableP() checked length beetwen buffor and stack
frame. It should return 0 only in case when address does not point to a stack
variable. Look at the function code:
uint _libsafe_stackVariableP(void *addr) {
    ...
    /*
     * If _libsafe_die() has been called, then we don't need to do anymore
     * libsafe checking.
     */
    if (dying)
      return 0;
    ...

Function _libsafe_die() is called then attack is detected, variable "dying" is
set and at least aplication is killed. In case of multi-threaded programs, it is
possible to make attack before the end of _libsafe_die(), during the time while
checking is not active.

------

There also seems to be an unofficial fix in the site.
Comment 1 SpanKY gentoo-dev 2005-04-26 16:06:47 UTC

*** This bug has been marked as a duplicate of 89246 ***