cerberauth/vulnapi
GitHub: cerberauth/vulnapi
开源 API 动态安全扫描器,支持 OpenAPI 规范和 Curl 风格命令行,帮助开发与安全团队在上线前检测 API 中的常见安全漏洞和配置缺陷。
Stars: 245 | Forks: 29
[](https://vulnapi.cerberauth.com/discord)
[](https://github.com/cerberauth/vulnapi/actions/workflows/ci.yml)

[](https://github.com/cerberauth/vulnapi)

# VulnAPI:API 安全漏洞扫描器
VulnAPI 是一个开源 DAST 工具,旨在帮助您扫描 API 以发现常见的安全漏洞和弱点。
通过使用此工具,您可以在攻击者利用 API 之前检测并缓解其中的安全漏洞。

## 安装
在使用 VulnAPI 进行首次扫描之前,您需要下载并安装它。请按照 [安装文档](https://vulnapi.cerberauth.com/docs/installation) 页面上的说明进行操作。
## 文档
在扫描之前,您可以使用 `discover` 命令发现目标 API 的有用信息。
漏洞扫描器 CLI 提供了两种扫描 API 的方法:
* **使用类似 Curl 的 CLI**:此方法涉及直接调用 CLI,参数类似于 curl 命令。
* **使用 OpenAPI 规范**:此方法利用 OpenAPI 规范来指定要扫描的 API 端点。
### Discover 命令
要发现目标 API 的有用信息、泄露的文件和已知路径,请执行以下命令:
```
vulnapi discover api [API_URL]
```
示例输出:
```
| TYPE | URL |
|---------------|---------------------------------------------|
| OpenAPI | http://localhost:5000/openapi.json |
| GraphQL | http://localhost:5000/graphql |
| Well-Known | http://localhost:8080/.well-known/jwks.json |
| Exposed Files | http://localhost:8080/.env.dev |
| TECHNOLOGIE/SERVICE | VALUE |
|---------------------|---------------|
| Framework | Flask:2.2.3 |
| Language | Python:3.7.17 |
| Server | Flask:2.2.3 |
```
### 使用类似 Curl 的 CLI
要使用类似 Curl 的 CLI 执行扫描,请运行以下命令:
```
vulnapi scan curl [API_URL] [CURL_OPTIONS]
```
将 `[API_URL]` 替换为要扫描的 API URL,将 `[CURL_OPTIONS]` 替换为您希望包含的任何其他 curl 选项。
示例:
```
vulnapi scan curl -X POST https://vulnapi.cerberauth.com/vulnerable/api -H "Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNTE2MjM5MDIyfQ."
```
### 使用 OpenAPI 规范
要使用 OpenAPI 规范执行扫描,请运行以下命令:
```
echo "[JWT_TOKEN]" | vulnapi scan openapi [PATH_OR_URL_TO_OPENAPI_FILE]
```
将 [PATH_OR_URL_TO_OPENAPI_FILE] 替换为 OpenAPI 规范 JSON 文件的路径或 URL,将 [JWT_TOKEN] 替换为用于身份验证的 JWT token。
示例:
```
vulnapi scan openapi https://vulnapi.cerberauth.com/vulnerable/.well-known/openapi.json
```
## 输出
CLI 提供有关扫描期间检测到的任何漏洞的详细报告。以下是输出格式的示例:
| 技术/服务 | 值 |
|----------------|---------------|
| Framework | Flask:2.2.3 |
| Language | Python:3.11.9 |
| Server | Flask:2.2.3 |
建议:存在一些低风险问题。建议查看。
| 操作 | 风险等级 | CVSS 4.0 评分 | OWASP | 漏洞 |
|---------------------------|----------|---------------|--------------------------------|-----------------------|
| GET / | Medium | 5.1 | API8:2023 Security | X-Frame-Options Header is |
| | | | Misconfiguration | missing |
| | Medium | 5.1 | API8:2023 Security | CORS Headers are missing |
| | | | Misconfiguration | |
| | Medium | 5.1 | API8:2023 Security | CSP frame-ancestors policy is |
| | | | Misconfiguration | not set |
| | Info | 0.0 | API8:2023 Security | X-Content-Type-Options Header |
| | | | Misconfiguration | is missing |
| | Info | 0.0 | API8:2023 Security | Operation May Accepts |
| | | | Misconfiguration | Unauthenticated Requests |
| | Info | 0.0 | API8:2023 Security | HSTS Header is missing |
| | | | Misconfiguration | |
| | Info | 0.0 | API8:2023 Security | CSP Header is not set |
| | | | Misconfiguration | |
| GET /books/v1 | Medium | 5.1 | API8:2023 Security | CSP frame-ancestors policy is |
| | | | Misconfiguration | not set |
| | Medium | 5.1 | API8:2023 Security | X-Frame-Options Header is |
| | | | Misconfiguration | missing |
| | Medium | 5.1 | API8:2023 Security | CORS Headers are missing |
| | | | Misconfiguration | |
| | Info | 0.0 | API8:2023 Security | CSP Header is not set |
| | | | Misconfiguration | |
| | Info | 0.0 | API8:2023 Security | HSTS Header is missing |
| | | | Misconfiguration | |
| | Info | 0.0 | API8:2023 Security | X-Content-Type-Options Header |
| | | | Misconfiguration | is missing |
| | Info | 0.0 | API8:2023 Security | Operation May Accepts |
| | | | Misconfiguration | Unauthenticated Requests
在此示例中,每一行代表一个检测到的漏洞、严重程度(关键)、漏洞类型、受影响的操作(GET http://localhost:8080/)以及漏洞描述。
## 检测到的漏洞
该项目检测到的所有漏洞均列在此 URL 中:[检测到的 API 漏洞](https://vulnapi.cerberauth.com/docs/vulnerabilities?utm_source=github&utm_medium=readme)。
## 代理支持
扫描器支持代理配置,用于扫描代理服务器后面的 API。要使用代理,请使用代理 URL 设置 `HTTP_PROXY` 或 `HTTPS_PROXY` 环境变量。
命令参数 `--proxy` 也可用于指定代理 URL。
## 其他选项
VulnAPI 可能支持用于自定义扫描或输出格式的其他选项。运行 `vulnapi -h` 或 `vulnapi help` 命令以查看可用选项及其说明。
## 遥测
扫描器收集匿名使用数据以帮助改进该工具。此数据包括执行的扫描次数、检测到的漏洞数量以及漏洞的严重程度。不会收集敏感信息。您可以通过传递 `--sqa-opt-out` 标志来选择退出遥测。
## 完整 CLI 帮助
要查看完整的 CLI 帮助,请执行以下命令:
```
vulnapi -h
```
以下是帮助命令的输出:
```
vulnapi
Usage:
vulnapi [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
help Help about any command
jwt Generate JWT tokens
scan API Scan
serve Start the server
Flags:
-h, --help help for vulnapi
--sqa-opt-out Opt out of sending anonymous usage statistics and crash reports to help improve the tool
Use "vulnapi [command] --help" for more information about a command.
```
## 免责声明
此扫描器仅用于教育和信息目的。不得将其用于恶意目的或在未经适当授权的情况下攻击任何系统。请始终尊重他人的安全和隐私。
## 致谢
本项目使用了以下开源库:
* [SecLists](https://github.com/danielmiessler/SecLists)
* [projectdiscovery/wappalyzergo](https://github.com/projectdiscovery/wappalyzergo)
## 许可证
本仓库根据 [MIT 许可证](https://github.com/cerberauth/vulnapi/blob/main/LICENSE) 授权给 [CerberAuth](https://www.cerberauth.com/)。您可以自由使用、修改和分发本仓库的内容,用于教育和测试目的。
标签:API安全, API漏洞检测, API网关安全, CISA项目, Curl, DAST, DNS枚举, EVTX分析, EVTX分析, JSON输出, OpenAPI, Web安全, 加密, 开源安全工具, 恶意软件分析, 文档结构分析, 日志审计, 漏洞扫描器, 网络安全工具, 蓝队分析, 逆向工程平台