퍼징?

- 공격대상 시스템의 보안 취약점을 탐지하기 위하여 목표 애플리케이션에 대한 다양한 입력 값을 전송하는 결함 주입에 근거. 목표 애플리케이션의 입력 값 검증을 우회하며 동시에 보안 취약점을 탐지할 수 있도록 입력 값을 변경하는 것이 중요

비정상적인 데이터를 애플리케이션에 전달하여 에러를 유도하는 방법

 

웹 퍼징?

-  웹 퍼징 기술은 SQL injection, Cross Site Scripting(XSS) 등과 같은 보안 취약점의 유형을 탐지

 

<웹 퍼징 도구 wfuzz>

- “The Web application Bruteforcer”. 무차별 공격을 위해 설계된 도구로 연결되지 않은 리소스(디렉토리, 서블릿, 스크립트 등)를 찾거나, 다양한 종류의 인젝션 공격(SQL, XSS, LDAP )을 위한 GET POST 파라미터에 무차별 대입을 하거나, Form 파라미터(User/Password) 에 무차별 대입을 하는데 사용

- 퍼징 속도가 매우 빠르며 퍼징해야 하는 부분을 세밀하게 조절 (특정 파라미터에 입력된 Value 값의 범위를 지정) 가능

- 칼리 리눅스에서는 기본적으로 제공

- Hidden 파일 뿐만 아니라 서버 Config 경로, 버전 정보등을 찾는데도 유용하게 사용 가능

 

- 칼리 리눅스는 /usr/share/wordlistswordlists들을 저장

※※ wordlists는 사전 파일로, 웹 서비스에서 계정 정보를 찾기 위한 무작위 대입 공격을 할 때, 웹 서비스의 디렉터리(링크, 관리자 페이지, 테스트 페이지)와 파일 구조를 파악할 때, FTP/SSH/Telnet 등 계정 정보에 무작위 대입 공격할 때, 압축 파일을 해제하기 위해 무작위 대입 공격을 할 때 등에 사용된다. ※※

 

$ locate wordlists 명령어 여러가지 도구에서 사용되는 wordlist 디렉토리 정보들과 이와 관련된 파일들을 볼 수 있음

 

locate wordlists 입력시 

 

+) cewl, crunch 등은 이런 사전 파일을 만들어내는 툴

 

 

 

- wfuzz 옵션

* -c : 결과물을 읽기 쉽도록 터미널 창에 색을 넣어줌

* -z 또는 -w: 퍼징을 위한 payload(가 담긴 경로) (file,/usr/share/wordlists/wfuzz/Injections/SQL.txt)

* -d : POST(혹은 GET) 방식을 통해 서버에 넘겨지는 데이터(“username=INPUT&password=INPUT”)

* -u : 대상 애플리케이션 URL 주소

* -hc, -hl, -hw, -hh 옵션 : 특정 코드, 라인, 단어, 문자 등 숨긴 후 결과 제공

* -t 옵션 : 동시 요청 수를 늘리거나 줄여서 공격이 더 빨리 혹은 더 느리게 진행되도록 함

* -s 옵션 : 다른 요청을 수행하기 전 지정된 시간() 동안 중지하도록 지시

 

예시 로그인 페이지

UserName, Password에 각각 username과 password 입력

burp suite 와 같은 툴로 서버에 넘어가는 데이터 확인(username=username&password=password)

 

$ Wfuzz -c -z file,/usr/share/wordlists/wfuzz/Injections/SQL.txt -d “username=admin&password=FUZZ” -u <TARGET_URL>

output

각 쿼리가 입력되었을 때 서버의 응답을 알 수 있다.

200 : 에러 혹은 리다이렉션 일어나지 않음(적절한 에러 핸들링이 된 것) → 공격 실패

302 : 302 Redirection(요청한 리소스가 임시적으로 새로운 URL 이동)이 일어남 (로그인의 경우, 성공적으로 인증되었다는 뜻) → 공격 성공 → 취약점이 있다고 판단

 

 

https://scottc130.medium.com/how-to-use-wfuzz-to-fuzz-web-applications-8594c11d59d1

 

How to use Wfuzz to Fuzz Web Applications

A tutorial on how to use the wfuzz command line utility to find vulnerabilities in web applications

scottc130.medium.com


<common directory(서버 및 클라이언트가 공유하는 디렉토리)를 찾아내는 wfuzz 예시>

$ wfuzz -w wordlist/general/common.txt http://testphp.vulnweb.com/FUZZ

알려진 디렉터리 이름(/admin, /master, /bbs, /etc )이 노출되면 이에 접속 시도할 수 있음 → 위험하다고 판단

 

<common file을 찾아내는 wfuzz 예시>

$ wfuzz -w wordlist/general/common.txt http://testphp.vulnweb.com/FUZZ.php

 

 

1) URL 퍼징

: ? 뒤에 FUZZ 키워드 작성

‘cat’ 파라미터에 대한 입력 값 범위 지정 가능(range)

$ wfuzz -z range,0-10 --hl 97 http://testphp.vulnweb.com/listproducts.php?cat=FUZZ

 

 

2) POST Requests 퍼징

: HTML에서의 폼 형태의 데이터에 -d 옵션을 통해 퍼징

 

$ wfuzz -z file,wordlist/others/common_pass.txt -d "uname=FUZZ&pass=FUZZ"      --hc 302 http://testphp.vulnweb.com/userinfo.php

 

 

3) Cookie 퍼징

: -b 옵션을 통해 퍼징

$ wfuzz -z file,wordlist/general/common.txt -b cookie=value1 -b cookie2=value2 http://testphp.vulnweb.com/FUZZ

 

아래와 같은 HTTP 요청을 생성하게 됨

 

아래와 같은 방법으로도 가능

$ wfuzz -z file,wordlist/general/common.txt -b cookie=FUZZ http://testphp.vulnweb.com/

 

 

4) Custom headers 퍼징

: HTTP 헤더는 기본적으로 비활성화 되어있다. 따라서 이를 활성화하러면 퍼징에 포함할 헤더 목록을 지정해야 한다. -H 옵션을 이용

$ wfuzz -z file,wordlist/general/common.txt -H "myheader: headervalue" -H "myheader2: headervalue2" http://testphp.vulnweb.com/FUZZ

 

아래와 같은 HTTP 요청을 생성

 

User Agent를 지정하는 등의 기존 헤더를 수정할 시 아래와 같이 입력

$ wfuzz -z file,wordlist/general/common.txt -H "myheader: headervalue" -H "User-Agent: Googlebot-News" http://testphp.vulnweb.com/FUZZ

 

→ 아래와 같은 HTTP 요청 생성

아래와 같은 방법으로도 가능

$ wfuzz -z file,wordlist/general/common.txt -H "User-Agent: FUZZ" http://testphp.vulnweb.com/ 

 

 

 

5) HTTP Verbs(HTTP Method - GET,POST 방식) 퍼징

: -X, -X HEAD 옵션

 

$ wfuzz -z list,GET-HEAD-POST-TRACE-OPTIONS -X FUZZ http://testphp.vulnweb.com/  

→  요청 후 전송되어 온 패킷을 분석하여 HTTP 헤더가200 OK를 포함하면 해당 메소드로 요청시 인증 우회가 가능할 것으로 판단

 

 

 

 

6) Proxies

: 프록시 사용을 원한다면 -p 옵션 사용

$ wfuzz -z file,wordlist/general/common.txt -p localhost:8080 http://testphp.vulnweb.com/FUZZ

 

아래와 같이 중복 사용도 가능

$ wfuzz -z file,wordlist/general/common.txt -p localhost:8080 -p localhost:9090 http://testphp.vulnweb.com/FUZZ

 

 

