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

要教会 阅读:992 2025-01-30 09:11:37 评论:0

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://www.yaojiaohui.net/swagger-resources/

    扫描一个API集,打开Swagger UI

    python swagger-exp.py http://www.yaojiaohui.net/v2/api-docs

    只打开Swagger UI,不扫描接口

    python swagger-exp.py
    要教会.jpeg
    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 chrome
    127.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 found
    127.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 found
    127.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

    要教会

    0x02 Swagger API 接口大全


    Swagger 的指纹是 app="Swagger"

    要教会.jpeg
    /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

    下载地址:

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

    本文为要教会原创,欢迎转载分享。转载时请务必在文章页面明显位置提供本文链接并注明出处。感谢您对知识的尊重和对本文的肯定!本文链接网址:https://yaojiaohui.net/wangluoanquan/1108.html

    声明

    1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

    搜索
    排行榜
    关注我们

    扫一扫关注我们,了解最新精彩内容