← Bandit Solutions

Level 5 → Level 6 Walkthrough

Level 5 → Level 6

Completed

📋 Level Information

Host: bandit.labs.overthewire. org
Port: 2220
Username: bandit5
Password: lrIWWI6bB37kxfiCQZqUdOI Yfr6eEeqR

🎯 Level Goal

The password for the next level is stored in a file somewhere under the inhere directory and has the following properties:

  • Human-readable
  • 1033 bytes in size
  • Not executable

🔧 Solution Steps

Step 1: Connect to Bandit5

Use the password from Level 4 to log in:

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

Password: lrIWWI6bB37kxfiCQZqUdOIYfr6eEeqR

Step 2: Navigate to the inhere Directory

Change into the inhere directory:

cd inhere

Step 3: Use find Command with Specific Criteria

Search for files with the exact properties:

find . -type f -size 1033c ! -executable

Command breakdown:

  • find . - Search in current directory and subdirectories
  • -type f - Only look for files (not directories)
  • -size 1033c - File size exactly 1033 bytes
  • ! -executable - Not executable

Step 4: Read the Found File

The find command will return the path to the file. Read it:

cat ./maybehere07/.file2

Step 5: Get the Password

The file contains the password for Level 6:

P4L4vucdmLnm8I7Vl7jG1ApGSfjYKqJU

🔄 Alternative Methods

Method 2: Using file command with find

Combine find with file to verify it's human-readable:

find . -type f -size 1033c ! -executable -exec file {} +

Method 3: Manual search with ls and file

If you want to explore manually:

ls -la
cd maybehere00
ls -la
file .file2
# Check size with: ls -la .file2
# Repeat for each directory

💡 Explanation

This level introduces advanced file searching with the find command.

Find Command Options:

  • -type f - Search for files only
  • -size 1033c - Size in bytes (c = bytes, k = kilobytes, M = megabytes)
  • ! -executable - NOT executable (the ! negates the condition)
  • -exec - Execute a command on found files

File Size Notation:

  • 1033c - Exactly 1033 bytes
  • +1033c - Larger than 1033 bytes
  • -1033c - Smaller than 1033 bytes
  • 1033k - 1033 kilobytes

Why These Specifics Matter:

  • There are many files in subdirectories
  • Multiple files might have similar properties
  • The exact combination makes the file unique

⚠️ Common Mistakes

  • Wrong size unit: Using 1033 without 'c' might interpret as blocks
  • Forgetting the negation: Using -executable instead of ! -executable
  • Not searching recursively: The file is in a subdirectory
  • Case sensitivity: Options are case-sensitive

💡 Pro Tips

  • You can chain multiple conditions: find . -type f -size 1033c ! -executable -name "*.txt"
  • Use find . -ls to see detailed information about found files
  • The -exec option can directly read the file: find . -type f -size 1033c ! -executable -exec cat {} \;
  • Practice with different find options to become proficient
← Previous Level Next Level →