Khái niệm

Reconnaissance (trinh sát) là bước quan trọng của penetration testing trong giai đoạn thu thập thông tin, trong đó mục tiêu là dò quét các thông tin về website.
Trong giai đoạn này, để hiệu quả, chính xác, tiết kiệm thời gian và công sức, việc sử dụng các tools có sẵn hoặc tự viết tools. Hôm nay mình sẽ giới thiệu đến các bạn 1 tool là Gobuster.

Giới thiệu

Gobuster là 1 tool được viết bằng Golang và update thường xuyên. Gobuster là một công cụ được sử dụng để brute force URLs trên các trang web và DNS subdomains. Bạn có thể xem toàn bộ source code tại đây.

Để cài đặt, trong Kali Linux, các bạn gõ:

apt-get install gobuster

Sử dụng

Gobuster cung cấp 3 mode option chính gồm: DIR, DNS vHOST (ít dùng hơn)

DIR mode

Chức năng này để dò quét các thư mục/file của website (https://example.com/*)

gobuster dir -h
Uses directory/file enumeration mode

Usage:
  gobuster dir [flags]

Flags:
  -f, --add-slash                       Append / to each request
  -c, --cookies string                  Cookies to use for the requests
  -d, --discover-backup                 Upon finding a file search for backup files
      --exclude-length ints             exclude the following content length (completely ignores the status). Supply multiple times to exclude multiple sizes.
  -e, --expanded                        Expanded mode, print full URLs
  -x, --extensions string               File extension(s) to search for
  -r, --follow-redirect                 Follow redirects
  -H, --headers stringArray             Specify HTTP headers, -H 'Header1: val1' -H 'Header2: val2'
  -h, --help                            help for dir
      --hide-length                     Hide the length of the body in the output
  -m, --method string                   Use the following HTTP method (default "GET")
  -n, --no-status                       Don't print status codes
  -k, --no-tls-validation               Skip TLS certificate verification
  -P, --password string                 Password for Basic Auth
      --proxy string                    Proxy to use for requests [http(s)://host:port]
      --random-agent                    Use a random User-Agent string
  -s, --status-codes string             Positive status codes (will be overwritten with status-codes-blacklist if set)
  -b, --status-codes-blacklist string   Negative status codes (will override status-codes if set) (default "404")
      --timeout duration                HTTP Timeout (default 10s)
  -u, --url string                      The target URL
  -a, --useragent string                Set the User-Agent string (default "gobuster/3.1.0")
  -U, --username string                 Username for Basic Auth
      --wildcard                        Force continued operation when wildcard found

Global Flags:
      --delay duration    Time each thread waits between requests (e.g. 1500ms)
      --no-error          Don't display errors
  -z, --no-progress       Don't display progress
  -o, --output string     Output file to write results to (defaults to stdout)
  -p, --pattern string    File containing replacement patterns
  -q, --quiet             Don't print the banner and other noise
  -t, --threads int       Number of concurrent threads (default 10)
  -v, --verbose           Verbose output (errors)
  -w, --wordlist string   Path to the wordlist

Ví dụ

gobuster dir -u https://example.com/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 30 -e -x php

Lưu ý: Trong Kali Linux hoặc các OS pentest khác có 1 file wordlist dành cho gobuster tại:

/usr/share/wordlists/dirbuster/...
  • -u: url mục tiêu
  • -w: đường dẫn đến file wordlist
  • -t 30: threads 30 giúp brute force nhanh hơn
  • -e: expand in đầy đủ kết quả
  • -x php: tìm file đuôi php

DNS mode

Chức năng này để dò quét các subdomain của website (https://*.example.com/)

gobuster dns -h
Uses DNS subdomain enumeration mode

Usage:
  gobuster dns [flags]

Flags:
  -d, --domain string      The target domain
  -h, --help               help for dns
  -r, --resolver string    Use custom DNS server (format server.com or server.com:port)
  -c, --show-cname         Show CNAME records (cannot be used with '-i' option)
  -i, --show-ips           Show IP addresses
      --timeout duration   DNS resolver timeout (default 1s)
      --wildcard           Force continued operation when wildcard found

Global Flags:
      --delay duration    Time each thread waits between requests (e.g. 1500ms)
      --no-error          Don't display errors
  -z, --no-progress       Don't display progress
  -o, --output string     Output file to write results to (defaults to stdout)
  -p, --pattern string    File containing replacement patterns
  -q, --quiet             Don't print the banner and other noise
  -t, --threads int       Number of concurrent threads (default 10)
  -v, --verbose           Verbose output (errors)
  -w, --wordlist string   Path to the wordlist

Ví dụ

gobuster dns -d facebook.com -w /usr/share/wordlists/dnsmap.txt -t 30 -i
  • -d: domain mục tiêu
  • -w: đường dẫn đến file wordlist
  • -t 30: threads 30 giúp brute force nhanh hơn
  • -i: hiển thị ip của mục tiêu

Leave a Reply

This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.