Skip to content
CR0M80Public

About

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.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

PNGFixer - CTF-Oriented PNG Resizer Tool

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.

Features

  • 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

Requirements

  • Kali Linux (or any Debian-based distro)
  • Python 3 (default on Kali)
  • zlib → built-in
  • sudo access for installation

Installation (Step-by-Step)

  1. clone this repository https://github.com/CR0M80/PNGFixer.git:

  2. Grant execution permission to the installer:

    cd PNGFixer
    chmod +x setup.sh
  3. Run the installer with sudo:

    sudo ./setup.sh

Usage in CTF

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

Limitations & Warnings

  • 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, or GIMP
  • Use in CTF only → may break legitimate PNGs

Pro Tip: Combine with exiftool, binwalk, or steghide for full CTF workflow.

Uninstallation

Remove the command globally:

sudo rm /usr/local/bin/pngfixer

Authors

Built for DFIR & STEGANOGRAPHY CTF players

About

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.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages