웹 해킹/정보 수집

[웹 해킹/정보수집] Dirb(Directory Brute force)

lawence 2025. 3. 15. 01:06

 

 

 

 

Dirb란?

Directory Bruteforcing의 약자로 웹 사이트에 숨겨진 디렉토리를 찾기 위해 사용되는 툴입니다. 이 툴은 칼리 리눅스에 기본적으로 탑재되어 있습니다. 하지만, Dirb는 사이트에 무수한 요청을 보내기 때문에 부하가 발생할 수 있습니다. 따라서 실제 서비스되고 있는 웹 사이트나 CTF 환경(허가하면 ㄱㅊ)에서 절대로!! 사용하지면 안됩니다.

 

Dirb 정보

└─$ ls /usr/share/wordlists/dirb
big.txt     common.txt   extensions_common.txt  mutations_common.txt  small.txt    stress
catala.txt  euskera.txt  indexes.txt            others                spanish.txt  vulns

일반적인 칼리 리눅스에서 Dirb의 위치입니다. 위와 같은 파일들이 있고, grep을 통해서 원하는 이름만 검색을 해 볼 수도 있습니다.

 

└─$ cat /usr/share/wordlists/dirb/common.txt | grep -E 'admin|password'
_admin
_vti_bin/_vti_adm/admin.dll
~admin
~administrator
~sysadmin
admin
admin.cgi
admin.php
admin.pl
admin_
admin_area
admin_banner
admin_c
admin_index
admin_interface
admin_login
admin_logon
admin1
admin2
admin3
admin4_account
admin4_colon
admin-admin
admin-console
admincontrol
admincp
...

 

 

 

 

사용법

└─$ dirb                   

-----------------
DIRB v2.22    
By The Dark Raver
-----------------

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

========================= NOTES =========================
 <url_base> : Base URL to scan. (Use -resume for session resuming)
 <wordlist_file(s)> : List of wordfiles. (wordfile1,wordfile2,wordfile3...)

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

======================== OPTIONS ========================
 -a <agent_string> : Specify your custom USER_AGENT.
 -b : Use path as is.
 -c <cookie_string> : Set a cookie for the HTTP request.
 -E <certificate> : path to the client certificate.
 -f : Fine tunning of NOT_FOUND (404) detection.
 -H <header_string> : Add a custom header to the HTTP request.
 -i : Use case-insensitive search.
 -l : Print "Location" header when found.
 -N <nf_code>: Ignore responses with this HTTP code.
 -o <output_file> : Save output to disk.
 -p <proxy[:port]> : Use this proxy. (Default port is 1080)
 -P <proxy_username:proxy_password> : Proxy Authentication.
 -r : Don't search recursively.
 -R : Interactive recursion. (Asks for each directory)
 -S : Silent Mode. Don't show tested words. (For dumb terminals)
 -t : Don't force an ending '/' on URLs.
 -u <username:password> : HTTP Authentication.
 -v : Show also NOT_FOUND pages.
 -w : Don't stop on WARNING messages.
 -X <extensions> / -x <exts_file> : Append each word with this extensions.
 -z <millisecs> : Add a milliseconds delay to not cause excessive Flood.

======================== EXAMPLES =======================
 dirb http://url/directory/ (Simple Test)
 dirb http://url/ -X .html (Test files with '.html' extension)
 dirb http://url/ /usr/share/dirb/wordlists/vulns/apache.txt (Test with apache.txt wordlist)
 dirb https://secure_url/ (Simple Test with SSL)

 

터미널에 dirb를 입력했을 경우 나타는 화면입니다. dirb의 사용법과 옵션들에 대해 설명하고 있습니다.

 

해당 메뉴얼을 토대로 이전에 구축했던 가상머신에 Dirb를 사용해 보겠습니다.

└─$ dirb http://172.30.1.53

-----------------
DIRB v2.22    
By The Dark Raver
-----------------

START_TIME: Fri Mar 14 11:43:24 2025
URL_BASE: http://172.30.1.53/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt

-----------------

GENERATED WORDS: 4612                                                          

---- Scanning URL: http://172.30.1.53/ ----
+ http://172.30.1.53/.bash_history (CODE:200|SIZE:302)                                                                              
==> DIRECTORY: http://172.30.1.53/assets/                                                                                           
==> DIRECTORY: http://172.30.1.53/cgi-bin/                                                                                          
+ http://172.30.1.53/cgi-bin/ (CODE:200|SIZE:1070)                                                                                  
+ http://172.30.1.53/crossdomain (CODE:200|SIZE:200)                                                                                
+ http://172.30.1.53/crossdomain.xml (CODE:200|SIZE:200)                                                                            
==> DIRECTORY: http://172.30.1.53/evil/                                                                                             
+ http://172.30.1.53/favicon.ico (CODE:200|SIZE:3638)                                                                               
==> DIRECTORY: http://172.30.1.53/gallery2/
...

 

위와 같이 디렉토리 브포 결과가 출력되고 있습니다. 웹 사이트 내에 저런 경로가 있다는 것을 확인할 수 있고, 실제로 들어갈 수 있습니다. 이 중에서 관심이 갈만한 정보로 /admin이나 /password 등이 있겠습니다.

 

또한 위에서 봤던 Dirb의 경로에 있던 파일 중 하나를 선택해서 브포할 수 있습니다.

└─$ dirb http://172.30.1.53 /usr/share/wordlists/dirb/common.txt