← Bandit Solutions

Level 3 → Level 4 Walkthrough

Level 3 → Level 4

Completed

📋 Level Information

Host: bandit.labs.overthewire.org
Port: 2220
Username: bandit3
Password: aBZ0W5EmUfAf7kHTQeOwd8 bauFJ2lAiG

🎯 Level Goal

The password for the next level is stored in a hidden file in the inhere directory.

Challenge: Find and read a file that starts with a dot (.), which makes it hidden in normal directory listings.

🔧 Solution Steps

Step 1: Connect to Bandit3

Use the password from Level 2 to log in:

ssh bandit3@bandit.labs.overthewire.org -p 2220

Password: aBZ0W5EmUfAf7kHTQeOwd8bauFJ2lAiG

Step 2: Explore the Directory

Check what's in the home directory:

ls

You should see a directory called inhere

Step 3: Navigate to the inhere Directory

Change into the inhere directory:

cd inhere

Step 4: List All Files (Including Hidden Ones)

Use the -a flag to show hidden files:

ls -la

Output will show something like:

total 12
drwxr-xr-x 2 root    root    4096 May  7  2020 .
drwxr-xr-x 3 root    root    4096 May  7  2020 ..
-rw-r----- 1 bandit4 bandit3   33 May  7  2020 .hidden

Step 5: Read the Hidden File

Read the .hidden file to get the password:

cat .hidden

Step 6: Get the Password

The file contains the password for Level 4:

2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe

💡 Explanation

This level introduces hidden files in Linux systems.

What are Hidden Files?

  • In Linux, files starting with a dot (.) are hidden
  • They don't appear in normal ls listings
  • Common hidden files: .bashrc, .profile, .ssh/

Key Commands Used:

  • ls -la - Lists all files (including hidden) with details
  • cd - Changes directory
  • cat - Displays file contents

Understanding ls Options:

  • -l - Long format (detailed listing)
  • -a - All files (including hidden)
  • -la - Combines both options

⚠️ Common Mistakes

  • Using only ls: Won't show hidden files
  • Forgetting the dot: Hidden files must be referenced with their leading dot
  • Wrong directory: Make sure you're in the inhere directory

💡 Pro Tips

  • You can use ls -A to show hidden files but exclude . and ..
  • Tab completion works with hidden files too: type cat .h then press Tab
  • Hidden files are often used for configuration and sensitive data
  • You can create your own hidden files by naming them with a dot prefix

🔄 Alternative Methods

Method 2: Using Wildcards

You can use wildcards to match hidden files:

cat .*

Warning: This will try to read ALL hidden files, including . and .. which are directories

Method 3: Using find Command

Find all files in the current directory:

find . -type f -name ".*"
← Previous Level Next Level →