> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/zh/web/information-disclosure/authentication-bypass-via-information-disclosure.md).

# 通过信息泄露绕过身份验证

### 通过信息泄露绕过身份验证

该应用的管理界面包含一个身份验证绕过机制。它基于前端使用的一个自定义 HTTP 头，但事先未知。/ 要完成该实验，你需要识别该头的名称，利用它绕过身份验证，访问管理界面并删除用户 **carlos**.

**初始访问管理界面**

尝试直接通过以下方式访问管理页面 `/admin` 路由会返回以下消息：

> *管理界面仅对本地用户开放*

这表明访问仅限于来自本地主机的请求。

<figure><img src="/files/46b438df7cc18526d6c1faea31bf590a8751fb3b" alt=""><figcaption></figcaption></figure>

**通过 TRACE 方法泄露信息**

通过发送一个使用 `TRACE` 方法向 `/admin`发送 HTTP 请求，服务器会返回比需要更多的头部。

```bash
TRACE /admin
```

<figure><img src="/files/9bfcb436c60e7527afc15d6c42e25a89322778a2" alt=""><figcaption></figcaption></figure>

在这些信息中，泄露了一个自定义头：

```bash
X-Custom-Ip-Authorization
```

前端使用该头来判断请求是否来自本地用户。

**绕过身份验证**

在请求中添加以下头： `/admin`:

```bash
X-Custom-Ip-Authorization: 127.0.0.1
```

<figure><img src="/files/00296d50cc8445942f285aff080bd82dc0b355ab" alt=""><figcaption></figcaption></figure>

服务器会将该请求视为本地请求。/ 之后即可无需额外身份验证访问管理界面。

**最终利用**

连接到管理面板后，可以通过访问以下 URL 删除目标用户：

```bash
/admin/delete?username=carlos
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/zh/web/information-disclosure/authentication-bypass-via-information-disclosure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
