Skip to content

Files

Failed to load latest commit information.

Latest commit

 Cannot retrieve latest commit at this time.

History

History

libm-cve-2020-10029

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

GNU libm CVE-2020-10029

Reproducer for GNU glibc CVE-2020-10029. The vulnerability exists in the libm component of GNU C library. It occurs when certain trigonometric functions like sinl are invoked with crafted input, leading to stack corruption. You can read a more detailed write-up on the ForAllSecure blog here.

All the files in the corpus/ directory were generated from scratch by Mayhem.

Responsible disclosure timeline

To build

Assuming you just want to build the docker image, run:

docker build -t forallsecure/libm-cve-2020-10029 .

Get from Dockerhub

If you don't want to build locally, you can pull a pre-built image directly from dockerhub:

docker pull forallsecure/libm-cve-2020-10029

Run under Mayhem

Change to the libm-cve-2020-10029 folder and run:

mayhem run mayhem/libm-tester

and watch Mayhem replicate the bugs! These bugs take very little time (several seconds) to find.

Run locally

Change to the libm-cve-2020-10029 folder and run:

gcc src/libm-tester.c -lm -o libm-tester

Now run:

./libm-tester mayhem/libm-tester/poc/b443907b34ee3a07378d82778406743cd686d25f

If your system is vulnerable to CVE-2020-10029, it will print:

*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)

POC

We have included a proof of concept output under the poc directory.

Testing other math libraries

The code included with this project can be easily modified to test other libm's, like those included with musl libc and BSD libc's.

Modifiy libm-cve-2020-10029/src/generate_function_calls.py to match the functions supported by the library you want to test.

Then regenerate function_calls.h:

python3 generate_function_calls.py >function_calls.h

You should now be able to compile libm-cve-2020-10029/src/libm-tester.c against your library.