- 공격대상 시스템의 보안 취약점을 탐지하기 위하여 목표 애플리케이션에 대한 다양한 입력 값을 전송하는 결함 주입에 근거. 목표 애플리케이션의 입력 값 검증을 우회하며 동시에 보안 취약점을 탐지할 수 있도록 입력 값을 변경하는 것이 중요
→비정상적인 데이터를 애플리케이션에 전달하여 에러를 유도하는 방법
웹 퍼징?
-웹 퍼징 기술은 SQL injection, Cross Site Scripting(XSS) 등과 같은 보안 취약점의 유형을 탐지
<웹 퍼징 도구 wfuzz>
- “The Web application Bruteforcer”. 무차별 공격을 위해 설계된 도구로 연결되지 않은 리소스(디렉토리, 서블릿, 스크립트 등)를 찾거나, 다양한 종류의 인젝션 공격(SQL, XSS, LDAP 등)을 위한 GET 및 POST 파라미터에 무차별 대입을 하거나, Form 파라미터(User/Password) 에 무차별 대입을 하는데 사용
- 퍼징 속도가 매우 빠르며 퍼징해야 하는 부분을 세밀하게 조절 (특정 파라미터에 입력된 Value 값의 범위를 지정) 가능
- 칼리 리눅스에서는 기본적으로 제공
- Hidden 파일 뿐만 아니라 서버 Config 경로, 버전 정보등을 찾는데도 유용하게 사용 가능
- 칼리 리눅스는 /usr/share/wordlists에 wordlists들을 저장
※※ wordlists는 사전 파일로, 웹 서비스에서 계정 정보를 찾기 위한 무작위 대입 공격을 할 때, 웹 서비스의 디렉터리(링크, 관리자 페이지, 테스트 페이지)와 파일 구조를 파악할 때, FTP/SSH/Telnet 등 계정 정보에 무작위 대입 공격할 때, 압축 파일을 해제하기 위해 무작위 대입 공격을 할 때 등에 사용된다. ※※
$ locate wordlists명령어 → 여러가지 도구에서 사용되는 wordlist 디렉토리 정보들과 이와 관련된 파일들을 볼 수 있음
+) 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옵션 : 동시 요청 수를 늘리거나 줄여서 공격이 더 빨리 혹은 더 느리게 진행되도록 함
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.
"현재 디렉토리에서 vi editor를 사용해 index.php 파일을 수정하는 동안, 정전으로 인해 소스코드가 사라지게 되었다.
복구시키는 것을 도와달라" 고 하고 있다.
vi 편집기에 대한 지식을 요구하는 문제이다. 잘 몰랐기 때문에 이 부분에 대해서 찾아보았다.
vi 편집기를 사용하다가 파일작업이 정상종료 되지 않으면 임시 스왑파일 swp이 생성된다. vi 에디터를 정상적으로 종료하면 자동으로 제거되는 파일이지만, 이 파일이 남아있다는 것은 정상종료를 하지 않은 것이다. (참고로 파일 이름 앞에 . 이 있다는 것은 숨김파일을 의미함)
그러면 이 문제에서 index.php 작성 중 정상적 종료를 하지 못했으므로 .index.php.swp 파일이 생겼을 것이다.