pngfixer is a lightweight CTF-focused Python script that allows you to resize PNG images by directly patching the IHDR chunk (width and height) and recalculating the CRC32 checksum. It validates the PNG signature and IHDR block before modification.
Perfect for CTF challenges involving:
- Polyglot files (e.g., PNG + ZIP, PNG + PHP)
- Image dimension spoofing (bypassing filters)
- Metadata manipulation
- Steganography or file inclusion bypass
No heavy dependencies — just pure binary patching.
- Validates PNG signature (
\x89PNG\r\n\x1a\n) - Checks IHDR chunk (length = 13, type =
IHDR) - Modifies width/height in IHDR
- Recalculates correct CRC32 for the chunk
- Zero image processing libraries (no PIL, no OpenCV)
- Installable as a global command on Kali Linux
- Kali Linux (or any Debian-based distro)
- Python 3 (default on Kali)
zlib→ built-insudoaccess for installation
-
clone this repository https://github.com/CR0M80/PNGFixer.git:
-
Grant execution permission to the installer:
cd PNGFixer chmod +x setup.sh -
Run the installer with sudo:
sudo ./setup.sh
pngfixer <input.png> --width <w in px> --height <h in px> -o <output.png>Syntax : pngfixer png_path --width new_width_px --height new_height_px -o new_file_path
| Argument | Required | Description |
|---|---|---|
png_path |
Yes | Input PNG file |
--width |
Yes | New width (> 0) |
--height |
Yes | New height (> 0) |
-o |
Yes | Output file path |
- Does NOT re-encode pixel data → image may appear corrupted in viewers
- Only modifies IHDR → other chunks (IDAT, etc.) remain unchanged
- Not for real image editing → use
convert,Pillow, orGIMP - Use in CTF only → may break legitimate PNGs
Pro Tip: Combine with
exiftool,binwalk, orsteghidefor full CTF workflow.
Remove the command globally:
sudo rm /usr/local/bin/pngfixer
Built for DFIR & STEGANOGRAPHY CTF players