HarshKapadia2 / HarshKapadia2/parse-elf
[Crash] Segmentation Fault in print_elf64_shdrs due to unchecked section name index
- Dominant language
- C
- Stars
- 7
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
**Description**
The `parse-elf` utility crashes with a Segmentation Fault (SEGV) when parsing a specially crafted ELF file. This is caused by a missing bounds check when reading the section name index (`sh_name`).
**Vulnerability Type**
Heap-based Buffer Over-read / Denial of Service.
**Steps to Reproduce**
1. Compile the project with AddressSanitizer: `gcc -fsanitize=address -g src/pelf.c -o parser`
2. Open a valid ELF file in a hex editor.
3. Locate the Section Header Table.
4. Modify the `sh_name` field of the first section header to `0xFFFFFFFF`.
5. Run the parser: `./parser modified_elf`
**Crash Log (AddressSanitizer)**
```text
==1307716==ERROR: AddressSanitizer: SEGV on unknown address ...
#0 0x7ffff7936286 in __sanitizer::internal_strlen
#4 0x55555555a36e in print_elf64_shdrs src/pelf.c:408
SUMMARY: AddressSanitizer: SEGV src/pelf.c:408 in print_elf64_shdrs
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.