bariskececi/exposure-check

GitHub: bariskececi/exposure-check

一款开源的暴露面扫描工具,用于在攻击者之前发现 GitHub 组织、仓库及域名中泄露的密钥、危险工作流和安全配置缺陷,并生成态势评分与可操作的修复报告。

Stars: 1 | Forks: 0

# exposure-check ### 在攻击者之前发现他们能看到的内容。 **exposure-check** 是一款快速、开源的暴露面扫描工具,用于扫描 GitHub 组织、仓库和开发者安全态势。它能揪出那些从公开仓库中悄然泄露的内容——硬编码密钥、危险的 GitHub Actions 工作流、缺失的安全控制以及暴露的企业邮箱—— 并将它们转化为一份清晰、可操作的报告。 ![exposure-check 报告](https://static.pigsec.cn/wp-content/uploads/repos/cas/6e/6e51080508e27c2c70224ae10f355b9013a5c88dd1ba2ff9522c5045153adc4b.png) 无需 agent,无需 SaaS,无需账户。只需一个静态二进制文件(或一个 GitHub Action)。扫描你自己的 组织,获取态势评分和优先级排序的发现列表,并在他人捷足先登之前 修复它们。 ## Web Dashboard 运行 `exposure-check serve` 以启动一个交互式的 web dashboard,你可以在其中 通过浏览器扫描域名、GitHub 组织和仓库。 ``` exposure-check serve # http://localhost:3000 exposure-check serve --port 8080 # custom port ```

Dashboard — scan form

Dashboard — scanning in progress

Dashboard — results with findings

