speeds and feeds picoCTF 2021 Solution

Published: April 2, 2026

Description

There is something on my network running at mercury.picoctf.net:16524. Connect and figure out what it is.

Remote

Connect to the service and save its output to a file.

Sanity-check the file looks like real G-code before opening a viewer.

bash
nc mercury.picoctf.net 16524 > output.gcode
bash
head output.gcode  # expect lines starting with G0/G1 X.. Y..
  1. Step 1Identify the output format
    Open output.gcode in a text editor. You will see lines beginning with G0 and G1 followed by X and Y coordinates. This is G-code - the programming language used to control CNC machines and 3D printers. G0 is a rapid move, G1 is a controlled cut/draw move.
    Learn more

    G-code (also called RS-274) is a numerical control language developed in the 1950s. It describes toolpaths as sequences of X/Y/Z coordinates and motion commands. G0 is a rapid positional move (pen up equivalent), and G1 is a linear feed move (pen down - actually cutting or drawing). The toolpath traced by G1 moves spells out the flag.

    G-code in the real world: CNC (Computer Numerical Control) machines use G-code to control mills, lathes, plasma cutters, laser cutters, and 3D printers. The same RS-274 standard from the 1950s is still in use today on industrial equipment, though with manufacturer-specific extensions. 3D printer firmware like Marlin and Klipper interpret G-code directly - when you "slice" a 3D model in software like Cura or PrusaSlicer, the output is a .gcode file containing hundreds of thousands of G1 move commands describing the printer's exact path.

    Title hint - "speeds and feeds": In machining, "speeds and feeds" refers to spindle speed (RPM) and feed rate (how fast the cutting tool moves through the material). These are the two primary parameters a machinist controls. The title references this vocabulary to hint that the data is CNC-related without directly saying "G-code." Recognizing domain-specific vocabulary is a useful CTF skill - challenge titles often contain the key clue.

  2. Step 2Visualize in NCViewer
    Go to ncviewer.com in your browser. Paste the contents of output.gcode into the editor. The viewer renders the CNC toolpath graphically - the connected G1 moves trace the flag letters on screen.
    Learn more

    NCViewer (ncviewer.com) is a free online G-code visualizer. It renders toolpaths as lines on a 2D canvas, making it trivial to read any text or shapes drawn by the machine. NCViewer supports standard RS-274 commands - G0 (rapid), G1 (linear feed), G2 (clockwise arc), and G3 (counterclockwise arc) - which is what this challenge uses. Machine-specific extensions like G38 (probing) will not render; if the file uses those, switch to a fuller-featured viewer.

    Coordinate units. NCViewer auto-scales the path to fit, so the output should always be visible. If the rendered path looks tiny or absurdly huge, switch the unit setting in NCViewer (mm vs inches) - some servers emit metric, others imperial.

    Output integrity. If head output.gcode shows non-G-code text or the file is empty, the connection dropped before the server finished. Reconnect and redirect again before opening the viewer.

    This challenge demonstrates that data encoding does not have to involve traditional ciphers - any format that encodes information visually or spatially can be used to hide a flag. Recognizing the format (G-code vs. coordinates vs. vectors) is the key first step.

    Offline alternatives: CAMotics (full CNC simulator), the GCode Viewer extension for VS Code, or a 30-line Python script using matplotlib to plot consecutive G1 X/Y points - all render locally without depending on a website.

Flag

picoCTF{...}

G-code describes CNC toolpaths in X/Y coordinates - visualizing them in a viewer reveals the flag drawn as a connected path.

Want more picoCTF 2021 writeups?

Tools used in this challenge

Related reading

What to try next