Swagger API Exploit 1.2 - 信息泄露利用工具

admin 2025年1月19日20:38:38评论11 views字数 2864阅读9分32秒阅读模式
 

0x01 工具介绍

这是一个 Swagger REST API 信息泄露利用工具。 主要功能有:
  • 遍历所有API接口,自动填充参数
  • 尝试 GET / POST 所有接口,返回 Response Code / Content-Type / Content-Length ,用于分析接口是否可以未授权访问利用
  • 分析接口是否存在敏感参数,例如url参数,容易引入外网的SSRF漏洞

  • 检测 API认证绕过漏洞

  • 在本地监听一个Web Server,打开Swagger UI界面,供分析接口使用

  • 使用Chrome打开本地Web服务器,并禁用CORS,解决部分API接口无法跨域请求的问题

  • 当工具检测到HTTP认证绕过漏洞时,本地服务器拦截API文档,修改path,以便直接在Swagger UI中进行测试

需要介入分析 api_summary.txt 文件中的内容 扫描所有API集,打开Swagger UI
python swagger-exp.py http://site.com/swagger-resources/

扫描一个API集,打开Swagger UI

python swagger-exp.py http://site.com/v2/api-docs

只打开Swagger UI,不扫描接口

python swagger-exp.py
Swagger API Exploit 1.2 - 信息泄露利用工具
root@localhost# python swagger-exp.py[14:50:06] Swagger UI Server on: http://127.0.0.1:51979[14:50:06] Open Swagger UI with chrome127.0.0.1 - - [19/Jan/2025 14:50:12] "GET / HTTP/1.1" 200 -127.0.0.1 - - [19/Jan/2025 14:50:12] "GET /static/validator HTTP/1.1" 200 -127.0.0.1 - - [19/Jan/2025 14:50:12] "GET /static/swagger-ui.css HTTP/1.1" 200 -127.0.0.1 - - [19/Jan/2025 14:50:12] "GET /static/swagger-ui-bundle.js HTTP/1.1" 200 -127.0.0.1 - - [19/Jan/2025 14:50:12] "GET /static/swagger-ui-standalone-preset.js HTTP/1.1" 200 -127.0.0.1 - - [19/Jan/2025 14:50:12] code 404, message File not found127.0.0.1 - - [19/Jan/2025 14:50:12] "GET /api-docs.json HTTP/1.1" 404 -127.0.0.1 - - [19/Jan/2025 14:50:12] code 404, message File not found127.0.0.1 - - [19/Jan/2025 14:50:12] "GET /favicon.ico HTTP/1.1" 404 -
访问命令行给出的地址即可访问到Swagger API Exploit 进行愉快的渗透测试了,我这里是 http://127.0.0.1:51979
Swagger API Exploit 1.2 - 信息泄露利用工具

0x02 Swagger API 接口大全

Swagger 的指纹是 app="Swagger"
Swagger API Exploit 1.2 - 信息泄露利用工具
/api/api-docs/api-docs/swagger.json/api.html/api/api-docs/api/apidocs/api/doc/api/swagger/api/swagger-ui/api/swagger-ui.html/api/swagger-ui.html//api/swagger-ui.json/api/swagger.json/api/swagger//api/swagger/ui/api/swagger/ui//api/swaggerui/api/swaggerui//api/v1//api/v1/api-docs/api/v1/apidocs/api/v1/swagger/api/v1/swagger-ui/api/v1/swagger-ui.html/api/v1/swagger-ui.json/api/v1/swagger.json/api/v1/swagger//api/v2/api/v2/api-docs/api/v2/apidocs/api/v2/swagger/api/v2/swagger-ui/api/v2/swagger-ui.html/api/v2/swagger-ui.json/api/v2/swagger.json/api/v2/swagger//api/v3/apidocs/apidocs/swagger.json/doc.html/docs//druid/index.html/graphql/libs/swaggerui/libs/swaggerui//spring-security-oauth-resource/swagger-ui.html/spring-security-rest/api/swagger-ui.html/sw/swagger-ui.html/swagger/swagger-resources/swagger-resources/configuration/security/swagger-resources/configuration/security//swagger-resources/configuration/ui/swagger-resources/configuration/ui//swagger-ui/swagger-ui.html/swagger-ui.html#/api-memory-controller/swagger-ui.html//swagger-ui.json/swagger-ui/swagger.json/swagger.json/swagger.yml/swagger//swagger/index.html/swagger/static/index.html/swagger/swagger-ui.html/swagger/ui//Swagger/ui/index/swagger/ui/index/swagger/v1/swagger.json/swagger/v2/swagger.json/template/swagger-ui.html/user/swagger-ui.html/user/swagger-ui.html//v1.x/swagger-ui.html/v1/api-docs/v1/swagger.json/v2/api-docs/v3/api-docs

0x03 工具下载

https://github.com/lijiejie/swagger-exp

 

原文始发于微信公众号(星悦安全):【工具分享】Swagger API Exploit 1.2 - 信息泄露利用工具

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年1月19日20:38:38
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Swagger API Exploit 1.2 - 信息泄露利用工具https://cn-sec.com/archives/3647251.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息