Lucene search
K

unsetenv.txt

🗓️ 28 Sep 1999 00:00:00Reported by Packet StormType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 16 Views

Unsetenv function in glibc 2.1.1 has an off-by-one error, not clearing duplicate variables.

Code
` o unsetenv() off-by-one error:  
The unsetenv function in glibc 2.1.1 suffers from a problem whereby  
when running through the environment variables, if the name of the  
variable being unset is present twice consecutively, the second is  
not destroyed.  
  
unsetenv is sometimes used by programs that depend on it clearing out  
variables for protection against evil environment variables.  
  
It appears as though this was found by someone else before I stumbled  
across it; glibc 2.1.2 should not be vulnerable.  
  
To see if your libc has the problem, compile and run 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).  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation