FSF GNU glibc unsetenv Vulnerability

Currently the SecurityFocus staff are not aware of any exploits for this issue. If you feel we are in error or are aware of more recent information, please mail us at: vuldb@securityfocus.com.

To test whether your system is vulnerable use the following program:

#include <stdlib.h>
#include <stdio.h>

extern char **environ;

int main()
{
char *env[] = {
"bob=trash",
"bob=uh-oh",
NULL
};

environ = env;
printf("bob = %s\n", env[0]);
unsetenv("bob");
printf("bob = %s\n", getenv("bob"));
return 0;
}

If the output isn't "bob = (null)", unsetenv() isn't doing its job. (also note that not all libc's support unsetenv, or even the environ variable, so this may not compile/link on many non-glibc systems).


 

Privacy Statement
Copyright 2010, SecurityFocus