|
| 1 | +--- |
| 2 | +title: "OverTheWire Bandit: Level 3 → Level 4" |
| 3 | +date: 2026-06-26 14:00:00 +0500 |
| 4 | +categories: [CTF, Bandit] |
| 5 | +tags: [linux, hidden-files, find, ls, overthewire, beginner] |
| 6 | +--- |
| 7 | + |
| 8 | +## The Goal |
| 9 | + |
| 10 | +The password is stored in a hidden file inside the `inhere` directory. |
| 11 | + |
| 12 | +## What I Did |
| 13 | + |
| 14 | +Logged in as `bandit3`, confirmed the `inhere` directory and navigated into it: |
| 15 | + |
| 16 | +```bash |
| 17 | +bandit3@bandit:~$ ls |
| 18 | +inhere |
| 19 | +bandit3@bandit:~$ cd inhere |
| 20 | +bandit3@bandit:~/inhere$ ls |
| 21 | +``` |
| 22 | + |
| 23 | +`ls` returned nothing. The directory looked empty. I knew the file had to be there somewhere so I ran `find`: |
| 24 | + |
| 25 | +```bash |
| 26 | +bandit3@bandit:~/inhere$ find |
| 27 | +. |
| 28 | +./...Hiding-From-You |
| 29 | +``` |
| 30 | + |
| 31 | +There it was. I tried `cd` into it out of habit, which failed as expected — it's a file not a directory. Then read it the same way as the dashed filename from Level 1: |
| 32 | + |
| 33 | +```bash |
| 34 | +bandit3@bandit:~/inhere$ cat "./...Hiding-From-You" |
| 35 | +``` |
| 36 | + |
| 37 | +That printed the password. |
| 38 | + |
| 39 | +## What Was Actually Happening |
| 40 | + |
| 41 | +In Linux, any file or directory whose name starts with a `.` is hidden from `ls` by default. It's a convention — not real security — designed to keep config files and system files out of the way so they don't clutter your view. The file was always there. `ls` just wasn't showing it. |
| 42 | + |
| 43 | +There are two ways to see hidden files: |
| 44 | + |
| 45 | +```bash |
| 46 | +ls -a |
| 47 | +``` |
| 48 | + |
| 49 | +The `-a` flag tells `ls` to show all files including hidden ones. This would have shown `...Hiding-From-You` directly. |
| 50 | + |
| 51 | +`find` works too — it searches recursively and lists everything it finds regardless of the dot convention. Running it with no arguments searches the current directory and prints every path including hidden files. |
| 52 | + |
| 53 | +## What I Was Confused About |
| 54 | + |
| 55 | +I wasn't sure what "hidden" actually meant in Linux. I assumed it might involve some kind of access restriction or encryption. It turned out to be much simpler — just a naming convention. A dot at the start of the filename is all it takes to hide something from a basic `ls`. |
| 56 | + |
| 57 | +I also tried `cd` into the file again out of habit. Still doesn't work. Files are files, directories are directories. |
| 58 | + |
| 59 | +## What I Learned |
| 60 | + |
| 61 | +**Hidden files start with `.`** — this is how Linux stores config files like `.bashrc` and `.ssh` without cluttering your home directory view. |
| 62 | + |
| 63 | +**`ls -a` reveals everything** — the `-a` flag stands for "all." Always use it when you suspect hidden files. |
| 64 | + |
| 65 | +**`find` with no arguments** lists all files recursively from the current directory, hidden or not. More powerful than `ls` for searching. |
| 66 | + |
| 67 | +**The `./` trick from Level 1 applies again** — any filename with special characters at the start needs an explicit path so the shell doesn't misinterpret it. |
| 68 | + |
| 69 | +## Commands Used |
| 70 | + |
| 71 | +| Command | What it did | |
| 72 | +|---|---| |
| 73 | +| `ls` | Showed nothing — hidden file not displayed | |
| 74 | +| `cd inhere` | Navigated into the target directory | |
| 75 | +| `find` | Listed all files including hidden ones | |
| 76 | +| `cat "./...Hiding-From-You"` | Read the hidden file using explicit path | |
0 commit comments