Logo

Fuzyll


Hopelessly passionate husband, engineer, hacker, gamer, artist, and tea addict.


The Alpha Molecule

I wrote a challenge for Ghost in the Shellcode this year titled The Alpha Molecule. I gave participants a raw WAV file and simply told them to find the flag.

Most participants didn't know what to do at first:

[05:02.23] <hyperd> hi there.. any tip for the alpha molecular??
[05:07.22] <hyperd> hmmm I think I found something :)
[05:24.11] <hyperd> is it a RIFF file inside a RIFF file ? scattered across? i searched for each 2 bytes of the header and i find them across :/

Some caught on, but didn't know the trick:

[22:35.06] <ZY> what tool should use to analyze audio file ?
[22:35.57] <_aegis_> binwalk
[22:36.10] <AlcariTheMad> always binwalk binary files
[22:36.10] <_aegis_> that aside, it looks *awesome* in baudline
[22:37.09] <_aegis_> major props to the waveform. it's seriously art.

But, some figured it out (and a select few even knew where the idea had come from)!

If you missed it (or couldn't figure out how to solve it), I've posted a video of Rusty Wagner's's solution on YouTube:

In a nutshell: If you place an oscilloscope (or a program acting like one) into X-Y mode, the signal will create shapes on your screen. If you wait long enough, you'll see the flag ("AREYOUHAVINGOSCILLOFUN") displayed (it's around 1:08)!

When you place an oscilloscope in X-Y mode, panning in the left speaker will increase horizontal deflection. Panning in the right speaker will increase vertical deflection. If you take a waveform, split it between each speaker, and play it in each (with some differences), you can draw shapes! For example, playing a square wave with different phases (one perfectly offset from the other) in each speaker will give you a 2D square. Doing the same with a sine wave will produce a 2D circle.

For 3D shapes, it turns out you can use linear algebra to manipulate lines and points (very much like how a video game engine renders 3D models to 2D scenes that are passed to your video card). I'm not taking credit for this (or the letters) - Rusty figured this stuff out before me. I simply manipulated our respective shapes with filters (and/or carrier signals) to create something pleasing (hopefully!) to the eye and ear.

You might be wondering, "How can this still look the way it does when you're constantly changing notes?" The key insight is that only the shape, panning, and magnitude of the waveform(s) matter. Nothing else. The shape will determine how it looks. The panning will determine its location and orientation. The magnitude will determine how large or small it's drawn. Changing the frequency (note) simply does nothing (for your eyes, anyway). I can play a waveform that looks like a cube at any frequency and you'll still see the same cube.

Pretty neat, huh? If you're interested in the code for Rusty's solution, you can find it here. It's written in C++ and uses SDL for rendering. Also check out Ymgve's PNG-based solution, which I thought was really creative (and required very little code on his part).

UPDATE (2015-02-01): Someone from h4x0rpsch0rr took my song and played it on a real oscilloscope! In case anyone doubted me: It works!