🕶️
VICEINTELPRO
GitHub: HorrorClause
  • In Tenebris Videmus
  • 🚩CTFs
    • 💾Hack the Box
      • 🏫Academy
        • Command Injection Assessment
        • XSS Assessment
        • Web Attacks Assessment
    • Try Hack Me
      • In Progress
  • 📖Documents
  • 👨‍🏫HOW-TOs
    • Obisidian How-To
    • Setup Mandiant FLARE VM
  • 📑Security Fundamentals
    • Security Controls
      • Physical Security
      • Endpoint Security
      • Email Security
      • Network Security
      • AAA Controls
    • Networking 101
      • OSI Model
      • Network Fundamentals
      • Network Devices
      • Network Tools
      • Protocols and Ports
    • 👨‍💼Management Principles
      • Risk
      • Policies and Procedures
      • Compliance and Frameworks
      • Change and Patch Management
  • 🛡️Security Concepts
    • ⚠️Risk Assessment Models
      • DREAD Risk Assessment Model
      • STRIDE Threat Model
      • Common Vulnerability Scoring System (CVSS)
    • Pentesting
      • Common Terms
      • AV Identification-Evasion
      • Introduction to Payloads
      • Automating Payloads & Delivery with Metasploit
      • Shells Jack Us In, Payloads Deliver Us Shells
      • Web Shells
      • Pentesting Overview
      • Penetration Testing Process
    • 🐛Vulnerability Assessment
      • Common Vulnerabilities and Exposures (CVE)
      • Common Vulnerability Scoring System (CVSS)
      • Assessment Standards
      • Vulnerability Assessment
      • Vulnerability Scanning
      • Reporting
      • 🎯Nessus
        • Getting Started with Nessus
        • Nessus Scan
        • Working with Nessus Scan Output
        • Advanced Settings
        • Scanning Issues
      • 🦴OpenVAS (Greenbone)
        • Getting Started with OpenVAS
        • OpenVAS
        • Exporting Results
    • Passwords
      • Password Managers
      • Password Policies
      • Password Security Fundamentals
    • Frameworks
    • GRC
    • Logon Types
    • What is Dev-Null ?
  • ⚔️Offensive Security
    • OSINT
      • OSINT - Websites
      • Google Dorks
    • 🔫Attacking Common Services
      • The Concept of Attacks
      • Interacting with Common Services
      • Finding Sensitive Information
      • Attacking DNS
      • Attacking Email Services
      • Attacking FTP
      • Attacking RDP
      • Attacking SMB
      • Attacking SQL Databases
      • Cheat Sheet - Attacking Common Services
      • Service Misconfigurations
    • 🔪Attacking Web Apps with Ffuf
      • Web Fuzzing
      • Directory Fuzzing
      • Page Fuzzing
      • Recursive Fuzzing
      • DNS Records
      • Sub-domain Fuzzing
      • Vhost Fuzzing
      • Filtering Results
      • Parameter Fuzzing - GET
      • Parameter Fuzzing - POST
      • Value Fuzzing
    • ☁️Cloud
      • AWS
        • AWS S3 Buckets
    • 💉Command Injection
      • Command Injection Cheat Sheet
      • Intro to Command Injections
      • Detection
      • Injecting Commands
      • Other Injection Operators
      • Identifying Filters
      • Bypassing Space Filters
      • Bypassing Other Blacklisted Characters
      • Bypassing Blacklisted Commands
      • Advanced Command Obfuscation
      • Evasion Tools
      • Command Injection Prevention
    • Containers
      • Docker
    • ❌Cross-Site Scripting (XSS)
      • Introduction to XSS
      • Stored XSS
      • Reflected XSS
      • DOM XSS
      • XSS Discovery
      • Defacing
      • Phishing
      • Session Hijacking
      • XSS Prevention
    • Directory Busting
      • DirB
      • DirBuster
      • Ffuf
      • Gobuster
    • 🅰️DNS
      • DNSRecon
      • Fierce
    • File Inclusion
      • Local File Inclusion Cheatsheet
      • Intro to File Inclusion
      • Local File Inclusion (LFI)
      • Basic Bypass
      • PHP Filters
      • PHP Wrappers
      • Remote File Inclusion (RFI)
      • LFI and File Uploads
      • Log Poisoning
      • Automated Scanning
      • File Inclusion Prevention
    • File Transfers
      • Transferring Files
      • File Transfer - Quick Commands
      • Living off the Land
      • Windows File Transfer Methods
      • Linux File Transfer Methods
      • Catching Files over HTTP(S)
      • Transferring Files with Code
      • Miscellaneous File Transfer Methods
      • Protected File Transfers
      • Mounting Encrypted VHD Drives
      • Mounting VHD in Kali
      • File Transfer Detection
    • File Upload Attacks
      • File Upload Cheatsheet
      • Absent Validation
      • Upload Exploitation
      • Client-Side Validation
      • Blacklist Filters
      • Whitelist Filters
      • Type Filters
      • Limited File Uploads
      • Other Upload Attacks
      • Preventing File Upload Vulnerabilities
    • 👣Footprinting
      • Linux Remote Management Protocols
      • Windows Remote Management Protocols
      • Enumeration
        • Enumeration Methodology
        • 🖥️Host Based
          • Quick Commands
          • DNS
          • FTP
          • IMAP-POP3
          • IPMI
          • MSSQL
          • MySQL
          • NFS
          • Oracle TNS
          • SMB
  • Powershell
    • Powershell CheatSheet
  • Python
    • Map
    • Anonymous Functions
    • Recursion
      • ZipMap
      • Nested Sum
      • Recursion on a Tree
      • Count Nested Levels
      • Longest Word
    • Function Transformations
      • More Transformations
      • Why Transform?
    • Closures
    • Currying
    • Decorators
    • Sum Types
    • Enums
    • Match
    • Regex
  • Kusto (KQL)
    • SQL and KQL Comparison
    • Using the Where and Sort Operators
    • KQL Queries
  • HTML
  • Insecure File Uploads