## 安装说明 ``` # Go (任意平台) go install github.com/bariskececi/exposure-check@latest # Docker (多架构: amd64 + arm64) docker run --rm ghcr.io/bariskececi/exposure-check scan --repo owner/repo docker run --rm ghcr.io/bariskececi/exposure-check:v0.3 scan --domain example.com # 或从 Releases 页面获取预构建的二进制文件 ``` 设置 token 以进行完整扫描(仅限公开数据,但能解除 API 速率限制): ``` export GITHUB_TOKEN=ghp_... ``` ## 使用说明 ``` exposure-check scan --github-org acme exposure-check scan --repo acme/api exposure-check scan --repo acme/api --format html --output report.html exposure-check scan --github-org acme --fail-on high # CI gate exposure-check scan --repo acme/api --format sarif --output results.sarif # GitHub Code Scanning exposure-check scan --github-org acme --verbose # detailed progress exposure-check scan --repo acme/api --quiet # report only, no noise ``` ### 输出示例 ``` exposure-check find what attackers can see before they do target: acme · scope: org · repos: 14 ──────────────────────────────────────────────────────────── Posture score: 27/100 CRITICAL 2 HIGH 2 MEDIUM 3 LOW 1 ──────────────────────────────────────────────────────────── [CRITICAL] Possible AWS Access Key ID in public repository ↳ acme/api/config/prod.env:12 Matched value (redacted): AKIA******LE fix: Rotate immediately and purge from git history. [HIGH] pull_request_target checks out untrusted PR code ↳ acme/api/.github/workflows/ci.yml A classic path to code execution with write access and secrets. fix: Never check out PR head under pull_request_target. [MEDIUM] No SECURITY.md / disclosure policy ↳ acme/api ``` **HTML 报告**(`--format html`)是一个独立的页面,包含态势 评分、严重程度图块和每一项发现——你可以直接将其粘贴到工单或 演示文稿中。 ## 检查内容 **v0.1 — GitHub 暴露面** - 公开仓库中的**泄露密钥** —— 包含 30 多种模式,涵盖 AWS、Azure、 GCP、GitHub、Stripe、Slack、Twilio、SendGrid、Shopify、Heroku、DigitalOcean、 Mailgun、Postmark、Telegram、Discord、PyPI、NPM、私钥、JWT、数据库 连接字符串(MongoDB、PostgreSQL、MySQL、Redis、JDBC)以及通用的 API-key 模式。匹配到的值在输出时会被**打码**——该工具绝不会 重新发布任何密钥。 - **高风险的 GitHub Actions 工作流** —— 使用 `pull_request_target` 检出不受信任的 PR 代码、`permissions: write-all`、通过 `github.event.*` 进行的脚本注入、 `workflow_dispatch` 输入注入、自托管 runner、开启的 `ACTIONS_RUNNER_DEBUG`、 跨工作流 artifact 投毒,以及使用**可变标签**而非 commit SHA 锁定的第三方 actions(即“版本不明确”的 供应链风险)。 - **缺失的安全控制** —— 没有 `SECURITY.md` / 漏洞披露政策、默认分支没有分支 保护、没有可识别的许可证。 - 从公开的 commit 元数据中抓取到的**暴露的企业邮箱**。 - **态势评分**(0–100)及严重程度统计,并提供 **JSON / Markdown / HTML / SARIF** 报告以及对 CI 友好的 `--fail-on` 门禁。 ## GitHub Action 只需三行代码即可根据暴露情况对 pull request 设置门禁: ``` - uses: bariskececi/exposure-check@v0.3 with: repo: ${{ github.repository }} fail-on: high ``` 该 Action 通过内置的 Dockerfile 构建。如需独立使用 Docker, GHCR 上也提供了多架构镜像(参见安装说明章节)。 ### 输出 | 输出 | 描述 | |--------|-------------| | `score` | 态势评分 (0–100) | | `findings` | 总发现数量 | | `critical` | 严重发现数量 | | `high` | 高危发现数量 | | `report` | 报告文件路径(如果设置了 `output`) | | `sarif-file` | SARIF 文件路径(如果设置了 `sarif: true`) | ### 包含输出和 SARIF 的完整示例 ``` name: security on: [push, pull_request] jobs: exposure: runs-on: ubuntu-latest permissions: contents: read security-events: write # required for SARIF upload steps: - uses: actions/checkout@v4 - uses: bariskececi/exposure-check@v0.3 id: scan with: repo: ${{ github.repository }} fail-on: high sarif: true - if: always() uses: github/codeql-action/upload-sarif@v3 with: sarif_file: ${{ steps.scan.outputs.sarif-file }} - if: always() run: | echo "Score: ${{ steps.scan.outputs.score }}" echo "Findings: ${{ steps.scan.outputs.findings }}" echo "Critical: ${{ steps.scan.outputs.critical }}" echo "High: ${{ steps.scan.outputs.high }}" ``` ### CI 中的域名扫描 ``` - uses: bariskececi/exposure-check@v0.3 with: domain: example.com fail-on: high ``` 发现结果将显示为原生的 Code Scanning 告警——无需外部 dashboard。 ## 路线图 - ~~**v0.1** — GitHub 仓库/组织扫描,30 多种密钥模式,Actions 审计,web dashboard。~~ **已完成。** - ~~**v0.2** — 域名和子域名暴露,域名抢注/仿冒域名, 公开登录面板发现,TLS 证书检查。~~ **已完成。** - ~~**v0.3** — GHCR 上的 Docker 镜像,更丰富的 GitHub Action,CI 通过/失败策略。~~ **已完成。** - **v0.4** — OSINT 富化,可选的泄露数据库查询,自定义规则。 - 后续计划 — 开发者设备与 AI/IDE 插件的暴露信号。 欢迎贡献——这些检查都是小型、独立的 Go 文件。 ## 负责任的使用 exposure-check 是一款**防御性**工具。请扫描你拥有或被明确 授权评估的资产。它仅读取公开数据、报告发现结果,并对其检测到的 任何密钥进行打码——它不会进行利用、验证或使用凭证。你需对 你的使用方式负责。 ## 许可证 MIT — 参见 [LICENSE](LICENSE)。由 [GNSAC](https://github.com/bariskececi) 构建。
标签:EVTX分析, GitHub Action, Go, Ruby工具, StruQ, 数据泄露, 日志审计, 机密信息扫描, 请求拦截