API testing | PortSwigger靶场

URL:API testing | Web Security Academy

第一关:Exploiting an API endpoint using documentation

To solve the lab, find the exposed API documentation and delete carlos. You can log in to your own account using the following credentials: wiener:peter.

使用wiener:peter账号登录后,选择更新email,同时使用burpsuite抓包;

在http记录中看到此api接口 /api/user/wiener ;

结合题目需要删除carlos,将wiener换成carlos

但是只能看到用户名和邮箱,因此查找别的接口;访问/api看到此处为api文档;

注:以下三个接口通常为api文档

  • /api
  • /swagger/index.html
  • /openapi.json

选择删除carlos,通过第一关;

第二关:​Exploiting server-side parameter pollution in a query string

注:具体的原理可以看官方的Solution

To solve the lab, log in as the administrator and delete carlos.

靶场要求登录administrator并删除carlos,但是我们没有administrator的密码。

在登录页面,选择忘记密码,点击提交,同时使用burpsuite进行抓包;

看到了两个有用的api /forgot-password 和  /static/js/forgotPassword.js ;

在 /static/js/forgotPassword.js中看到:

window.location.href = `/forgot-password?reset_token=${resetToken}`;

将username改为:

username=administrator%26field=reset_token%23

然后send,发现回包中返回了reset_token的值;

注:为什么这么构造username字段,官方的Solution里有详细的解释,这里我懒得写了(

构造URL  /forgot-password?reset_token=t9n0jro1o552p8vbiyyuwl2hiczz9mx8 

然后修改密码后即可登录,进入Admin panel 删除carlos账号,通过第二关。

第三关:Finding and exploiting an unused API endpoint

To solve the lab, exploit a hidden API endpoint to buy a Lightweight l33t Leather Jacket. You can log in to your own account using the following credentials: wiener:peter.

找到 /api/products/1/price 这个api;

使用POST进行尝试,从回包看出其只支持GET和PATCH;

尝试使用PATCH,发现Content-type需要是application/json;

将其修改一下但是回包没什么信息;

请求包中添加 {"price":0} ,看到回包中显示价格为0;然后在首页中看到商品变为0元;

加入购物车并购买后,通过第三关。

第四关:Exploiting a mass assignment vulnerability

To solve the lab, find and exploit a mass assignment vulnerability to buy a Lightweight l33t Leather Jacket. You can log in to your own account using the following credentials: wiener:peter.

在进入后进行一些操作后,看到api  /api/checkout ;

可以看到在回包中的一些结构

构造payload,回包中没有发现错误;

修改percentage的值为100,放包后发现成功通过第四关。

第五关:​Exploiting server-side parameter pollution in a REST URL

URL:Lab: Exploiting server-side parameter pollution in a REST URL | Web Security Academy

懒得做了,感兴趣可以做一下。

  • 20
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值