Powered by GitBook
On this page
  • How Does Dirb Work?
  • How to Install Dirb
  • Dirb Wordlists
  • How to fix “Error opening wordlist”
  • Where to find good wordlists for dirb
  • Dirb Hotkeys
  • Dirb Examples
  • Dirb with a specific port
  • Authentication with dirb
  • Using dirb with a proxy
  • Ignore certain HTTP responses
  • Try variations on a found filename
  • Add file extensions to wordlist contents
  1. Offensive Security
  2. Directory Busting

DirB

PreviousDirectory BustingNextDirBuster

Last updated 3 months ago

Related Sites:

How Does Dirb Work?

If a webpage or directory is not linked to from other pages, how does dirb know it’s there? In short, it guesses.

To use dirb, you provide a wordlist. This wordlist might contain common endpoints, such as “index.html”, “admin.jsp”, “login.php”, to name a few examples. It might also include common directories like /.git/, /cgi-bin/, and so on.

Dirb takes the provided URL (ex: http://site-being-tested.com), appends the endpoints one at a time, and then makes a request.

The HTTP response code tells dirb about the webpage’s existence (or not):

  • If the endpoint does not exist, the webserver should return a 404, in which case, dirb ignores it.

  • If it returns a HTTP 200, then the webpage exists and is viewable.

  • If it’s a HTTP 30X, the server returned a response, redirecting dirb to another location.

  • If it’s a HTTP 40X, the server has indicated that authentication is required, and that dirb is forbidden or unauthorized.

Dirb does not “spider” websites (follow links), nor does it download files or run typical vulnerability scans. It just tries out all the endpoints provided in the wordlist.

You can read dirb’s if you’d like.

We’ll cover specific use cases later in this article, but here is the basic dirb command format:

dirb <url_base> [<wordlist_file(s)>] [options]

How to Install Dirb

Ubuntu:

sudo apt install dirb

Dirb Wordlists

By default, dirb looks in /usr/share/dirb/wordlists/ for a wordlist named common.txt.

How to fix “Error opening wordlist”

If you get this error: (!) FATAL: Error opening wordlist file: /usr/share/dirb/wordlists/common.txt then you have two options:

  1. You can move a wordlist with the name common.txt into /usr/share/dirb/wordlists.

  2. Or, you can supply the path to a wordlist after the URL, such as dirb http://site-being-tested.com /path/to/wordlist

If a website is written in PHP, use a PHP-specific wordlist. Same goes for other languages. You can also use wordlists that target a specific website platform, like IIS.

Where to find good wordlists for dirb

Dirb is only as good as the wordlists you provide it. While common.txt is a good place to start (and will typically find you the endpoints for common CTF challenges within HackTheBox, etc), you will want to branch out and tailor your wordlists to your application.

My two top picks for wordlists are:

Each of these resources has a variety of lists for different uses. I suggest that you save local copies and add to them as you discover new web technologies and related endpoints.

You can use multiple wordlists, just comma-separate them! For example,

dirb http://site-being-tested.com /path/to/wordlist1,/path/to/wordlist2

Each of these resources has a variety of lists for different uses. I suggest that you save local copies and add to them as you discover new web technologies and related endpoints.

You can use multiple wordlists, just comma-separate them! For example,

dirb http://site-being-tested.com /path/to/wordlist1,/path/to/wordlist2

Dirb Hotkeys

As dirb is running, you can use hotkeys to skip ahead, pause the scan, or show stats:

======================== HOTKEYS ========================
'n' -> Go to next directory.
'q' -> Stop scan. (Saving state for resume)
'r' -> Remaining scan stats.

This can be used to exclude a directory, by pressing n after the directory scan has started. Dirb will jump to the next directory in the list.

If you want dirb to ask ahead of time, you can use the -R flag for interactive recursion, meaning that dirb will ask you before it begins each directory.

Dirb Examples

Here are some common dirb use cases:

Dirb with a specific port

If you provide a URL beginning with HTTP and no further port info, the port used by dirb will be “80”. Likewise, HTTPS will use 443 by default.

To provide a specific port, use the format http://url:port or https://url:port. For example:

dirb http://site-being-tested.com:8080

Authentication with dirb

If you have a website that requires basic authentication, use -u <username:password>. For example:

dirb http://site-being-tested.com /path/to/wordlist -u admin:secret
dirb http://site-being-tested.com /path/to/wordlist -c <cookie value here>

If you have a client certificate to provide, use the -E flag:

dirb http://site-being-tested.com /path/to/wordlist -E /path/to/certificate

If those options don’t cover your needs, you can always add other custom headers with -H <header value here> after the URL and wordlist.

Using dirb with a proxy

If you’re using dirb with a proxy, you can use -p <proxy[:port]>

If authentication is required, add -P <proxy_username:proxy_password> (uppercase P).

Ignore certain HTTP responses

If a website returns a certain HTTP status code that you’d like to ignore, use -N <HTTP code>. For example, if a website returns a 301 instead of a 401/403 response, you can ignore that with

dirb http://site-being-tested.com /path/to/wordlist -N 301

On the other hand, if you want to see NOT_FOUND pages, you can use the -v flag (warning, this will likely be very noisy).

Try variations on a found filename

If dirb finds a file from the wordlist, you can instruct it to automatically try variations with the -M flag. For example:

dirb http://site-being-tested.com /path/to/wordlist -M .tmp,.backup

If http://site-being-tested.com/db was found, dirb would automatically try http://site-being-tested.com/db.tmp and http://site-being-tested.com/db.backup.

This may not be available on all versions of dirb.

Add file extensions to wordlist contents

If you have a wordlist that is only filenames without extensions, you can use -X <file extension> to have dirb append the file extension for you.

dirb http://site-being-tested.com /path/to/wordlist -X .php

This might be useful in a scenario where there’s a catalog of information within a certain topic. For example, /dog.html, /cat.html, and so on.

Here’s an for MacOS.

This second option will come in useful, since it’s a good idea to tailor your wordlist based on the website’s .

You can provide a cookie instead, if you have logged into the website (and then used , , or similar to find the relevant authentication cookie).

⚔️
install script
tech stack
Daniel Miessler’s SecLists on Github
AssetNote Wordlists
Dev Tools
Burp Suite
DirB Github
Daniel Miessler’s SecLists on Github
AssetNote Wordlists
source code here