Othmane Moutaouakkil
LinkedInGitHub
  • Introduction
  • OSCP Journey
    • HTB
      • HTB Linux Boxes
      • HTB Windows Boxes
  • Write-Ups
    • TCM Security
      • Practical Ethical Hacking
        • Networking Refresher
        • The Ethical Hacker Methodology
        • Information Gathering (Reconnaissance)
        • Scanning & Enumeration
        • Vulnerability Scanning with Nessus
        • Exploitation Basics
        • New Capstone
        • Active Directory (AD)
          • AD Overview
          • AD Lab Build
          • Attacking AD: Initial Attack Vectors
          • Attacking AD: Post-Compromise Enumeration
          • Attacking AD: Post-Compromise Attacks
          • We've Compromised the Domain - Now What?
          • Additional AD Attacks
          • AD Case Studies
        • Post Exploitation
        • Web Application Enumeration, Revisited
        • Find & Exploit Common Web Vulnerabilities
        • Wireless Penetration Testing
        • Legal Documents and Report Writing
      • Open-Source Intelligence (OSINT)
    • Hacking Challenges
      • OTW
        • Bandit
          • Level 0
          • Level 0 → 1
          • Level 1 → 2
          • Level 2 → 3
          • Level 3 → 4
          • Level 4 → 5
          • Level 5 → 6
          • Level 6 → 7
          • Level 7 → 8
          • Level 8 → 9
          • Level 9 → 10
          • Level 10 → 11
          • Level 11 → 12
          • Level 12 → 13
          • Level 13 → 14
          • Level 14 → 15
          • Level 15 → 16
          • Level 16 → 17
          • Level 17 → 18
          • Level 18 → 19
        • Natas
        • Leviathan
        • Krypton
        • Narnia
        • Behemoth
        • Utumno
        • Maze
        • Vortex
        • Manpage
        • Drifter
        • FormulaOne
      • THM
  • Research
  • Resume
Powered by GitBook
On this page
  • Level Goal
  • Write-Up
  • Lessons Learned

Was this helpful?

  1. Write-Ups
  2. Hacking Challenges
  3. OTW
  4. Bandit

Level 6 → 7

PreviousLevel 5 → 6NextLevel 7 → 8

Last updated 7 months ago

Was this helpful?

Level Goal

The password for the next level is stored somewhere on the server and has all of the following properties:

  • owned by user bandit7

  • owned by group bandit6

  • 33 bytes in size

Write-Up

  1. Find the file with the specified properties:

find / -user bandit7 -group bandit6 -size 33c 2>/dev/null
  • find /: Start searching from the root directory

  • -user bandit7: look for files owned by user bandit7

  • -group bandit6: Look for files owned by group bandit6

  • -size 33c: Look for files exactly 33 bytes in size

  • 2>/dev/null: Redirect error messages to /dev/null to avoid cluttering the output

This command reveals /var/lib/dpkg/info/bandit7.password as the target file.

  1. Display the file content:

cat $(find / -user bandit7 -group bandit6 -size 33c 2>/dev/null)

Or

cat /var/lib/dpkg/info/bandit7.password

The password retrieved: morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj

  1. Access the next level:

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

Enter the password when prompted.

Lessons Learned

  • The find command can search based on multiple criteria simultaneously

  • Redirecting errors to /dev/null helps clean up output

  • System files can be located in unexpected places

  • Precise file properties can be used to locate specific files

-- Othmane

find / -user bandit7 -group bandit6 -size 33c 2>/dev/null
cat $(find / -user bandit7 -group bandit6 -size 33c 2>/dev/null)
cat /var/lib/dpkg/info/bandit7.password