Skip to content

Instantly share code, notes, and snippets.

@robbie01
Last active November 15, 2025 08:43
Show Gist options
  • Select an option

  • Save robbie01/a476ef6669e983cc9098a3599a9df2ae to your computer and use it in GitHub Desktop.

Select an option

Save robbie01/a476ef6669e983cc9098a3599a9df2ae to your computer and use it in GitHub Desktop.
beezchurger writeup (BuckeyeCTF 2025)

forensics / beezchurger

499 points | 7 solves

Description:

Full mind of mind, Empty belly of belly
You have recieved a gift.
beezchurger

Challenge author: gammascreed

Files: beezchurger.gif


Abstract / TL;DR

Each frame's palette is a permutation of frame 0's palette. Specifically, each frame's palette is rotated rightward with respect to frame 0's. The number of rightward rotations is an ASCII character code.


Solution

See main.rs


Invocation

robbie@macbook beezchurger % cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/beezchurger`
bctf{He_chilll_like_thatt}
[package]
name = "beezchurger"
version = "0.1.0"
edition = "2024"
[dependencies]
gif = "0.13"
use std::{collections::BTreeMap, fs::File};
fn main() {
// Initialize the GIF decoder
let opts = gif::DecodeOptions::new();
let f = File::open("beezchurger.gif").unwrap();
let mut decoder = opts.read_info(f).unwrap();
// Declare RGB to index map
let mut rgb_to_index = None::<BTreeMap<_, _>>;
// Begin iterating frames
while let Some(frame) = decoder.read_next_frame().unwrap() {
// Get current frame's palette in threes
let (pal, []) = frame.palette.as_ref().unwrap().as_chunks::<3>()
else { unreachable!() };
// Build RGB->index map if not already built (i.e. this is frame 0)
let rgb_to_index = rgb_to_index.get_or_insert_with(||
pal.iter().copied().enumerate().map(|(i, x)| (x, i)).collect());
// Find number of rightward rotations (assumes 256-color palette)
let c = (256 - rgb_to_index[&pal[0]]) as u8 as char;
print!("{c}");
}
// For courtesy :)
println!();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment