Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null pointer dereferencing in bpf_object__collect_externs #703

Open
rish9101 opened this issue Jun 25, 2023 · 0 comments
Open

Null pointer dereferencing in bpf_object__collect_externs #703

rish9101 opened this issue Jun 25, 2023 · 0 comments

Comments

@rish9101
Copy link

I found a null pointer dereferencing bug at line 3828 of libbpf.c. This is caused due to one of the arguments to strcmp being a NULL Pointer.
The bug is triggered by fuzzing using the harness bpf-object-fuzzer.c provided in fuzz folder.

The stack trace of the execution is

#0  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:101
#1  0x000000000040606b in bpf_object__collect_externs (obj=<optimized out>) at libbpf.c:3828
#2  bpf_object_open (path=<optimized out>, path@entry=0x0, obj_buf=<optimized out>, obj_buf_sz=<optimized out>, opts=<optimized out>) at libbpf.c:7376
#3  0x0000000000409bdb in bpf_object__open_mem (obj_buf=0x4372f5, obj_buf_sz=0x0, opts=0x0) at libbpf.c:7415

The crashing input has been attached below.

The bug has been tested on Ubuntu 20.04, libbpf built with clang-11.

null_ptr_strcmp_2.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant