# 403 & 401 Bypasses

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

<figure><img src="/files/Sk2ufgoXhHKAYGBttFiX" alt=""><figcaption></figcaption></figure>

**即时可用的漏洞评估和渗透测试设置**。从侦察到报告，使用20多种工具和功能进行完整的渗透测试。我们不取代渗透测试人员 - 我们开发定制工具、检测和利用模块，让他们有更多时间深入挖掘、弹出shell并享受乐趣。

{% embed url="<https://pentest-tools.com/>" %}

## HTTP动词/方法模糊

尝试使用**不同的动词**访问文件：`GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH, INVENTED, HACK`

* 检查响应头，也许会提供一些信息。例如，对于带有`Content-Length: 55`的**HEAD响应200**，意味着**HEAD动词可以访问信息**。但您仍然需要找到一种方法来外泄该信息。
* 使用类似`X-HTTP-Method-Override: PUT`的HTTP头可以覆盖使用的动词。
* 使用\*\*`TRACE`**动词，如果非常幸运，也许在响应中您还可以看到由中间代理添加的**头信息\*\*，这可能会很有用。

## HTTP头部模糊

* 将**Host头部更改**为某个任意值（[在这里有效](https://medium.com/@sechunter/exploiting-admin-panel-like-a-boss-fc2dd2499d31)）
* 尝试[**使用其他用户代理**](https://github.com/danielmiessler/SecLists/blob/master/Fuzzing/User-Agents/UserAgents.fuzz.txt)访问资源。
* **模糊HTTP头部**：尝试使用HTTP代理**头部**、HTTP身份验证基本和NTLM暴力破解（仅使用少量组合）和其他技术。为了执行所有这些操作，我创建了工具[**fuzzhttpbypass**](https://github.com/carlospolop/fuzzhttpbypass)。
* `X-Originating-IP: 127.0.0.1`
* `X-Forwarded-For: 127.0.0.1`
* `X-Forwarded: 127.0.0.1`
* `Forwarded-For: 127.0.0.1`
* `X-Remote-IP: 127.0.0.1`
* `X-Remote-Addr: 127.0.0.1`
* `X-ProxyUser-Ip: 127.0.0.1`
* `X-Original-URL: 127.0.0.1`
* `Client-IP: 127.0.0.1`
* `True-Client-IP: 127.0.0.1`
* `Cluster-Client-IP: 127.0.0.1`
* `X-ProxyUser-Ip: 127.0.0.1`
* `Host: localhost`

如果路径受到保护，您可以尝试使用以下其他头部来绕过路径保护：

* `X-Original-URL: /admin/console`
* `X-Rewrite-URL: /admin/console`
* 如果页面**位于代理后面**，也许是代理阻止您访问私人信息。尝试滥用[**HTTP请求劫持**](/pentesting-web/http-request-smuggling.md) **或** [**逐跳头部**](/pentesting-web/abusing-hop-by-hop-headers.md)**。**
* 在模糊**HTTP方法**的同时，模糊[**特殊HTTP头部**](/network-services-pentesting/pentesting-web/special-http-headers.md)。
* **删除Host头部**，也许您将能够绕过保护。

## 路径**模糊**

如果\_/path\_被阻止：

* 尝试使用\_**/**\_**%2e/path \_(如果访问被代理阻止，这可能会绕过保护)。也尝试**\_\*\* /%252e\*\*/path（双URL编码）\*\*
* 尝试**Unicode绕过**：*/**%ef%bc%8f**path*（URL编码字符类似于“/”），因此当解码后，它将变为\_//path\_，也许您已经绕过了\_path\_名称检查
* **其他路径绕过**：
* site.com/secret –> HTTP 403 Forbidden
* site.com/SECRET –> HTTP 200 OK
* site.com/secret/ –> HTTP 200 OK
* site.com/secret/. –> HTTP 200 OK
* site.com//secret// –> HTTP 200 OK
* site.com/./secret/.. –> HTTP 200 OK
* site.com/;/secret –> HTTP 200 OK
* site.com/.;/secret –> HTTP 200 OK
* site.com//;//secret –> HTTP 200 OK
* site.com/secret.json –> HTTP 200 OK (ruby)
* 在以下情况下使用所有[**此列表**](https://github.com/danielmiessler/SecLists/blob/master/Fuzzing/Unicode.txt)：
* /FUZZsecret
* /FUZZ/secret
* /secretFUZZ
* **其他API绕过**：
* /v3/users\_data/1234 --> 403 Forbidden
* /v1/users\_data/1234 --> 200 OK
* {“id”:111} --> 401 未经授权
* {“id”:\[111]} --> 200 OK
* {“id”:111} --> 401 未经授权
* {“id”:{“id”:111}} --> 200 OK
* {"user\_id":"\<legit\_id>","user\_id":"\<victims\_id>"} (JSON参数污染)
* user\_id=ATTACKER\_ID\&user\_id=VICTIM\_ID (参数污染)

## **参数操纵**

* 更改 **参数值**：从 **`id=123` --> `id=124`**
* 向URL添加额外参数：`?`**`id=124` —-> `id=124&isAdmin=true`**
* 删除参数
* 重新排列参数
* 使用特殊字符。
* 在参数中执行边界测试 — 提供值如 *-234* 或 *0* 或 *99999999*（仅为示例值）。

## **协议版本**

如果使用HTTP/1.1 **尝试使用1.0**，甚至测试是否**支持2.0**。

## **其他绕过方式**

* 获取域的 **IP** 或 **CNAME**，尝试**直接联系**。
* 尝试**压力测试服务器**发送常见的GET请求（[这个家伙在Facebook上成功了](https://medium.com/@amineaboud/story-of-a-weird-vulnerability-i-found-on-facebook-fc0875eb5125)）。
* **更改协议**：从http到https，或从https到http
* 前往[**https://archive.org/web/**](https://archive.org/web/)，检查过去该文件是否**全球可访问**。

## **暴力破解**

* **猜测密码**：测试以下常见凭据。您了解受害者的情况吗？或者CTF挑战的名称？
* [**暴力破解**](/generic-methodologies-and-resources/brute-force.md#http-brute)**：** 尝试基本、摘要和NTLM身份验证。

{% code title="常见凭据" %}

```
```

{% endcode %}

```
admin    admin
admin    password
admin    1234
admin    admin1234
admin    123456
root     toor
test     test
guest    guest
```

## 自动化工具

* <https://github.com/lobuhi/byp4xx>
* <https://github.com/iamj0ker/bypass-403>
* <https://github.com/gotr00t0day/forbiddenpass>
* [Burp扩展 - 403 Bypasser](https://portswigger.net/bappstore/444407b96d9c4de0adb7aed89e826122)
* [Forbidden Buster](https://github.com/Sn1r/Forbidden-Buster)

<figure><img src="/files/Sk2ufgoXhHKAYGBttFiX" alt=""><figcaption></figcaption></figure>

**即时可用的漏洞评估和渗透测试设置**。从任何地方运行完整的渗透测试，具有从侦察到报告的20多种工具和功能。我们不取代渗透测试人员 - 我们开发定制工具、检测和利用模块，让他们有更多时间深入挖掘、弹出shell并享受乐趣。

{% embed url="<https://pentest-tools.com/>" %}

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hacktricks.xsx.tw/network-services-pentesting/pentesting-web/403-and-401-bypasses.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