7) Authentication (인증)

: 보통 HTTPBasic 인증 방식을 사용.  –basic/ntlm/digest(각각은 인증 프로토콜) 옵션 사용

 

$ wfuzz -z list,nonvalid-httpwatch --basic FUZZ:FUZZ https://www.httpwatch.com/httpgallery/authentication/authenticatedimage/default.aspx 

→ 인코딩 되지 않은 문자열 "httpwatch"가 사용되었으며 HTTP 요청을 가로챌 수 있는 모든 사용자가 쉽게 사용할 수 있다 위험하다고 판단

 

 

 

8) Recursion

: -R 옵션 사용.

예를 들어 동일한 payload를 사용하여 기존 디렉토리를 검색했지만 다시 퍼징하는 경우

 

$ wfuzz -z list,"admin-CVS-cgi\-bin"   -R1 http://testphp.vulnweb.com/FUZZ

 

https://wfuzz.readthedocs.io/en/latest/ 

 

Wfuzz: The Web fuzzer — Wfuzz 2.1.4 documentation

Wfuzz: The Web fuzzer Wfuzz provides a framework to automate web applications security assessments and could help you to secure your web applications by finding and exploiting web application vulnerabilities. See Wfuzz in action Wfuzz cli: $ wfuzz -w wordl

wfuzz.readthedocs.io


<그 외 옵션> 

 

https://tools.kali.org/web-applications/wfuzz

 

Wfuzz

Wfuzz is a tool designed for bruteforcing Web Applications, it can be used for finding resources not linked (directories, servlets, scripts, etc), bruteforce GET and POST parameters for checking different kind of injections (SQL, XSS, LDAP,etc), bruteforce

tools.kali.org

