DEV Community

CTFDojo
CTFDojo

Posted on Edited on Originally published at ctfdojo.com

picoCTF Static ain't always noise Writeup: Find the Flag in a Binary with strings

You get a binary named static and a BASH script, ltdis.sh. The flag is stored as a plain string inside the binary, so strings static | grep picoCTF prints it. The script runs objdump and strings for you and saves the results to text files.

  • Platform: picoGym (picoCTF 2021)
  • Category: General Skills
  • Difficulty: Beginner
  • Tools: stringsgrepobjdump

Challenge description

Binary files look like noise in a text editor, but any text a program contains is stored as readable bytes somewhere inside it.

"Can you look at the data in this binary: static? This BASH script might help!" — provided: static, ltdis.sh

Step 1 — Search the binary for printable strings

strings prints every run of printable characters in a file (4 or more by default). Filter for the flag format:

$ strings static | grep picoCTF
picoCTF{***}
Enter fullscreen mode Exit fullscreen mode

That's the solve — the flag sits in the binary's data section as an ordinary string.

Step 2 — Or use the provided script

ltdis.sh wraps the same idea: it disassembles the binary with objdump and extracts its strings into text files next to it. Make it executable and point it at the binary:

$ chmod +x ltdis.sh
$ ./ltdis.sh static
$ ls
ltdis.sh  static  static.ltdis.strings.txt  static.ltdis.x86_64.txt
$ grep picoCTF static.ltdis.strings.txt
Enter fullscreen mode Exit fullscreen mode

Reading the script first (cat ltdis.sh) is a good reflex: it shows exactly which commands it runs before you run it.

🚩 picoCTF{ flag intentionally hidden }

The flag is deliberately hidden — follow the method, you've earned it. 💪

Key takeaways

The challenge's title says it all: "static" binary data isn't always noise.

  • strings file | grep pattern is the first thing to try on any binary
  • Text a program prints or stores is usually kept as plain bytes inside the file
  • Read helper scripts before running them — they show the underlying commands

Originally published on CTFdojo — join the CTFdojo Discord to discuss writeups and get notified about new ones.

Top comments (0)