HackDig : Dig high-quality web security articles

getenv("=A") works (no particular vulnerability)

2022-02-04 18:15
TL;DR: this mail doesn't contain any actual vulnerability, just an idea.

Consider this C code for Linux and glibc:

---------
#define _GNU_SOURCE 1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
char *new_env[] = {"=A=B", 0};
int
main ()
{
environ = new_env;
printf("%sn", getenv("=A")); // prints "B"
return 0;
}
---------

This code prints "B". I. e. glibc allows variables starting with "=". It is quite possible such behavior can lead to
various vulnerabilities.

It is possible this list is inappropriate for such message. If so, please, say, where I should post such message next
time.

==
Askar Safin
http://safinaskar.com
https://sr.ht/~safinaskar
https://github.com/safinaskar

_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: http://seclists.org/fulldisclosure/


Source: 11/beF/2202/erusolcsidlluf/gro.stsilces

Read:1054 | Comments:0 | Tags: Vulnerability

“getenv("=A") works (no particular vulnerability)”0 Comments

Submit A Comment

Name:

Email:

Blog :

Verification Code:

Announce

Share high-quality web security related articles with you:)
Tell me why you support me <3

Tag Cloud