Burp Web Academy 访问控制漏洞(三)
0x01. PortSwigger Web Security Academy
PortSwigger Web Security Academy 是 Burp Suite 官方推出的免费 Web 安全学习靶场,在学习 Web 安全知识的同时,还可以练习 Burp Suite 的实战技能。
本篇文章讲解 Web Security Academy 之中的访问控制漏洞(Access Control Vulnerabilities)章节。
- Part1: Burp Web Academy 访问控制漏洞
- Part2: Burp Web Academy 访问控制漏洞(二)
- Part3: Burp Web Academy 访问控制漏洞(三)
0x02. 访问控制漏洞
2.1 Lab: Method-based access control can be circumvented
This lab implements access controls based partly on the HTTP method of requests. You can familiarize yourself with the admin panel by logging in using the credentials
administrator:admin
.To solve the lab, log in using the credentials
wiener:peter
and exploit the flawed access controls to promote yourself to become an administrator.
先使用 administrator
登录,发现有一个用户管理页面,可以对用户的级别进行调整(升级为管理员、降级为普通用户),先测试抓包。
然后,使用 wiener
登录,并尝试对自身进行升级操作(注意把 Cookie 设置为 wiener
的值):
1 | POST /admin-roles |
提示 Unauthorized
:
1 | 401 Unauthorized |
根据题目提示,改成 GET
请求,成功提升至管理员权限:
1 | GET /admin-roles?username=wiener&action=upgrade |
看来同时支持 GET
和 POST
,但是仅仅对 POST
做了鉴权操作。
2.2 Lab: Multi-step process with no access control on one step
This lab has an admin panel with a flawed multi-step process for changing a user’s role. You can familiarize yourself with the admin panel by logging in using the credentials
administrator:admin
.To solve the lab, log in using the credentials
wiener:peter
and exploit the flawed access controls to promote yourself to become an administrator.
先使用 administrator
登录,发现有一个用户管理页面,可以对用户的级别进行调整(升级为管理员、降级为普通用户),但是有二次确认,抓包对比。
第一步,升级用户:
1 | POST /admin-roles |
会提示是否确认升级操作,可以返回,也可以确认。如果确认,也会触发 POST
请求:
1 | POST /admin-roles |
同样的 URL,只不过多了一个参数 confirmed=true
。直接使用 wiener
登录,替换 Cookie 后发送上述请求,即可提升至管理员权限。
2.3 Lab: Referer-based access control
This lab controls access to certain admin functionality based on the Referer header. You can familiarize yourself with the admin panel by logging in using the credentials
administrator:admin
.To solve the lab, log in using the credentials
wiener:peter
and exploit the flawed access controls to promote yourself to become an administrator.
不要太简单,抓取 administrator
的数据包,使用 wiener
登录,替换 Cookie 后发送上述请求,即可提升至管理员权限。
当然,题目描述是使用了 Referer
鉴权,这个是很简单也很经典的问题,比如有些网站会禁止盗链图片,就是通过 Referer
来完成的。
如果删掉 Referer
,就会返回未授权:
1 | 401 Unauthorized |
0x03. 小结
- 尝试使用不同的请求方法,
GET
、POST
等,看是否存在鉴权漏洞 - 观察不同操作对应的 HTTP 请求,看看参数有无区别
- 绕过基于
Referer
的鉴权