Skip to main content

Magikarp Ground Mission picoCTF 2021 Solution

SSH into a remote instance and piece together a flag split across multiple directories.

Published: April 2, 2026Updated: August 13, 2026

Description

Do you know how to move between different directories and read files in the shell? SSH into the instance to retrieve a 3-part flag.

SSH

SSH into the provided instance using the credentials given on the challenge page.

bash
ssh <user>@<host> -p <PORT>

Solution

Want to try it yourself first?

The guided walkthrough reveals hints one step at a time.

Walk me through it
  1. Step 1Read part 1
    Observation
    The description says the flag comes in three parts over SSH, and an SSH session lands you in the home directory. So check there for a flag file the moment you log in.
    After logging in, part 1 of the flag is in your home directory. The file also tells you where to find part 2.
    bash
    cat 1of3.flag.txt
    What didn't work first

    Tried: Running 'ls' without arguments and not seeing the file, then assuming it is hidden and trying 'ls -a' to look for a dotfile like '.flag.txt'

    The file is called 1of3.flag.txt, not a dotfile, so a plain ls shows it. The confusion comes from CTF challenges that do hide files behind a leading dot. Here the name is fully visible and cat works straight away.

    Tried: Using 'find . -name flag.txt' to locate the flag file instead of reading 1of3.flag.txt directly

    find returns nothing because the file is named 1of3.flag.txt, not flag.txt. A wildcard search would match, but even then it only finds part 1. The path hints inside each file are the intended navigation, not a filesystem search.

    Learn more

    SSH (Secure Shell) is a cryptographic network protocol that provides secure remote access to a machine over an unsecured network. When you log in via SSH, your shell session starts in your home directory - typically /home/username on Linux systems. Files placed in the home directory are immediately accessible without any path prefix.

    The cat command (short for "concatenate") reads a file and prints its contents to standard output. It's the most direct way to view the contents of small text files in a terminal. The convention of hiding hints inside the files themselves is common in CTFs - each clue leads you to the next location.

  2. Step 2Read part 2
    Observation
    1of3.flag.txt carries a path hint pointing at the root of the filesystem. So read 2of3.flag.txt from there, using an absolute path.
    Part 2 is located at the root of the filesystem. Navigate there and read it.
    bash
    cat /2of3.flag.txt
    What didn't work first

    Tried: Running 'cd /' then 'cat 2of3.flag.txt' as a two-step sequence instead of using the absolute path directly

    Changing directory to / works, but it is unnecessary: an absolute path reads the file from any working directory. The two-step approach also leaves your shell sitting in /, which causes confusion when the next clue sends you back to the home directory.

    Tried: Looking for the file under /home or /root instead of directly at / because files directly in the root directory are unusual

    Storing data files at / is unusual on a real system, but the challenge puts 2of3.flag.txt there deliberately, to make the point that the root directory is just another location. ls / shows the file sitting alongside /bin, /etc, and /home.

    Learn more

    The root directory (/) is the top of the Linux filesystem hierarchy - every file and directory on the system lives somewhere under /. Unlike Windows, which has separate drive letters like C:\, Linux uses a single unified tree. The / prefix in a path makes it absolute, meaning it starts from the root regardless of your current working directory.

    Common top-level directories include /home (user home directories), /etc (system configuration), /bin and /usr/bin (executables), and /tmp (temporary files). Files placed directly at / are unusual outside of CTF challenges.

  3. Step 3Read part 3
    Observation
    2of3.flag.txt points back to the home directory, and the shell may have drifted to / on the previous step. The ~ shorthand reads 3of3.flag.txt without an explicit cd.
    Part 3 is back in your home directory (~). Read it and assemble all three parts into the full flag.
    bash
    cat ~/3of3.flag.txt
    What didn't work first

    Tried: Using 'cat 3of3.flag.txt' as a relative path after navigating to / in the previous step, expecting it to work from the current directory

    If your shell is still sitting at / from exploring part 2, a bare relative path like '3of3.flag.txt' resolves to /3of3.flag.txt which does not exist. The file is in the home directory, so you need the absolute-style shorthand 'cat ~/3of3.flag.txt' or must first run 'cd ~' to return home before using a relative path.

    Tried: Trying to concatenate all three files at once with 'cat 1of3.flag.txt 2of3.flag.txt ~/3of3.flag.txt' from the home directory to get all parts in one shot

    The middle file lives at /2of3.flag.txt (root of the filesystem), so the bare path '2of3.flag.txt' resolves relative to your current directory and produces a 'No such file or directory' error. You need to use the absolute path: 'cat ~/1of3.flag.txt /2of3.flag.txt ~/3of3.flag.txt'.

    Learn more

    The tilde (~) is a shell shorthand that expands to the current user's home directory path. For example, if your username is ctfplayer, then ~/3of3.flag.txt expands to /home/ctfplayer/3of3.flag.txt. This shorthand works in any bash or zsh shell and is faster than typing the full absolute path.

    The challenge deliberately scatters the flag across three different locations - home directory, root (/), and back to home - to teach the fundamental skill of navigating a Linux filesystem. Understanding absolute paths (starting with /), relative paths (relative to current directory), and the ~ shorthand are all essential daily tools for any developer or security researcher working on Linux.

    Other useful navigation commands:

    • pwd - print working directory (shows where you currently are)
    • ls -la - list all files including hidden ones with details
    • cd - - jump back to the previous directory
    • find / -name "*.txt" - search the entire filesystem for .txt files
Interactive tools
  • Reverse Shell GeneratorGenerate reverse shell payloads (bash, nc, python, perl, ruby, php, node, powershell) and matching listeners. Set host and port once, copy any variant.
  • 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{xxsh_0ut_0f_\/\/4t3r_...}

The three flag files are split across different directory locations; each file tells you where to find the next one.

Key takeaway

SSH is the standard protocol for secure remote shell access; once connected, every Linux system exposes the same unified filesystem hierarchy rooted at /. Navigating that hierarchy using absolute paths, relative paths, and the ~ shorthand is a foundational skill for penetration testers, sysadmins, and CTF players alike. Incident responders and red teamers spend most of their time reading files scattered across /etc, /home, /tmp, and /var, so fluency with these navigation primitives carries directly into real-world work.

Related reading

Useful tools for General Skills

Where to go next