# 80,443 - Pentesting Web Methodology {{#include ../../banners/hacktricks-training.md}} ## Basic Info 웹 서비스는 가장 **일반적이고 광범위한 서비스**이며 많은 **다양한 유형의 취약점**이 존재합니다. **기본 포트:** 80 (HTTP), 443(HTTPS) ```bash PORT STATE SERVICE 80/tcp open http 443/tcp open ssl/https ``` ```bash nc -v domain.com 80 # GET / HTTP/1.0 openssl s_client -connect domain.com:443 # GET / HTTP/1.0 ``` ### Web API Guidance {{#ref}} web-api-pentesting.md {{#endref}} ## Methodology summary > 이 방법론에서는 도메인(또는 서브도메인)을 공격한다고 가정합니다. 따라서 발견된 각 도메인, 서브도메인 또는 범위 내의 불확실한 웹 서버가 있는 IP에 이 방법론을 적용해야 합니다. - [ ] **웹 서버**에서 사용되는 **기술**을 **식별**하는 것부터 시작하세요. 기술을 성공적으로 식별할 수 있다면 나머지 테스트 동안 염두에 두어야 할 **트릭**을 찾아보세요. - [ ] 기술 버전의 **알려진 취약점**이 있나요? - [ ] **잘 알려진 기술**을 사용하고 있나요? 더 많은 정보를 추출하기 위한 **유용한 트릭**이 있나요? - [ ] 실행할 **전문 스캐너**가 있나요(예: wpscan)? - [ ] **일반 목적의 스캐너**를 실행하세요. 그들이 무언가를 발견할지, 흥미로운 정보를 찾을지 알 수 없습니다. - [ ] **초기 점검**부터 시작하세요: **robots**, **sitemap**, **404** 오류 및 **SSL/TLS 스캔**(HTTPS인 경우). - [ ] 웹 페이지를 **스파이더링**하기 시작하세요: 가능한 모든 **파일, 폴더** 및 **사용되는 매개변수**를 **찾는** 시간입니다. 또한 **특별한 발견**을 확인하세요. - [ ] _브루트 포싱 또는 스파이더링 중에 새로운 디렉토리가 발견될 때마다 스파이더링해야 합니다._ - [ ] **디렉토리 브루트 포싱**: 발견된 모든 폴더를 브루트 포스하여 새로운 **파일**과 **디렉토리**를 검색하세요. - [ ] _브루트 포싱 또는 스파이더링 중에 새로운 디렉토리가 발견될 때마다 브루트 포스해야 합니다._ - [ ] **백업 확인**: 일반적인 백업 확장자를 추가하여 **발견된 파일**의 **백업**을 찾을 수 있는지 테스트하세요. - [ ] **브루트 포스 매개변수**: **숨겨진 매개변수**를 **찾아보세요**. - [ ] **사용자 입력**을 수용하는 모든 가능한 **엔드포인트**를 **식별**한 후, 관련된 모든 종류의 **취약점**을 확인하세요. - [ ] [이 체크리스트를 따르세요](../../pentesting-web/web-vulnerabilities-methodology.md) ## Server Version (Vulnerable?) ### Identify 실행 중인 서버 **버전**에 대한 **알려진 취약점**이 있는지 확인하세요.\ **응답의 HTTP 헤더와 쿠키**는 사용 중인 **기술** 및/또는 **버전**을 **식별**하는 데 매우 유용할 수 있습니다. **Nmap 스캔**은 서버 버전을 식별할 수 있지만, [**whatweb**](https://github.com/urbanadventurer/WhatWeb)**,** [**webtech** ](https://github.com/ShielderSec/webtech) 또는 [**https://builtwith.com/**](https://builtwith.com)**와 같은 도구도 유용할 수 있습니다:** ```bash whatweb -a 1 #Stealthy whatweb -a 3 #Aggresive webtech -u webanalyze -host https://google.com -crawl 2 ``` Search **for** [**vulnerabilities of the web application** **version**](../../generic-hacking/search-exploits.md) ### **Check if any WAF** - [**https://github.com/EnableSecurity/wafw00f**](https://github.com/EnableSecurity/wafw00f) - [**https://github.com/Ekultek/WhatWaf.git**](https://github.com/Ekultek/WhatWaf.git) - [**https://nmap.org/nsedoc/scripts/http-waf-detect.html**](https://nmap.org/nsedoc/scripts/http-waf-detect.html) ### Web tech tricks 다양한 잘 알려진 **기술**에서 **취약점**을 찾기 위한 **트릭**: - [**AEM - Adobe Experience Cloud**](aem-adobe-experience-cloud.md) - [**Apache**](apache.md) - [**Artifactory**](artifactory-hacking-guide.md) - [**Buckets**](buckets/index.html) - [**CGI**](cgi.md) - [**Drupal**](drupal/index.html) - [**Flask**](flask.md) - [**Git**](git.md) - [**Golang**](golang.md) - [**GraphQL**](graphql.md) - [**H2 - Java SQL database**](h2-java-sql-database.md) - [**IIS tricks**](iis-internet-information-services.md) - [**JBOSS**](jboss.md) - [**Jenkins**](<[https:/github.com/carlospolop/hacktricks/blob/master/network-services-pentesting/pentesting-web/broken-reference/README.md](https:/github.com/HackTricks-wiki/hacktricks-cloud/tree/master/pentesting-ci-cd/jenkins-security)/>) - [**Jira**](jira.md) - [**Joomla**](joomla.md) - [**JSP**](jsp.md) - [**Laravel**](laravel.md) - [**Moodle**](moodle.md) - [**Nginx**](nginx.md) - [**PHP (php has a lot of interesting tricks that could be exploited)**](php-tricks-esp/index.html) - [**Python**](python.md) - [**Spring Actuators**](spring-actuators.md) - [**Symphony**](symphony.md) - [**Tomcat**](tomcat/index.html) - [**VMWare**](vmware-esx-vcenter....md) - [**Web API Pentesting**](web-api-pentesting.md) - [**WebDav**](put-method-webdav.md) - [**Werkzeug**](werkzeug.md) - [**Wordpress**](wordpress.md) - [**Electron Desktop (XSS to RCE)**](electron-desktop-apps/index.html) _같은 도메인이 **다른 포트**, **폴더** 및 **서브도메인**에서 **다른 기술**을 사용할 수 있다는 점을 고려하세요._\ 웹 애플리케이션이 이전에 나열된 잘 알려진 **기술/플랫폼**이나 **다른 것**을 사용하고 있다면, **인터넷에서** 새로운 트릭을 **검색하는 것을 잊지 마세요** (그리고 저에게 알려주세요!). ### Source Code Review 애플리케이션의 **소스 코드**가 **github**에 있는 경우, 애플리케이션에 대해 **자신만의 화이트 박스 테스트**를 수행하는 것 외에도 현재 **블랙 박스 테스트**에 **유용한** **정보**가 있을 수 있습니다: - **Change-log** 또는 **Readme** 또는 **Version** 파일이 있거나 웹을 통해 **버전 정보에 접근할 수 있는** 것이 있나요? - **자격 증명**은 어떻게 그리고 어디에 저장되나요? 자격 증명(사용자 이름 또는 비밀번호)이 포함된 (접근 가능한?) **파일**이 있나요? - **비밀번호**는 **일반 텍스트**, **암호화**되어 있거나 어떤 **해싱 알고리즘**이 사용되나요? - 어떤 것을 암호화하기 위해 **마스터 키**를 사용하고 있나요? 어떤 **알고리즘**이 사용되나요? - 어떤 취약점을 이용해 **이 파일들에 접근할 수 있나요**? - **github**에 (해결된 것과 해결되지 않은) **문제**에 **흥미로운 정보**가 있나요? 또는 **커밋 기록**에 (아마도 **오래된 커밋에 포함된 비밀번호**)? {{#ref}} code-review-tools.md {{#endref}} ### Automatic scanners #### General purpose automatic scanners ```bash nikto -h whatweb -a 4 wapiti -u W3af zaproxy #You can use an API nuclei -ut && nuclei -target # https://github.com/ignis-sec/puff (client side vulns fuzzer) node puff.js -w ./wordlist-examples/xss.txt -u "http://www.xssgame.com/f/m4KKGHi2rVUN/?query=FUZZ" ``` #### CMS 스캐너 CMS가 사용되는 경우 **스캐너를 실행하는 것을 잊지 마세요**, 아마도 흥미로운 것이 발견될 수 있습니다: [**Clusterd**](https://github.com/hatRiot/clusterd)**:** [**JBoss**](jboss.md)**, ColdFusion, WebLogic,** [**Tomcat**](tomcat/index.html)**, Railo, Axis2, Glassfish**\ [**CMSScan**](https://github.com/ajinabraham/CMSScan): [**WordPress**](wordpress.md), [**Drupal**](drupal/index.html), **Joomla**, **vBulletin** 웹사이트의 보안 문제. (GUI)\ [**VulnX**](https://github.com/anouarbensaad/vulnx)**:** [**Joomla**](joomla.md)**,** [**Wordpress**](wordpress.md)**,** [**Drupal**](drupal/index.html)**, PrestaShop, Opencart**\ **CMSMap**: [**(W)ordpress**](wordpress.md)**,** [**(J)oomla**](joomla.md)**,** [**(D)rupal**](drupal/index.html) **또는** [**(M)oodle**](moodle.md)\ [**droopscan**](https://github.com/droope/droopescan)**:** [**Drupal**](drupal/index.html)**,** [**Joomla**](joomla.md)**,** [**Moodle**](moodle.md)**, Silverstripe,** [**Wordpress**](wordpress.md) ```bash cmsmap [-f W] -F -d wpscan --force update -e --url joomscan --ec -u joomlavs.rb #https://github.com/rastating/joomlavs ``` > 이 시점에서 클라이언트가 사용하는 웹 서버에 대한 정보(주어진 데이터가 있을 경우)를 이미 가지고 있어야 하며, 테스트 중에 염두에 두어야 할 몇 가지 요령이 있어야 합니다. 운이 좋다면 CMS를 발견하고 스캐너를 실행했을 것입니다. ## 단계별 웹 애플리케이션 탐색 > 이 시점부터 웹 애플리케이션과 상호작용을 시작할 것입니다. ### 초기 점검 **흥미로운 정보가 있는 기본 페이지:** - /robots.txt - /sitemap.xml - /crossdomain.xml - /clientaccesspolicy.xml - /.well-known/ - 주요 및 보조 페이지의 댓글도 확인하세요. **오류 강제 발생** 웹 서버는 이상한 데이터가 전송될 때 **예상치 못한 방식으로 동작할 수 있습니다**. 이는 **취약점**이나 **민감한 정보의 노출**을 열 수 있습니다. - /whatever_fake.php (.aspx, .html, 등)와 같은 **가짜 페이지**에 접근 - **쿠키 값** 및 **매개변수** 값에 **"\[]", "]]", 및 "\[\["** 추가하여 오류 생성 - **URL**의 **끝**에 **`/~randomthing/%s`**로 입력하여 오류 생성 - PATCH, DEBUG 또는 FAKE와 같은 **다양한 HTTP 동사** 시도 #### **파일 업로드 가능 여부 확인 (**[**PUT 동사, WebDav**](put-method-webdav.md)**)** **WebDav**가 **활성화**되어 있지만 루트 폴더에 **파일 업로드**를 위한 충분한 권한이 없는 경우 다음을 시도하세요: - **자격 증명** 무차별 대입 - 웹 페이지 내에서 **발견된 폴더**의 **나머지**에 WebDav를 통해 **파일 업로드**. 다른 폴더에 파일을 업로드할 수 있는 권한이 있을 수 있습니다. ### **SSL/TLS 취약점** - 애플리케이션이 어느 부분에서도 **HTTPS 사용을 강제하지 않는다면**, 이는 **MitM 공격에 취약**합니다. - 애플리케이션이 **HTTP를 사용하여 민감한 데이터(비밀번호)를 전송하는 경우**, 이는 높은 취약점입니다. [**testssl.sh**](https://github.com/drwetter/testssl.sh)를 사용하여 **취약점**을 확인하고 (버그 바운티 프로그램에서는 이러한 종류의 취약점이 수용되지 않을 수 있습니다) [**a2sv**](https://github.com/hahwul/a2sv)를 사용하여 취약점을 재확인하세요: ```bash ./testssl.sh [--htmlfile] 10.10.10.10:443 #Use the --htmlfile to save the output inside an htmlfile also # You can also use other tools, by testssl.sh at this momment is the best one (I think) sslscan sslyze --regular ``` SSL/TLS 취약점에 대한 정보: - [https://www.gracefulsecurity.com/tls-ssl-vulnerabilities/](https://www.gracefulsecurity.com/tls-ssl-vulnerabilities/) - [https://www.acunetix.com/blog/articles/tls-vulnerabilities-attacks-final-part/](https://www.acunetix.com/blog/articles/tls-vulnerabilities-attacks-final-part/) ### 스파이더링 웹 내에서 **스파이더**를 실행합니다. 스파이더의 목표는 테스트된 애플리케이션에서 **가능한 많은 경로를 찾는 것**입니다. 따라서 웹 크롤링과 외부 소스를 사용하여 가능한 많은 유효한 경로를 찾아야 합니다. - [**gospider**](https://github.com/jaeles-project/gospider) (go): HTML 스파이더, JS 파일 및 외부 소스(Archive.org, CommonCrawl.org, VirusTotal.com, AlienVault.com)에서 링크 찾기. - [**hakrawler**](https://github.com/hakluke/hakrawler) (go): HTML 스파이더, JS 파일에 대한 LinkFinder 및 Archive.org를 외부 소스로 사용. - [**dirhunt**](https://github.com/Nekmo/dirhunt) (python): HTML 스파이더, "juicy files"도 표시. - [**evine** ](https://github.com/saeeddhqan/evine)(go): 대화형 CLI HTML 스파이더. Archive.org에서도 검색. - [**meg**](https://github.com/tomnomnom/meg) (go): 이 도구는 스파이더는 아니지만 유용할 수 있습니다. 호스트가 있는 파일과 경로가 있는 파일을 지정하면 meg가 각 호스트의 각 경로를 가져와 응답을 저장합니다. - [**urlgrab**](https://github.com/IAmStoxe/urlgrab) (go): JS 렌더링 기능이 있는 HTML 스파이더. 그러나 유지 관리되지 않는 것처럼 보이며, 미리 컴파일된 버전이 오래되었고 현재 코드는 컴파일되지 않습니다. - [**gau**](https://github.com/lc/gau) (go): 외부 제공업체(wayback, otx, commoncrawl)를 사용하는 HTML 스파이더. - [**ParamSpider**](https://github.com/devanshbatham/ParamSpider): 이 스크립트는 매개변수가 있는 URL을 찾아 나열합니다. - [**galer**](https://github.com/dwisiswant0/galer) (go): JS 렌더링 기능이 있는 HTML 스파이더. - [**LinkFinder**](https://github.com/GerbenJavado/LinkFinder) (python): HTML 스파이더, JS 파일에서 새로운 경로를 검색할 수 있는 JS beautify 기능이 있습니다. [JSScanner](https://github.com/dark-warlord14/JSScanner)도 살펴볼 가치가 있습니다. 이는 LinkFinder의 래퍼입니다. - [**goLinkFinder**](https://github.com/0xsha/GoLinkFinder) (go): HTML 소스와 내장된 자바스크립트 파일 모두에서 엔드포인트를 추출합니다. 버그 헌터, 레드 팀원, 정보 보안 전문가에게 유용합니다. - [**JSParser**](https://github.com/nahamsec/JSParser) (python2.7): Tornado와 JSBeautifier를 사용하여 JavaScript 파일에서 상대 URL을 구문 분석하는 Python 2.7 스크립트입니다. AJAX 요청을 쉽게 발견하는 데 유용합니다. 유지 관리되지 않는 것처럼 보입니다. - [**relative-url-extractor**](https://github.com/jobertabma/relative-url-extractor) (ruby): 파일(HTML)을 주면 멋진 정규 표현식을 사용하여 더럽고(minify) 파일에서 상대 URL을 찾아 추출합니다. - [**JSFScan**](https://github.com/KathanP19/JSFScan.sh) (bash, 여러 도구): 여러 도구를 사용하여 JS 파일에서 흥미로운 정보를 수집합니다. - [**subjs**](https://github.com/lc/subjs) (go): JS 파일을 찾습니다. - [**page-fetch**](https://github.com/detectify/page-fetch) (go): 헤드리스 브라우저에서 페이지를 로드하고 페이지를 로드하는 데 사용된 모든 URL을 인쇄합니다. - [**Feroxbuster**](https://github.com/epi052/feroxbuster) (rust): 이전 도구의 여러 옵션을 혼합한 콘텐츠 발견 도구입니다. - [**Javascript Parsing**](https://github.com/xnl-h4ck3r/burp-extensions): JS 파일에서 경로와 매개변수를 찾기 위한 Burp 확장입니다. - [**Sourcemapper**](https://github.com/denandz/sourcemapper): .js.map URL을 주면 아름답게 정리된 JS 코드를 가져오는 도구입니다. - [**xnLinkFinder**](https://github.com/xnl-h4ck3r/xnLinkFinder): 주어진 대상에 대한 엔드포인트를 발견하는 데 사용되는 도구입니다. - [**waymore**](https://github.com/xnl-h4ck3r/waymore)**:** Wayback 머신에서 링크를 발견하고 응답을 다운로드하여 더 많은 링크를 찾습니다. - [**HTTPLoot**](https://github.com/redhuntlabs/HTTPLoot) (go): 양식 작성까지 크롤링하고 특정 정규 표현식을 사용하여 민감한 정보를 찾습니다. - [**SpiderSuite**](https://github.com/3nock/SpiderSuite): Spider Suite는 사이버 보안 전문가를 위해 설계된 고급 다기능 GUI 웹 보안 크롤러/스파이더입니다. - [**jsluice**](https://github.com/BishopFox/jsluice) (go): URL, 경로, 비밀 및 기타 흥미로운 데이터를 JavaScript 소스 코드에서 추출하기 위한 Go 패키지 및 [명령줄 도구](https://github.com/BishopFox/jsluice/blob/main/cmd/jsluice)입니다. - [**ParaForge**](https://github.com/Anof-cyber/ParaForge): 요청에서 매개변수와 엔드포인트를 추출하여 퍼징 및 열거를 위한 사용자 정의 단어 목록을 생성하는 간단한 **Burp Suite 확장**입니다. - [**katana**](https://github.com/projectdiscovery/katana) (go): 이 작업에 대한 멋진 도구입니다. - [**Crawley**](https://github.com/s0rg/crawley) (go): 찾을 수 있는 모든 링크를 인쇄합니다. ### 디렉토리 및 파일에 대한 무차별 대입 루트 폴더에서 **무차별 대입**을 시작하고 **이 방법**을 사용하여 발견된 **모든 디렉토리**와 **스파이더링**에 의해 **발견된** 모든 디렉토리를 무차별 대입해야 합니다(이 무차별 대입을 **재귀적으로** 수행하고 사용된 단어 목록의 시작 부분에 발견된 디렉토리의 이름을 추가할 수 있습니다).\ 도구: - **Dirb** / **Dirbuster** - Kali에 포함되어 있으며, **오래된** (및 **느린**) 기능이지만 작동합니다. 자동 서명된 인증서를 허용하고 재귀 검색을 지원합니다. 다른 옵션에 비해 너무 느립니다. - [**Dirsearch**](https://github.com/maurosoria/dirsearch) (python)**: 자동 서명된 인증서를 허용하지 않지만** 재귀 검색을 허용합니다. - [**Gobuster**](https://github.com/OJ/gobuster) (go): 자동 서명된 인증서를 허용하며, **재귀** 검색이 **없습니다**. - [**Feroxbuster**](https://github.com/epi052/feroxbuster) **- 빠르며, 재귀 검색을 지원합니다.** - [**wfuzz**](https://github.com/xmendez/wfuzz) `wfuzz -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt https://domain.com/api/FUZZ` - [**ffuf** ](https://github.com/ffuf/ffuf)- 빠름: `ffuf -c -w /usr/share/wordlists/dirb/big.txt -u http://10.10.10.10/FUZZ` - [**uro**](https://github.com/s0md3v/uro) (python): 이 도구는 스파이더는 아니지만 발견된 URL 목록을 주면 "중복된" URL을 삭제합니다. - [**Scavenger**](https://github.com/0xDexter0us/Scavenger): 다양한 페이지의 burp 기록에서 디렉토리 목록을 생성하는 Burp 확장입니다. - [**TrashCompactor**](https://github.com/michael1026/trashcompactor): 기능이 중복된 URL을 제거합니다(자바스크립트 가져오기를 기반으로). - [**Chamaleon**](https://github.com/iustin24/chameleon): 사용된 기술을 감지하기 위해 wapalyzer를 사용하고 사용할 단어 목록을 선택합니다. **추천 사전:** - [https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/bf_directories.txt](https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/bf_directories.txt) - [**Dirsearch** 포함 사전](https://github.com/maurosoria/dirsearch/blob/master/db/dicc.txt) - [http://gist.github.com/jhaddix/b80ea67d85c13206125806f0828f4d10](http://gist.github.com/jhaddix/b80ea67d85c13206125806f0828f4d10) - [Assetnote wordlists](https://wordlists.assetnote.io) - [https://github.com/danielmiessler/SecLists/tree/master/Discovery/Web-Content](https://github.com/danielmiessler/SecLists/tree/master/Discovery/Web-Content) - raft-large-directories-lowercase.txt - directory-list-2.3-medium.txt - RobotsDisallowed/top10000.txt - [https://github.com/random-robbie/bruteforce-lists](https://github.com/random-robbie/bruteforce-lists) - [https://github.com/google/fuzzing/tree/master/dictionaries](https://github.com/google/fuzzing/tree/master/dictionaries) - [https://github.com/six2dez/OneListForAll](https://github.com/six2dez/OneListForAll) - [https://github.com/random-robbie/bruteforce-lists](https://github.com/random-robbie/bruteforce-lists) - [https://github.com/ayoubfathi/leaky-paths](https://github.com/ayoubfathi/leaky-paths) - _/usr/share/wordlists/dirb/common.txt_ - _/usr/share/wordlists/dirb/big.txt_ - _/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt_ _무차별 대입 또는 스파이더링 중에 새로운 디렉토리가 발견될 때마다 무차별 대입해야 합니다._ ### 발견된 각 파일에서 확인할 사항 - [**Broken link checker**](https://github.com/stevenvachon/broken-link-checker): HTML 내에서 인수 취득에 취약할 수 있는 끊어진 링크를 찾습니다. - **파일 백업**: 모든 파일을 찾은 후, 모든 실행 파일의 백업을 찾습니다("_.php_", "_.aspx_"...). 백업 파일의 일반적인 명명 변형은 다음과 같습니다: _file.ext\~, #file.ext#, \~file.ext, file.ext.bak, file.ext.tmp, file.ext.old, file.bak, file.tmp 및 file.old._ 또한 [**bfac**](https://github.com/mazen160/bfac) **또는** [**backup-gen**](https://github.com/Nishantbhagat57/backup-gen)**를 사용할 수 있습니다.** - **새로운 매개변수 발견**: [**Arjun**](https://github.com/s0md3v/Arjun)**,** [**parameth**](https://github.com/maK-/parameth)**,** [**x8**](https://github.com/sh1yo/x8) **및** [**Param Miner**](https://github.com/PortSwigger/param-miner) **와 같은 도구를 사용하여 숨겨진 매개변수를 발견할 수 있습니다. 가능하다면 각 실행 웹 파일에서 숨겨진 매개변수를 검색해 보십시오.** - _Arjun 모든 기본 단어 목록:_ [https://github.com/s0md3v/Arjun/tree/master/arjun/db](https://github.com/s0md3v/Arjun/tree/master/arjun/db) - _Param-miner “params” :_ [https://github.com/PortSwigger/param-miner/blob/master/resources/params](https://github.com/PortSwigger/param-miner/blob/master/resources/params) - _Assetnote “parameters_top_1m”:_ [https://wordlists.assetnote.io/](https://wordlists.assetnote.io) - _nullenc0de “params.txt”:_ [https://gist.github.com/nullenc0de/9cb36260207924f8e1787279a05eb773](https://gist.github.com/nullenc0de/9cb36260207924f8e1787279a05eb773) - **주석:** 모든 파일의 주석을 확인하십시오. **자격 증명** 또는 **숨겨진 기능**을 찾을 수 있습니다. - **CTF**를 진행 중이라면, "일반적인" 트릭은 페이지의 **오른쪽**에 **정보**를 **숨기는 것**입니다(브라우저로 소스 코드를 열어도 데이터를 보지 못하도록 **수백 개의 공백**을 사용). 다른 가능성은 **여러 개의 새 줄**을 사용하고 웹 페이지의 **하단**에 주석으로 **정보를 숨기는 것**입니다. - **API 키**: **API 키**를 발견하면 다양한 플랫폼의 API 키 사용 방법을 안내하는 가이드가 있습니다: [**keyhacks**](https://github.com/streaak/keyhacks)**,** [**zile**](https://github.com/xyele/zile.git)**,** [**truffleHog**](https://github.com/trufflesecurity/truffleHog)**,** [**SecretFinder**](https://github.com/m4ll0k/SecretFinder)**,** [**RegHex**]()**,** [**DumpsterDive**](https://github.com/securing/DumpsterDiver)**,** [**EarlyBird**](https://github.com/americanexpress/earlybird) - Google API 키: **AIza**SyA-qLheq6xjDiEIRisP_ujUseYLQCHUjik와 같은 API 키를 발견하면 [**gmapapiscanner**](https://github.com/ozguralp/gmapsapiscanner) 프로젝트를 사용하여 키가 접근할 수 있는 API를 확인할 수 있습니다. - **S3 버킷**: 스파이더링 중에 **서브도메인**이나 **링크**가 **S3 버킷**과 관련이 있는지 확인하십시오. 그런 경우 [**버킷의 권한을 확인하십시오**](buckets/index.html). ### 특별 발견 **스파이더링** 및 **무차별 대입**을 수행하는 동안 **흥미로운** **사항**을 **주목**해야 할 수 있습니다. **흥미로운 파일** - **CSS** 파일 내의 다른 파일에 대한 **링크**를 찾습니다. - [**.git** 파일을 발견하면 일부 정보를 추출할 수 있습니다](git.md) - **.env**를 발견하면 API 키, DB 비밀번호 및 기타 정보를 찾을 수 있습니다. - **API 엔드포인트**를 발견하면 [테스트해야 합니다](web-api-pentesting.md). 이들은 파일은 아니지만 아마도 "파일처럼 보일" 것입니다. - **JS 파일**: 스파이더링 섹션에서 JS 파일에서 경로를 추출할 수 있는 여러 도구가 언급되었습니다. 또한 발견된 각 JS 파일을 **모니터링하는 것이 흥미로울 것입니다**. 경우에 따라 변경 사항이 코드에 잠재적인 취약점이 도입되었음을 나타낼 수 있습니다. 예를 들어 [**JSMon**](https://github.com/robre/jsmon)**을 사용할 수 있습니다.** - 발견된 JS 파일을 [**RetireJS**](https://github.com/retirejs/retire.js/) 또는 [**JSHole**](https://github.com/callforpapers-source/jshole)로 확인하여 취약한지 확인해야 합니다. - **Javascript Deobfuscator 및 Unpacker:** [https://lelinhtinh.github.io/de4js/](https://lelinhtinh.github.io/de4js/), [https://www.dcode.fr/javascript-unobfuscator](https://www.dcode.fr/javascript-unobfuscator) - **Javascript Beautifier:** [http://jsbeautifier.org/](https://beautifier.io), [http://jsnice.org/](http://jsnice.org) - **JsFuck 디오브퍼케이션** (문자와 함께 자바스크립트: "\[]!+" [https://enkhee-osiris.github.io/Decoder-JSFuck/](https://enkhee-osiris.github.io/Decoder-JSFuck/)) - [**TrainFuck**](https://github.com/taco-c/trainfuck)**:** `+72.+29.+7..+3.-67.-12.+55.+24.+3.-6.-8.-67.-23.` - 여러 경우에 **사용된 정규 표현식**을 **이해해야 할 필요가 있습니다**. 이는 유용할 것입니다: [https://regex101.com/](https://regex101.com) 또는 [https://pythonium.net/regex](https://pythonium.net/regex) - **양식이 감지된 파일을 모니터링**해야 할 수도 있습니다. 매개변수의 변경이나 새로운 양식의 출현은 잠재적인 새로운 취약한 기능을 나타낼 수 있습니다. **403 Forbidden/Basic Authentication/401 Unauthorized (우회)** {{#ref}} 403-and-401-bypasses.md {{#endref}} **502 Proxy Error** 어떤 페이지가 **이 코드**로 **응답**하면, 아마도 **잘못 구성된 프록시**일 것입니다. **`GET https://google.com HTTP/1.1`**와 같은 HTTP 요청을 보내면(호스트 헤더 및 기타 일반 헤더 포함), **프록시**는 _**google.com**_에 **접근**하려고 시도하며, 이로 인해 SSRF를 발견하게 됩니다. **NTLM 인증 - 정보 공개** 인증을 요청하는 서버가 **Windows**이거나 **자격 증명**(및 **도메인 이름** 요청)을 요구하는 로그인 화면을 발견하면 **정보 공개**를 유도할 수 있습니다.\ **헤더를 전송하십시오**: `“Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=”` 그리고 **NTLM 인증이 작동하는 방식** 때문에 서버는 "WWW-Authenticate" 헤더 내에 내부 정보(IIS 버전, Windows 버전 등...)로 응답할 것입니다.\ 이 작업은 **nmap 플러그인** "_http-ntlm-info.nse_"를 사용하여 자동화할 수 있습니다. **HTTP 리디렉션 (CTF)** **리디렉션** 내에 **내용을 넣는** 것이 가능합니다. 이 내용은 **사용자에게 표시되지 않습니다**(브라우저가 리디렉션을 실행하므로) 하지만 그 안에 **숨겨진** 것이 있을 수 있습니다. ### 웹 취약점 확인 웹 애플리케이션에 대한 포괄적인 열거가 수행되었으므로 이제 가능한 많은 취약점을 확인할 시간입니다. 체크리스트는 여기에서 찾을 수 있습니다: {{#ref}} ../../pentesting-web/web-vulnerabilities-methodology.md {{#endref}} 웹 취약점에 대한 더 많은 정보는 다음에서 찾을 수 있습니다: - [https://six2dez.gitbook.io/pentest-book/others/web-checklist](https://six2dez.gitbook.io/pentest-book/others/web-checklist) - [https://kennel209.gitbooks.io/owasp-testing-guide-v4/content/en/web_application_security_testing/configuration_and_deployment_management_testing.html](https://kennel209.gitbooks.io/owasp-testing-guide-v4/content/en/web_application_security_testing/configuration_and_deployment_management_testing.html) - [https://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection](https://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection) ### 페이지 변경 모니터링 [https://github.com/dgtlmoon/changedetection.io](https://github.com/dgtlmoon/changedetection.io)와 같은 도구를 사용하여 변경 사항을 모니터링하여 취약점을 삽입할 수 있습니다. ### HackTricks 자동 명령 ``` Protocol_Name: Web #Protocol Abbreviation if there is one. Port_Number: 80,443 #Comma separated if there is more than one. Protocol_Description: Web #Protocol Abbreviation Spelled out Entry_1: Name: Notes Description: Notes for Web Note: | https://book.hacktricks.wiki/en/network-services-pentesting/pentesting-web/index.html Entry_2: Name: Quick Web Scan Description: Nikto and GoBuster Command: nikto -host {Web_Proto}://{IP}:{Web_Port} &&&& gobuster dir -w {Small_Dirlist} -u {Web_Proto}://{IP}:{Web_Port} && gobuster dir -w {Big_Dirlist} -u {Web_Proto}://{IP}:{Web_Port} Entry_3: Name: Nikto Description: Basic Site Info via Nikto Command: nikto -host {Web_Proto}://{IP}:{Web_Port} Entry_4: Name: WhatWeb Description: General purpose auto scanner Command: whatweb -a 4 {IP} Entry_5: Name: Directory Brute Force Non-Recursive Description: Non-Recursive Directory Brute Force Command: gobuster dir -w {Big_Dirlist} -u {Web_Proto}://{IP}:{Web_Port} Entry_6: Name: Directory Brute Force Recursive Description: Recursive Directory Brute Force Command: python3 {Tool_Dir}dirsearch/dirsearch.py -w {Small_Dirlist} -e php,exe,sh,py,html,pl -f -t 20 -u {Web_Proto}://{IP}:{Web_Port} -r 10 Entry_7: Name: Directory Brute Force CGI Description: Common Gateway Interface Brute Force Command: gobuster dir -u {Web_Proto}://{IP}:{Web_Port}/ -w /usr/share/seclists/Discovery/Web-Content/CGIs.txt -s 200 Entry_8: Name: Nmap Web Vuln Scan Description: Tailored Nmap Scan for web Vulnerabilities Command: nmap -vv --reason -Pn -sV -p {Web_Port} --script=`banner,(http* or ssl*) and not (brute or broadcast or dos or external or http-slowloris* or fuzzer)` {IP} Entry_9: Name: Drupal Description: Drupal Enumeration Notes Note: | git clone https://github.com/immunIT/drupwn.git for low hanging fruit and git clone https://github.com/droope/droopescan.git for deeper enumeration Entry_10: Name: WordPress Description: WordPress Enumeration with WPScan Command: | ?What is the location of the wp-login.php? Example: /Yeet/cannon/wp-login.php wpscan --url {Web_Proto}://{IP}{1} --enumerate ap,at,cb,dbe && wpscan --url {Web_Proto}://{IP}{1} --enumerate u,tt,t,vp --passwords {Big_Passwordlist} -e Entry_11: Name: WordPress Hydra Brute Force Description: Need User (admin is default) Command: hydra -l admin -P {Big_Passwordlist} {IP} -V http-form-post '/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log In&testcookie=1:S=Location' Entry_12: Name: Ffuf Vhost Description: Simple Scan with Ffuf for discovering additional vhosts Command: ffuf -w {Subdomain_List}:FUZZ -u {Web_Proto}://{Domain_Name} -H "Host:FUZZ.{Domain_Name}" -c -mc all {Ffuf_Filters} ``` {{#include ../../banners/hacktricks-training.md}}