Options:
    -h/--help           : This help
    --help              : Advanced help
    --version           : Wfuzz version details
    -e <type>           : List of available encoders/payloads/iterators/printers/scripts
   
    --recipe <filename>     : Reads options from a recipe
    --dump-recipe <filename>    : Prints current options as a recipe
    --oF <filename>         : Saves fuzz results to a file. These can be consumed later using the wfuzz payload.
   
    -c              : Output with colors
    -v              : Verbose information.
    -f filename,printer         : Store results in the output file using the specified printer (raw printer if omitted).
    -o printer                  : Show results using the specified printer.
    --interact          : (beta) If selected,all key presses are captured. This allows you to interact with the program.
    --dry-run           : Print the results of applying the requests without actually making any HTTP request.
    --prev              : Print the previous HTTP requests (only when using payloads generating fuzzresults)
   
    -p addr             : Use Proxy in format ip:port:type. Repeat option for using various proxies.
                      Where type could be SOCKS4,SOCKS5 or HTTP if omitted.
   
    -t N                : Specify the number of concurrent connections (10 default)
    -s N                : Specify time delay between requests (0 default)
    -R depth            : Recursive path discovery being depth the maximum recursion level.
    -L,--follow         : Follow HTTP redirections
    -Z              : Scan mode (Connection errors will be ignored).
    --req-delay N           : Sets the maximum time in seconds the request is allowed to take (CURLOPT_TIMEOUT). Default 90.
    --conn-delay N              : Sets the maximum time in seconds the connection phase to the server to take (CURLOPT_CONNECTTIMEOUT). Default 90.
   
    -A              : Alias for --script=default -v -c
    --script=           : Equivalent to --script=default
    --script=<plugins>      : Runs script's scan. <plugins> is a comma separated list of plugin-files or plugin-categories
    --script-help=<plugins>     : Show help about scripts.
    --script-args n1=v1,...     : Provide arguments to scripts. ie. --script-args grep.regex="<A href="(.*?)">"
   
    -u url                      : Specify a URL for the request.
    -m iterator         : Specify an iterator for combining payloads (product by default)
    -z payload          : Specify a payload for each FUZZ keyword used in the form of name[,parameter][,encoder].
                      A list of encoders can be used, ie. md5-sha1. Encoders can be chained, ie. md5@sha1.
                      Encoders category can be used. ie. url
                                  Use help as a payload to show payload plugin's details (you can filter using --slice)
    --zP <params>           : Arguments for the specified payload (it must be preceded by -z or -w).
    --slice <filter>        : Filter payload's elements using the specified expression. It must be preceded by -z.
    -w wordlist         : Specify a wordlist file (alias for -z file,wordlist).
    -V alltype          : All parameters bruteforcing (allvars and allpost). No need for FUZZ keyword.
    -X method           : Specify an HTTP method for the request, ie. HEAD or FUZZ
   
    -b cookie           : Specify a cookie for the requests. Repeat option for various cookies.
    -d postdata             : Use post data (ex: "id=FUZZ&catalogue=1")
    -H header           : Use header (ex:"Cookie:id=1312321&user=FUZZ"). Repeat option for various headers.
    --basic/ntlm/digest auth    : in format "user:pass" or "FUZZ:FUZZ" or "domain\FUZ2Z:FUZZ"
   
    --hc/hl/hw/hh N[,N]+        : Hide responses with the specified code/lines/words/chars (Use BBB for taking values from baseline)
    --sc/sl/sw/sh N[,N]+        : Show responses with the specified code/lines/words/chars (Use BBB for taking values from baseline)
    --ss/hs regex           : Show/hide responses with the specified regex within the content
    --filter <filter>       : Show/hide responses using the specified filter expression (Use BBB for taking values from baseline)
    --prefilter <filter>        : Filter items before fuzzing using the specified expression.

    -A              : Alias for --script=default -v -c
    --script=           : Equivalent to --script=default
    --script=<plugins>      : Runs script's scan. <plugins> is a comma separated list of plugin-files or plugin-categories
    --script-help=<plugins>     : Show help about scripts.
    --script-args n1=v1,...     : Provide arguments to scripts. ie. --script-args grep.regex="<A href="(.*?)">"
   
    -u url                      : Specify a URL for the request.
    -m iterator         : Specify an iterator for combining payloads (product by default)
    -z payload          : Specify a payload for each FUZZ keyword used in the form of name[,parameter][,encoder].
                      A list of encoders can be used, ie. md5-sha1. Encoders can be chained, ie. md5@sha1.
                      Encoders category can be used. ie. url
                                  Use help as a payload to show payload plugin's details (you can filter using --slice)
    --zP <params>           : Arguments for the specified payload (it must be preceded by -z or -w).
    --slice <filter>        : Filter payload's elements using the specified expression. It must be preceded by -z.
    -w wordlist         : Specify a wordlist file (alias for -z file,wordlist).
    -V alltype          : All parameters bruteforcing (allvars and allpost). No need for FUZZ keyword.
    -X method           : Specify an HTTP method for the request, ie. HEAD or FUZZ
   
    -b cookie           : Specify a cookie for the requests. Repeat option for various cookies.
    -d postdata             : Use post data (ex: "id=FUZZ&catalogue=1")
    -H header           : Use header (ex:"Cookie:id=1312321&user=FUZZ"). Repeat option for various headers.
    --basic/ntlm/digest auth    : in format "user:pass" or "FUZZ:FUZZ" or "domain\FUZ2Z:FUZZ"
   
    --hc/hl/hw/hh N[,N]+        : Hide responses with the specified code/lines/words/chars (Use BBB for taking values from baseline)
    --sc/sl/sw/sh N[,N]+        : Show responses with the specified code/lines/words/chars (Use BBB for taking values from baseline)
    --ss/hs regex           : Show/hide responses with the specified regex within the content
    --filter <filter>       : Show/hide responses using the specified filter expression (Use BBB for taking values from baseline)
    --prefilter <filter>        : Filter items before fuzzing using the specified expression.

 

+ Recent posts