Description
Find uber-secret.txt hidden somewhere inside the provided archive. Hidden directories (those prefixed with a dot) might conceal the answer.
Setup
Download the archive and extract it. Grep can inspect the expanding tree faster than manual browsing.
Hidden directories (prefixed with .) appear once the archive is unzipped, so make sure your shell shows them.
wget https://artifacts.picoctf.net/c/500/files.zipunzip files.zip && rm files.zipSolution
Want to try it yourself first?
The guided walkthrough reveals hints one step at a time.
Step 1Locate the hidden folder
ObservationThe description mentions dot-prefixed hidden directories. A recursive content search finds the file faster than walking several levels of nesting by hand.Once unzipped, the structure includes .secret nested multiple levels deep. Rather than traversing each directory by hand, let grep reveal which file mentions picoCTF.bashgrep -R picoExpected output
files/adequate_books/more_books/.secret/deeper_secrets/deepest_secrets/uber-secret.txt:picoCTF{f1nd_15_f457_ab44...}What didn't work first
Tried: Run
ls -Rto explore the directory tree manually before searching for the flagA recursive listing prints every path and no contents, so you still open each candidate one at a time, which does not scale across several levels of nesting. A recursive grep searches contents in one pass and returns the path and the matching line together.
Tried: Use
find . -name uber-secret.txtto locate the file without grepfind works here because you happen to know the filename, and in most challenges you do not: names are unknown or deliberately misleading. Searching contents finds the file from a string inside it, which generalizes.
Learn more
In Unix-like systems, any file or directory whose name begins with a dot (
.) is treated as hidden. These entries are excluded from the default output oflsand most file browsers, but they are fully accessible if you know the name or use flags likels -a(show all). This convention is commonly used for configuration directories (~/.ssh,~/.config) and is a classic hiding spot in CTF challenges.The recursive grep approach bypasses the need to navigate the directory tree at all.
grep -R pico .opens every file in every directory (including hidden ones) and prints matching lines. Because the flag starts withpicoCTF, the patternpicois broad enough to match it without needing to know the exact flag format in advance.In a real security context, analysts use exactly this approach to search for sensitive strings (passwords, API keys, PII) across a file system during a code audit or incident response. Tools like trufflehog, gitleaks, and semgrep automate this at scale for large repositories, but knowing the underlying grep mechanics helps you understand what those tools are doing and catch cases they miss.
Step 2Inspect uber-secret.txt
ObservationThe grep output names the file alongside the matching text. Read it directly to confirm the exact contents.Grep output shows that files/adequate_books/more_books/.secret/deeper_secrets/deepest_secrets/uber-secret.txt contains the flag. Read it directly to confirm.bashcat files/adequate_books/more_books/.secret/deeper_secrets/deepest_secrets/uber-secret.txtExpected output
picoCTF{f1nd_15_f457_ab44...}Learn more
Once grep reveals the full path,
catreads and prints the file contents. The deeply nested path (adequate_books/more_books/.secret/deeper_secrets/deepest_secrets/) demonstrates how archives can be structured to make manual browsing impractical - there are simply too many directories to check one by one.The hidden directory name
.secretis a common CTF convention inspired by real-world hidden directories. On Linux systems, the.sshdirectory stores private keys,.bash_historystores command history, and.gnupgstores GPG keys - all sensitive files that rely partially on the "hidden by convention" mechanism for obscurity. Attackers know to check these locations first.The takeaway is that security through obscurity alone - hiding files in unusual places or giving them inconspicuous names - is not a reliable defense. Any tool that reads the file system recursively (grep, find, Autopsy) will discover the file regardless of its depth or name. Real security requires access controls, encryption, or both.
Step 3Trim the output
ObservationThat output carries a path prefix in front of the flag. A second grep with -oE extracts just the token.If you only want the flag text, pipe grep through an extractor such as grep -oE, cut, or sed to strip away the path prefix.bashgrep -R pico | grep -oE 'picoCTF\{.*\}' --color=noneExpected output
picoCTF{f1nd_15_f457_ab44...}What didn't work first
Tried: Use
grep -R pico | cut -d: -f2to strip the filename prefix and print only the flag lineSplitting on the first colon assumes the path contains none, which is not guaranteed, and cut then splits in the wrong place. A regex matching the flag token itself works regardless of the surrounding punctuation.
Tried: Omit
--color=noneand pipe the result directly into a script or fileGNU grep does not colorize at all unless asked, and the usual distro alias asks for --color=auto, which drops the codes when stdout is not a terminal. But many shells alias grep to --color=always, and then the ANSI bytes do survive a pipe or a redirect, so a comparison or a paste into the submission form fails for no visible reason. Forcing --color=none makes the output deterministic either way.
Learn more
When grep finds a match inside a named file, it outputs the result in the format
filename:matching_line. The nested grep with-oand an extended regex extracts only the portion of the line that matchespicoCTF\{.*\}. The.*inside the braces is a greedy match that captures everything between the opening and closing brace.The
--color=noneflag forces ANSI escape codes off. GNU grep emits none by default, and the common shell alias of--color=autosuppresses them whenever the output is not a terminal, but a shell alias of--color=alwaysoverrides that and leaks the codes into whatever you pipe or redirect into. Terminal color codes are invisible on screen and would corrupt the text if processed further.This kind of double-grep pipeline (first to find relevant lines, then to extract exactly the right token) appears constantly in CTF automation scripts. Once you internalize it, you can adapt it to extract any structured pattern from noisy output: IP addresses, URLs, email addresses, UUIDs, and more. The same pattern is used in log parsing, threat intelligence extraction, and security automation.
Interactive tools
- Regex TesterTest regular expressions against a string with live match highlighting, flag toggles, and common CTF pattern shortcuts.
- Strings ExtractorPull printable text from any binary, library, or image. ASCII and UTF-16 detection, configurable minimum length, flag-like highlight, no command line needed.
Flag
Reveal flag
picoCTF{f1nd_15_f457_ab44...}
Once you know the hidden directory path, viewing uber-secret.txt prints the precise flag shown by grep.