> For the complete documentation index, see [llms.txt](https://jtz.gitbook.io/web-security/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jtz.gitbook.io/web-security/web-shen-tou-ce-shi/idor-1.md).

# IDOR

## 介绍

IDOR 漏洞又称 `不安全的直接对象引用`，是一种访问控制漏洞,当服务器对于用户提供的数据 (文件、数据、文档)进行过滤时，如果过滤不严谨就会产生此漏洞。举一个例子：

在实际生活中，运行网站的服务器很有可能和数据库服务器不在同一个机器上，所以当需要数据库信息调用时就会去数据库请求数据，但是如果我们可以修改服务器向数据库发起请求的内容，使其访问另一个服务器这时候就会出现 IDOR 漏洞

## 位置

* AJAX 请求
* JS 文件中
* 未引用的参数

## 攻击

### 1. ID

> 在请求资源时，URL 中可能存在 ID 之类的参数，服务器根据 ID 来获取数据

```shell
http://online-service.thm/profile?user_id=1305  # 比如 user_id 参数
```

* ID 可能在 cookie 或者 URl 中并且会 `编码 或者 hash` 这时候我们需要解码

### 2. 不可预测的 ID

> 我们可以创建两个账号并在他们之间交互 ID 号，如果可以查看其他用户内容，说明存在 IDOR漏洞
