# 80,443 - Pentesting Web Methodology

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或 **关注**我们的**Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>

<figure><img src="https://615200056-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DLBZdNLkY4FUHtMnjPr%2Fuploads%2Fgit-blob-e70bceed6fa35760d025f037a78106ab025a68cd%2Fimage%20(1)%20(1)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

如果您对**黑客职业**感兴趣并想要攻破不可攻破的系统 - **我们正在招聘！**（需要流利的波兰语书面和口语表达能力）。

{% embed url="<https://www.stmcyber.com/careers>" %}

## 基本信息

Web服务是最**常见和广泛的服务**，存在许多**不同类型的漏洞**。

**默认端口：** 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指南

{% content-ref url="pentesting-web/web-api-pentesting" %}
[web-api-pentesting](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/web-api-pentesting)
{% endcontent-ref %}

## 方法概述

> 在这个方法论中，我们假设您将攻击一个域名（或子域名），仅限于此。因此，您应该将此方法应用于发现的每个域、子域或IP，其中包含未确定的Web服务器。

* [ ] 从**识别**Web服务器使用的**技术**开始。寻找在测试的其余部分中要记住的**技巧**，如果您能成功识别该技术。
* [ ] 该技术版本有任何**已知漏洞**吗？
* [ ] 使用任何**众所周知的技术**？有任何**有用的技巧**来提取更多信息吗？
* [ ] 有任何**专门的扫描工具**要运行（如wpscan）吗？
* [ ] 启动**通用目的扫描工具**。您永远不知道它们是否会找到任何东西或者是否会找到一些有趣的信息。
* [ ] 从**初始检查**开始：**robots**、**sitemap**、**404**错误和**SSL/TLS扫描**（如果是HTTPS）。
* [ ] 开始**爬取**网页：现在是时候**查找**所有可能的**文件、文件夹**和**正在使用的参数**。还要检查**特殊发现**。
* [ ] *请注意，每当在Brute-Forcing或爬取过程中发现新目录时，应该对其进行爬取。*
* [ ] **目录爆破**：尝试对所有发现的文件夹进行爆破，以搜索新的**文件**和**目录**。
* [ ] *请注意，每当在Brute-Forcing或爬取过程中发现新目录时，应该对其进行Brute-Forced。*
* [ ] **备份检查**：测试是否可以找到**发现文件**的**备份**，附加常见的备份扩展名。
* [ ] **暴力破解参数**：尝试**查找隐藏参数**。
* [ ] 一旦您已经**识别**了所有可能接受**用户输入**的**端点**，请检查与之相关的各种**漏洞**。
* [ ] [按照此检查清单进行操作](https://hacktricks.xsx.tw/pentesting-web/web-vulnerabilities-methodology)

## 服务器版本（存在漏洞吗？）

### 识别

检查运行的服务器**版本**是否存在**已知漏洞**。\
**响应的HTTP标头和Cookie**可能非常有用，可用于**识别**正在使用的**技术**和/或**版本**。**Nmap扫描**可以识别服务器版本，但也可以使用工具[**whatweb**](https://github.com/urbanadventurer/WhatWeb)**、**[**webtech**](https://github.com/ShielderSec/webtech)或[**https://builtwith.com/**](https://builtwith.com)**：**

```bash
whatweb -a 1 <URL> #Stealthy
whatweb -a 3 <URL> #Aggresive
webtech -u <URL>
webanalyze -host https://google.com -crawl 2
```

搜索[Web应用程序版本的漏洞](https://hacktricks.xsx.tw/generic-methodologies-and-resources/search-exploits)

### 检查是否有任何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技巧

一些用于查找不同知名技术中的漏洞的技巧：

* [**AEM - Adobe Experience Cloud**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/aem-adobe-experience-cloud)
* [**Apache**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/apache)
* [**Artifactory**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/artifactory-hacking-guide)
* [**Buckets**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/buckets)
* [**CGI**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/cgi)
* [**Drupal**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/drupal)
* [**Flask**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/flask)
* [**Git**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/git)
* [**Golang**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/golang)
* [**GraphQL**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/graphql)
* [**H2 - Java SQL database**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/h2-java-sql-database)
* [**IIS tricks**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/iis-internet-information-services)
* [**JBOSS**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/jboss)
* [**Jenkins**](https://github.com/carlospolop/hacktricks/blob/master/network-services-pentesting/pentesting-web/broken-reference/README.md)
* [**Jira**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/jira)
* [**Joomla**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/joomla)
* [**JSP**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/jsp)
* [**Laravel**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/laravel)
* [**Moodle**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/moodle)
* [**Nginx**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/nginx)
* [**PHP (php has a lot of interesting tricks that could be exploited)**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/php-tricks-esp)
* [**Python**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/python)
* [**Spring Actuators**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/spring-actuators)
* [**Symphony**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/symphony)
* [**Tomcat**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/tomcat)
* [**VMWare**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/vmware-esx-vcenter...)
* [**Web API Pentesting**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/web-api-pentesting)
* [**WebDav**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/put-method-webdav)
* [**Werkzeug**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/werkzeug)
* [**Wordpress**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/wordpress)
* [**Electron Desktop (XSS to RCE)**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/electron-desktop-apps)

*请注意，同一域名可能在不同端口、文件夹和子域中使用不同的技术。*\
如果Web应用程序使用任何之前列出的知名技术/平台或其他任何技术，请不要忘记在互联网上搜索新的技巧（并告诉我！）。

### 源代码审查

如果应用程序的源代码在github上可用，除了自行对应用程序进行白盒测试外，还有一些信息对当前的黑盒测试可能有用：

* 是否有通过Web访问的**变更日志、自述文件或版本**信息文件？
* 凭证是如何保存的？是否有（可访问的）带有凭证（用户名或密码）的文件？
* 密码是明文、加密还是使用了哪种哈希算法？
* 是否使用了任何用于加密的主密钥？使用了哪种算法？
* 您能否利用某些漏洞访问这些文件？
* 在github的（已解决和未解决的）问题中是否有任何有趣的信息？或在提交历史中（也许在旧提交中引入了某些密码）？

{% content-ref url="pentesting-web/code-review-tools" %}
[code-review-tools](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/code-review-tools)
{% endcontent-ref %}

### 自动扫描器

#### 通用用途的自动扫描器

```bash
nikto -h <URL>
whatweb -a 4 <URL>
wapiti -u <URL>
W3af
zaproxy #You can use an API
nuclei -ut && nuclei -target <URL>

# 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**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/jboss)**，ColdFusion，WebLogic，** [**Tomcat**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/tomcat)**，Railo，Axis2，Glassfish**\
[**CMSScan**](https://github.com/ajinabraham/CMSScan)：为[**WordPress**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/wordpress)、[**Drupal**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/drupal)、**Joomla**、**vBulletin**网站查找安全问题（GUI）\
[**VulnX**](https://github.com/anouarbensaad/vulnx)**：** [**Joomla**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/joomla)**，** [**Wordpress**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/wordpress)**，** [**Drupal**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/drupal)**，PrestaShop，Opencart**\
**CMSMap**：[**(W)ordpress**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/wordpress)**，** [**(J)oomla**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/joomla)**，** [**(D)rupal**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/drupal)**或** [**(M)oodle**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/moodle)\
[**droopscan**](https://github.com/droope/droopescan)**：** [**Drupal**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/drupal)**，** [**Joomla**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/joomla)**，** [**Moodle**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/moodle)**，Silverstripe，** [**Wordpress**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/wordpress)

```bash
cmsmap [-f W] -F -d <URL>
wpscan --force update -e --url <URL>
joomscan --ec -u <URL>
joomlavs.rb #https://github.com/rastating/joomlavs
```

> 到这一步，您应该已经获得了客户使用的Web服务器的一些信息（如果提供了任何数据），以及在测试过程中要牢记的一些技巧。如果幸运的话，您甚至可能已经找到了一个CMS并运行了一些扫描器。

## 逐步Web应用程序发现

> 从这一点开始，我们将开始与Web应用程序进行交互。

### 初始检查

**具有有趣信息的默认页面：**

* /robots.txt
* /sitemap.xml
* /crossdomain.xml
* /clientaccesspolicy.xml
* /.well-known/
* 还要检查主页面和次要页面中的注释。

**强制错误**

当向Web服务器发送奇怪的数据时，Web服务器可能会**表现出意外行为**。这可能会打开**漏洞**或**泄露敏感信息**。

* 访问像/whatever\_fake.php (.aspx，.html，等)这样的**虚假页面**
* 在**cookie值**和**参数值**中添加"\[]", "]]"和"\[\["以创建错误
* 通过在**URL**的**末尾**输入\*\*`/~randomthing/%s`\*\*来生成错误
* 尝试使用**不同的HTTP谓词**，如PATCH，DEBUG或错误的FAKE

#### **检查是否可以上传文件（**[**PUT谓词，WebDav**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/put-method-webdav)**）**

如果发现**WebDav**已**启用**但您没有足够的权限在根文件夹中**上传文件**，请尝试：

* **暴力破解**凭据
* 通过WebDav**上传文件**到Web页面内**找到的其他文件夹**。您可能有权限在其他文件夹中上传文件。

### **SSL/TLS漏洞**

* 如果应用程序在任何部分**没有强制使用HTTPS**，那么它**容易受到中间人攻击**
* 如果应用程序**使用HTTP发送敏感数据（密码）**。那么这是一个高漏洞。

使用[**testssl.sh**](https://github.com/drwetter/testssl.sh)来检查**漏洞**（在Bug赏金计划中，这类漏洞可能不会被接受），并使用[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 <host:port>
sslyze --regular <ip:port>
```

SSL/TLS漏洞信息：

* <https://www.gracefulsecurity.com/tls-ssl-vulnerabilities/>
* <https://www.acunetix.com/blog/articles/tls-vulnerabilities-attacks-final-part/>

### 爬虫

在网络中启动某种**爬虫**。爬虫的目标是从被测试应用程序中**找到尽可能多的路径**。因此，应使用网络爬行和外部来源来找到尽可能多的有效路径。

* [**gospider**](https://github.com/jaeles-project/gospider) (go)：HTML爬虫，JS文件中的LinkFinder和外部来源（Archive.org、CommonCrawl.org、VirusTotal.com、AlienVault.com）。
* [**hakrawler**](https://github.com/hakluke/hakrawler) (go)：HML爬虫，带有JS文件和Archive.org的LinkFider作为外部来源。
* [**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文件中搜索新路径。还值得一看[JSScanner](https://github.com/dark-warlord14/JSScanner)，它是LinkFinder的包装器。
* [**goLinkFinder**](https://github.com/0xsha/GoLinkFinder) (go)：用于提取HTML源代码和嵌入式javascript文件中的端点。对于漏洞猎人、红队人员、信息安全专家很有用。
* [**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），它将使用巧妙的正则表达式从中提取URL，以查找并提取丑陋（压缩）文件中的相对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机器中发现链接（还下载wayback中的响应并查找更多链接）。
* [**HTTPLoot**](https://github.com/redhuntlabs/HTTPLoot) (go)：爬行（甚至通过填写表单）并使用特定的正则表达式查找敏感信息。
* [**SpiderSuite**](https://github.com/3nock/SpiderSuite)：Spider Suite是一款专为网络安全专业人员设计的高级多功能GUI网络安全爬虫/蜘蛛。
* [**jsluice**](https://github.com/BishopFox/jsluice) (go)：这是一个用于从JavaScript源代码中提取URL、路径、秘密和其他有趣数据的Go包和[命令行工具](https://github.com/BishopFox/jsluice/blob/main/cmd/jsluice)。
* [**ParaForge**](https://github.com/Anof-cyber/ParaForge)：ParaForge是一个简单的**Burp Suite扩展**，用于从请求中提取参数和端点，以创建用于模糊测试和枚举的自定义字典。
* [**katana**](https://github.com/projectdiscovery/katana) (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（基于js导入）
* [**Chamaleon**](https://github.com/iustin24/chameleon)：使用wapalyzer检测使用的技术并选择要使用的字典。

**推荐字典：**

* <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>
* [Assetnote wordlists](https://wordlists.assetnote.io)
* <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/google/fuzzing/tree/master/dictionaries>
* <https://github.com/six2dez/OneListForAll>
* <https://github.com/random-robbie/bruteforce-lists>
* <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*

*请注意，每当在暴力破解或爬虫过程中发现新目录时，应进行暴力破解。*

### 每个找到的文件要检查的内容

* [**损坏链接检查器**](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) **等工具来发现隐藏参数。如果可以的话，您可以尝试在每个可执行的Web文件上搜索**隐藏的参数。
* *Arjun所有默认字典：* <https://github.com/s0md3v/Arjun/tree/master/arjun/db>
* *Param-miner “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>
* **注释**：检查所有文件的注释，您可以找到**凭证**或**隐藏功能**。
* 如果您在进行**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**](https://github.com/l4yton/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存储桶**相关。在这种情况下，[**检查**存储桶的**权限**](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/buckets)。

### 特殊发现

**在**执行**爬行**和**暴力破解**时，您可能会发现一些**有趣的** **事物**，您需要**注意**。

**有趣的文件**

* 查找**CSS**文件中指向其他文件的**链接**。
* [如果找到一个 ***.git*** 文件，可以提取一些信息](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/git)
* 如果找到一个 ***.env*** 文件，可能会发现诸如API密钥、数据库密码和其他信息。
* 如果找到**API端点**，您[也应该测试它们](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/web-api-pentesting)。这些不是文件，但可能会“看起来像”它们。
* **JS文件**：在爬行部分提到了几个可以从JS文件中提取路径的工具。此外，**监视每个找到的JS文件**也很有趣，因为在某些情况下，更改可能表明代码中引入了潜在的漏洞。您可以使用例如[**JSMon**](https://github.com/robre/jsmon)**。**
* 您还应该使用[**RetireJS**](https://github.com/retirejs/retire.js/)或[**JSHole**](https://github.com/callforpapers-source/jshole)检查发现的JS文件是否存在漏洞。
* **Javascript去混淆器和解包器**：<https://lelinhtinh.github.io/de4js/>，<https://www.dcode.fr/javascript-unobfuscator>
* **Javascript美化器**：[http://jsbeautifier.org/](https://beautifier.io)，[http://jsnice.org/](http://jsnice.org)
* **JsFuck去混淆**（包含字符：“\[]!+” <https://ooze.ninja/javascript/poisonjs/>)
* [**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)
* 您还可以**监视检测到表单的文件**，因为参数的更改或新表单的出现可能表明潜在的新易受攻击的功能。

**403 Forbidden/基本身份验证/401未经授权（绕过）**

{% content-ref url="pentesting-web/403-and-401-bypasses" %}
[403-and-401-bypasses](https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/403-and-401-bypasses)
{% endcontent-ref %}

**502 代理错误**

如果任何页面以该**代码**响应，那么可能是**配置不良的代理**。**如果您发送类似以下的HTTP请求：`GET https://google.com HTTP/1.1`**（带有主机头和其他常见头），**代理**将尝试**访问*****google.com***，您将发现一个**SSRF**。

**NTLM身份验证 - 信息泄露**

如果正在请求身份验证的运行服务器是**Windows**，或者您找到一个要求您**凭证**的登录（并要求**域** **名**），您可以引发**信息泄露**。\
**发送** **头部**：`“Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=”`，由于**NTLM身份验证的工作方式**，服务器将在“WWW-Authenticate”头部中回复内部信息（IIS版本、Windows版本...）。\
您可以使用**nmap插件**“*http-ntlm-info.nse*”来**自动化**这个过程。

**HTTP重定向（CTF）**

可以在**重定向**中**放置内容**。这些内容**不会显示给用户**（因为浏览器将执行重定向），但其中可能**隐藏**着一些内容。

### Web漏洞检查

现在已经执行了对Web应用程序的全面枚举，是时候检查可能存在的许多漏洞了。您可以在这里找到检查清单：

{% content-ref url="../pentesting-web/web-vulnerabilities-methodology" %}
[web-vulnerabilities-methodology](https://hacktricks.xsx.tw/pentesting-web/web-vulnerabilities-methodology)
{% endcontent-ref %}

在以下链接中查找有关Web漏洞的更多信息：

* <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://owasp-skf.gitbook.io/asvs-write-ups/kbid-111-client-side-template-injection>

### 监控页面更改

您可以使用工具如<https://github.com/dgtlmoon/changedetection.io>来监视页面的修改，以防止可能插入漏洞。

<figure><img src="https://615200056-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1DLBZdNLkY4FUHtMnjPr%2Fuploads%2Fgit-blob-e70bceed6fa35760d025f037a78106ab025a68cd%2Fimage%20(1)%20(1)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

如果您对**黑客职业**感兴趣并想要攻破不可攻破的系统 - **我们正在招聘！**（需要流利的波兰语书面和口语表达能力）。

{% embed url="<https://www.stmcyber.com/careers>" %}

### 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.xyz/pentesting/pentesting-web

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}
```

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS Red Team Expert）</strong></a><strong>！</strong></summary>

其他支持HackTricks的方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或 **关注**我们的**Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>
