Skip to content
Adam Omar Saleh

PINK CTF placeholder badge (unofficial)PINK CTFMisc

Cluck Cluck

Everything you can hear is a decoy. The two least significant bits of each sample hide a CHKN blob containing a program in the Chicken esolang.

Competition
PINK CTF placeholder badge (unofficial)PINK CTF
Category
MiscHard · estimated
Source status
Source-documented · not platform-verified
Document
PDF edition2 min read

Brief

The challenge

Category
esolang, audio
Points
100
Author
admin5559 & QWERTZ
File
chicken.wav

What does the Chicken say?

Challenge page
Challenge page

TL;DR

Everything you can hear is a decoy. The two least significant bits of each sample hide a CHKN blob containing a program in the Chicken esolang. Running it prints a harmless "self-test" banner. The flag is pushed character by character inside code blocks that execution always jumps over.

Text
WAV 2-bit LSBs → "CHKN" + length + Chicken source → never-executed pushes → flag

01

The audible decoys

The file is 60 s of 16-bit stereo audio at 44.1 kHz. It contains three things, none of which carries data:

  • a constant A-major chord (220, 277.18, 329.63 and 440 Hz) whose volume slowly swells up and down

  • flat white noise

  • 22 short "clucks", chirps every 2.75 s whose pitch climbs by about 4950 Hz each time and folds back at the Nyquist frequency

Whitened spectrogram: the clucks
Whitened spectrogram: the clucks
The chord, which stays constant for 60 s
The chord, which stays constant for 60 s

02

The low bits

The low 2 bits of the samples are far from random. The left channel's LSB averages 0.31 for the first ~52 s and 0.50 afterwards, and the low bits repeat a short 16-sample pattern. That's what sequential LSB embedding of repetitive data looks like (WavSteg / stego-lsb with 2 LSBs).

Reading 2 bits from every sample (L and R interleaved), with the first sample supplying the lowest bit pair of each byte:

Text
b'CHKN' 33 c1 11 00  chicken chicken chicken chicken ...

That's the magic CHKN, then a little-endian length of 1,163,571 bytes, then a Chicken program of 2276 lines.

03

Chicken

In Chicken, the number of chicken words on a line is the opcode: 0 axe, 1 chicken, 2 add, 3 fox, 4 rooster, 5 compare, 6 pick, 7 peck, 8 fr (conditional relative jump), 9 BBQ (number to char), and n ≥ 10 pushes n − 10. Code and stack share one memory array, and the program's output is the top of the stack when it exits.

With a small interpreter (chicken.py), the program prints:

Text
        POULTRY COMPUTATION ENGINE v3.1...[01] triangular(20) ........ OK...Nothing suspicious detected.

04

Dead code

Tracing which addresses actually run shows 321 instructions that are never executed. Every push 1; push N; fr (an always-taken jump) skips one of two kinds of block:

  • FAIL\n builders, which would run if a self-test failed

  • junk blocks of random opcodes with printable pushes mixed in

Reading the printable pushes in the junk blocks in order:

Text
PINK{Cl | uck_Clu | c k _you_ | are_a_d | uck!}

One k is hidden as the word right after a pick. Since that code never runs, the word 117 is really its own instruction, push 107 (k). Scanning the dead code word by word, without pairing pick with its operand, and dropping the FAIL paths gives the flag.

Solve script

solve.py extracts the program, runs it, traces execution and prints the hidden characters:

Text
hidden: PINK{ClFAILuck_CluFAILck_you_FAILare_a_dFAILFAILuck!}flag  : PINK{Cluck_Cluck_you_are_a_duck!}

Flag

Flag

PINK{Cluck_Cluck_you_are_a_duck!}

Source-documented · not platform-verified

PDF edition

Writeup PDF

Formatted edition of this walkthrough, built from my source notes · 4 pages.