Security research project on fuzzing libpng with OSS-Fuzz. Includes seed corpus analysis, custom read/write fuzzers, and a proof-of-concept exploit for CVE-2014-9495.# Fuzzing and Vulnerability Analysis of libpng
**Group Security Research Project**
**About Fuzzing:** Fuzzing is an automated software testing technique that provides invalid, unexpected, or random data as inputs to a program to discover bugs and vulnerabilities. Coverage-guided fuzzing uses code coverage feedback to intelligently explore different execution paths.
**About OSS-Fuzz:** OSS-Fuzz is Google's continuous fuzzing service for open-source software. It uses LibFuzzer and other fuzzing engines to automatically test critical open-source projects and report vulnerabilities.
This project demonstrates coverage-guided fuzzing, code coverage analysis, and vulnerability exploitation using Google's OSS-Fuzz framework on the libpng library.
**Target:** libpng v1.6.48 (fuzzing), v1.5.20 (exploitation)
**For detailed methodology and full report:** See `report.pdf`
**For complete instructions:** See `Instructions.md`
---
## Results Summary
### Part 1: Seed Corpus Impact Analysis
| Metric | WITH Corpus | WITHOUT Corpus | Improvement |
|--------|-------------|----------------|-------------|
| **Line Coverage** | 41.83% | 24.76% | **+17.07%** |
| **Branch Coverage** | 35.49% | 21.03% | **+14.46%** |
| **Function Coverage** | 50.75% | 34.75% | **+16.00%** |

### Part 3: Custom Fuzzer Improvements
**Improvement 1 - Enhanced Read Fuzzer** ([submit_improve1](https://github.com/Enessar/oss-fuzz/tree/submit_improve1))
- Line Coverage: 33.02% → 34.08% **(+1.06%)**
- Added PNG transformation API calls and edge case testing
- +74 lines in `pngread.c`, +73 lines in `pngtrans.c`
**Improvement 2 - Write Fuzzer** ([submit_improve2](https://github.com/Enessar/oss-fuzz/tree/submit_improve2))
- Created new fuzzer for PNG **encoding** (write operations)
- Write functions: 0% → 30-50% coverage
- **+1,270 lines** of previously untested code covered

### Part 4: CVE-2014-9495 Exploitation
Successfully exploited heap buffer overflow in libpng v1.5.20:
- Integer overflow in Adam7 interlaced PNG processing
- PoC triggers AddressSanitizer detection
- Script: `part4/run.poc.sh`
---
## Achievements
- Seed corpus impact: +17% coverage improvement
- Custom fuzzers: 2 new variants (enhanced read + write fuzzer)
- Novel coverage: +1,270 lines of previously untested code
- CVE exploitation: Successful PoC for CVE-2014-9495
---
## Project Structure
```
├── part1/ # Seed corpus impact analysis
│ ├── run.w_corpus.sh # Run with seed corpus
│ ├── run.w_o_corpus.sh # Run without seed corpus
│ └── report/ # Coverage reports
├── part3/ # Custom fuzzer improvements
│ ├── improve1/ # Enhanced read fuzzer
│ └── improve2/ # New write fuzzer
└── part4/ # CVE-2014-9495 exploitation
├── run.poc.sh # Run exploit
└── write_exploit.c # PoC code
```
---
## Quick Start
```bash
# Part 1: Fuzzing experiments (4 hours each)
cd part1
./run.w_corpus.sh # or ./run.w_o_corpus.sh
# Part 3: Test improvements (4 hours each)
cd part3/improve1 && ./run.improve1.sh
cd part3/improve2 && ./run.improve2.sh
# Part 4: Exploit CVE
cd part4 && ./run.poc.sh
```
**View coverage reports:**
```bash
firefox part1/report/w_corpus/linux/index.html
```
---
## Group Members
This security research project was completed collaboratively by:
- Mahdi Atallah
- Rassene M'Sadaa
- Yannik Krone
- Yonathan Lanzmann
[4.0K] /data/pocs/5232af825054ac7f635fd78cfed9ef5f5a0a1391
├── [ 671] Instructions.md
├── [4.0K] part1
│ ├── [2.4K] oss-fuzz.diff
│ ├── [4.0K] report
│ │ ├── [4.0K] w_corpus
│ │ │ ├── [4.0K] linux
│ │ │ │ ├── [ 193] directory_view_index.html
│ │ │ │ ├── [8.9K] file_view_index.html
│ │ │ │ ├── [ 207] index.html
│ │ │ │ ├── [4.4K] report.html
│ │ │ │ ├── [4.0K] src
│ │ │ │ │ ├── [4.0K] libpng
│ │ │ │ │ │ ├── [4.0K] contrib
│ │ │ │ │ │ │ ├── [4.0K] oss-fuzz
│ │ │ │ │ │ │ │ ├── [ 42K] libpng_read_fuzzer.cc.html
│ │ │ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ │ ├── [803K] png.c.html
│ │ │ │ │ │ ├── [ 29K] pngdebug.h.html
│ │ │ │ │ │ ├── [185K] pngerror.c.html
│ │ │ │ │ │ ├── [293K] pngget.c.html
│ │ │ │ │ │ ├── [644K] png.h.html
│ │ │ │ │ │ ├── [ 90K] pnglibconf.h.html
│ │ │ │ │ │ ├── [ 52K] pngmem.c.html
│ │ │ │ │ │ ├── [ 23K] pngprefix.h.html
│ │ │ │ │ │ ├── [411K] pngpriv.h.html
│ │ │ │ │ │ ├── [861K] pngread.c.html
│ │ │ │ │ │ ├── [ 22K] pngrio.c.html
│ │ │ │ │ │ ├── [1.1M] pngrtran.c.html
│ │ │ │ │ │ ├── [910K] pngrutil.c.html
│ │ │ │ │ │ ├── [390K] pngset.c.html
│ │ │ │ │ │ ├── [ 86K] pngstruct.h.html
│ │ │ │ │ │ ├── [175K] pngtrans.c.html
│ │ │ │ │ │ └── [8.7K] report.html
│ │ │ │ │ └── [4.5K] report.html
│ │ │ │ └── [7.8K] summary.json
│ │ │ └── [3.1K] style.css
│ │ └── [4.0K] w_o_corpus
│ │ ├── [4.0K] linux
│ │ │ ├── [ 193] directory_view_index.html
│ │ │ ├── [8.9K] file_view_index.html
│ │ │ ├── [ 207] index.html
│ │ │ ├── [4.4K] report.html
│ │ │ ├── [4.0K] src
│ │ │ │ ├── [4.0K] libpng
│ │ │ │ │ ├── [4.0K] contrib
│ │ │ │ │ │ ├── [4.0K] oss-fuzz
│ │ │ │ │ │ │ ├── [ 44K] libpng_read_fuzzer.cc.html
│ │ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ ├── [818K] png.c.html
│ │ │ │ │ ├── [ 29K] pngdebug.h.html
│ │ │ │ │ ├── [189K] pngerror.c.html
│ │ │ │ │ ├── [293K] pngget.c.html
│ │ │ │ │ ├── [645K] png.h.html
│ │ │ │ │ ├── [ 90K] pnglibconf.h.html
│ │ │ │ │ ├── [ 52K] pngmem.c.html
│ │ │ │ │ ├── [ 23K] pngprefix.h.html
│ │ │ │ │ ├── [411K] pngpriv.h.html
│ │ │ │ │ ├── [887K] pngread.c.html
│ │ │ │ │ ├── [ 22K] pngrio.c.html
│ │ │ │ │ ├── [1.1M] pngrtran.c.html
│ │ │ │ │ ├── [932K] pngrutil.c.html
│ │ │ │ │ ├── [395K] pngset.c.html
│ │ │ │ │ ├── [ 86K] pngstruct.h.html
│ │ │ │ │ ├── [176K] pngtrans.c.html
│ │ │ │ │ └── [8.7K] report.html
│ │ │ │ └── [4.5K] report.html
│ │ │ └── [7.8K] summary.json
│ │ └── [3.1K] style.css
│ ├── [ 488] run.w_corpus.sh
│ └── [ 527] run.w_o_corpus.sh
├── [4.0K] part3
│ ├── [4.0K] coverage_noimprove
│ │ ├── [4.0K] linux
│ │ │ ├── [ 193] directory_view_index.html
│ │ │ ├── [ 11K] file_view_index.html
│ │ │ ├── [ 207] index.html
│ │ │ ├── [4.4K] report.html
│ │ │ ├── [4.0K] src
│ │ │ │ ├── [4.0K] libpng
│ │ │ │ │ ├── [4.0K] contrib
│ │ │ │ │ │ ├── [4.0K] oss-fuzz
│ │ │ │ │ │ │ ├── [ 42K] libpng_read_fuzzer_BASE.cc.html
│ │ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ ├── [803K] png.c.html
│ │ │ │ │ ├── [ 29K] pngdebug.h.html
│ │ │ │ │ ├── [185K] pngerror.c.html
│ │ │ │ │ ├── [294K] pngget.c.html
│ │ │ │ │ ├── [645K] png.h.html
│ │ │ │ │ ├── [ 96K] pnglibconf.h.html
│ │ │ │ │ ├── [ 52K] pngmem.c.html
│ │ │ │ │ ├── [ 29K] pngprefix.h.html
│ │ │ │ │ ├── [411K] pngpriv.h.html
│ │ │ │ │ ├── [861K] pngread.c.html
│ │ │ │ │ ├── [ 22K] pngrio.c.html
│ │ │ │ │ ├── [1.1M] pngrtran.c.html
│ │ │ │ │ ├── [911K] pngrutil.c.html
│ │ │ │ │ ├── [393K] pngset.c.html
│ │ │ │ │ ├── [ 86K] pngstruct.h.html
│ │ │ │ │ ├── [176K] pngtrans.c.html
│ │ │ │ │ ├── [ 32K] pngwio.c.html
│ │ │ │ │ ├── [531K] pngwrite.c.html
│ │ │ │ │ ├── [121K] pngwtran.c.html
│ │ │ │ │ ├── [605K] pngwutil.c.html
│ │ │ │ │ └── [ 10K] report.html
│ │ │ │ └── [4.5K] report.html
│ │ │ └── [9.3K] summary.json
│ │ └── [3.1K] style.css
│ ├── [4.0K] improve1
│ │ ├── [4.0K] coverage_improve1
│ │ │ ├── [4.0K] linux
│ │ │ │ ├── [ 193] directory_view_index.html
│ │ │ │ ├── [ 11K] file_view_index.html
│ │ │ │ ├── [ 207] index.html
│ │ │ │ ├── [4.4K] report.html
│ │ │ │ ├── [4.0K] src
│ │ │ │ │ ├── [4.0K] libpng
│ │ │ │ │ │ ├── [4.0K] contrib
│ │ │ │ │ │ │ ├── [4.0K] oss-fuzz
│ │ │ │ │ │ │ │ ├── [ 51K] libpng_read_fuzzer.cc.html
│ │ │ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ │ ├── [803K] png.c.html
│ │ │ │ │ │ ├── [ 29K] pngdebug.h.html
│ │ │ │ │ │ ├── [187K] pngerror.c.html
│ │ │ │ │ │ ├── [294K] pngget.c.html
│ │ │ │ │ │ ├── [645K] png.h.html
│ │ │ │ │ │ ├── [ 96K] pnglibconf.h.html
│ │ │ │ │ │ ├── [ 52K] pngmem.c.html
│ │ │ │ │ │ ├── [ 29K] pngprefix.h.html
│ │ │ │ │ │ ├── [411K] pngpriv.h.html
│ │ │ │ │ │ ├── [855K] pngread.c.html
│ │ │ │ │ │ ├── [ 22K] pngrio.c.html
│ │ │ │ │ │ ├── [1.1M] pngrtran.c.html
│ │ │ │ │ │ ├── [911K] pngrutil.c.html
│ │ │ │ │ │ ├── [393K] pngset.c.html
│ │ │ │ │ │ ├── [ 86K] pngstruct.h.html
│ │ │ │ │ │ ├── [172K] pngtrans.c.html
│ │ │ │ │ │ ├── [ 32K] pngwio.c.html
│ │ │ │ │ │ ├── [531K] pngwrite.c.html
│ │ │ │ │ │ ├── [121K] pngwtran.c.html
│ │ │ │ │ │ ├── [605K] pngwutil.c.html
│ │ │ │ │ │ └── [ 10K] report.html
│ │ │ │ │ └── [4.5K] report.html
│ │ │ │ └── [9.3K] summary.json
│ │ │ └── [3.1K] style.css
│ │ └── [ 377] run.improve1.sh
│ └── [4.0K] improve2
│ ├── [4.0K] coverage_improve2
│ │ ├── [4.0K] linux
│ │ │ ├── [ 193] directory_view_index.html
│ │ │ ├── [ 11K] file_view_index.html
│ │ │ ├── [ 207] index.html
│ │ │ ├── [4.4K] report.html
│ │ │ ├── [4.0K] src
│ │ │ │ ├── [4.0K] libpng
│ │ │ │ │ ├── [4.0K] contrib
│ │ │ │ │ │ ├── [4.0K] oss-fuzz
│ │ │ │ │ │ │ ├── [ 33K] libpng_write_fuzzer.cc.html
│ │ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ │ └── [4.5K] report.html
│ │ │ │ │ ├── [831K] png.c.html
│ │ │ │ │ ├── [ 29K] pngdebug.h.html
│ │ │ │ │ ├── [194K] pngerror.c.html
│ │ │ │ │ ├── [295K] pngget.c.html
│ │ │ │ │ ├── [645K] png.h.html
│ │ │ │ │ ├── [ 96K] pnglibconf.h.html
│ │ │ │ │ ├── [ 53K] pngmem.c.html
│ │ │ │ │ ├── [ 29K] pngprefix.h.html
│ │ │ │ │ ├── [416K] pngpriv.h.html
│ │ │ │ │ ├── [898K] pngread.c.html
│ │ │ │ │ ├── [ 23K] pngrio.c.html
│ │ │ │ │ ├── [1.1M] pngrtran.c.html
│ │ │ │ │ ├── [1016K] pngrutil.c.html
│ │ │ │ │ ├── [414K] pngset.c.html
│ │ │ │ │ ├── [ 86K] pngstruct.h.html
│ │ │ │ │ ├── [178K] pngtrans.c.html
│ │ │ │ │ ├── [ 31K] pngwio.c.html
│ │ │ │ │ ├── [507K] pngwrite.c.html
│ │ │ │ │ ├── [119K] pngwtran.c.html
│ │ │ │ │ ├── [560K] pngwutil.c.html
│ │ │ │ │ └── [ 10K] report.html
│ │ │ │ └── [4.5K] report.html
│ │ │ └── [9.3K] summary.json
│ │ └── [3.1K] style.css
│ └── [ 380] run.improve2.sh
├── [4.0K] part4
│ ├── [1.4K] run.poc.sh
│ └── [2.1K] write_exploit.c
├── [3.6K] README.md
├── [4.5M] report.pdf
└── [4.0K] resources
├── [275K] Coverage_comparison_graphs1.png
└── [1.1M] Coverage_comparison_graphs2.png
38 directories, 159 files