├── .gitignore ├── README.md ├── index.html ├── lib ├── __init__.py └── common.py ├── screenshot.png ├── screenshot2.png ├── static ├── swagger-ui-bundle.js ├── swagger-ui-standalone-preset.js ├── swagger-ui.css └── validator └── swagger-exp.py /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | chromeSwagger/ 3 | api_summary.txt 4 | api-docs.json 5 | *.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # **Swagger API Exploit 1.2** 2 | 3 | 这是一个 Swagger REST API 信息泄露利用工具。 主要功能有: 4 | 5 | * 遍历所有API接口,自动填充参数 6 | * 尝试 GET / POST 所有接口,返回 Response Code / Content-Type / Content-Length ,用于分析接口是否可以未授权访问利用 7 | * 分析接口是否存在敏感参数,例如url参数,容易引入外网的SSRF漏洞 8 | * 检测 API认证绕过漏洞 9 | * 在本地监听一个Web Server,打开Swagger UI界面,供分析接口使用 10 | * 使用Chrome打开本地Web服务器,并禁用CORS,解决部分API接口无法跨域请求的问题 11 | * 当工具检测到HTTP认证绕过漏洞时,本地服务器拦截API文档,修改path,以便直接在Swagger UI中进行测试 12 | 13 | ## ChangeLog 14 | * [2024-06-07] 增加支持 OpenAPI 3.0 15 | * [2022-08-08] Fix chromeSwagger permission error 16 | * [2021-04-04] 支持 Python3 17 | 18 | ## 扫描器改进建议 19 | 20 | * 分析json文档,将发现的URL,自动添加到爬虫中 21 | 22 | ## Usage 23 | 24 | 需要介入分析 api_summary.txt 文件中的内容 25 | 26 | * 扫描所有API集,打开Swagger UI 27 | 28 | > python swagger-exp.py http://site.com/swagger-resources/ 29 | 30 | * 扫描一个API集,打开Swagger UI 31 | 32 | > python swagger-exp.py http://site.com/v2/api-docs 33 | 34 | * 只打开Swagger UI,不扫描接口 35 | 36 | > python swagger-exp.py 37 | 38 | ## 工具截图 39 | 40 |  41 | 42 |  -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 |83 | 1.0.5 84 |85 |
[ Base URL: 87 | petstore.swagger.io 88 | /v2 ] 89 |90 | 92 | https://petstore.swagger.io/v2/swagger.json 93 | 94 |
This is a sample server Petstore server. You can find out
96 | more about Swagger at http://swagger.io or on
98 | irc.freenode.net,
99 | #swagger. For this sample, you can use the api key
100 | special-key
to test the authorization filters.
Everything about your Pets
139 |Access to Petstore orders
232 |Operations about user
272 |