insecure-source-code-management
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSKILL: Insecure Source Code Management
SKILL:不安全的源代码管理
AI LOAD INSTRUCTION: This skill covers detection and recovery of exposed version-control metadata, common backup artifacts, and related misconfigurations. Use only in authorized assessments. Treat recovered credentials and URLs as sensitive; do not exfiltrate real data beyond scope. For broad discovery workflow, cross-load recon-for-sec and recon-and-methodology when those skills exist in the workspace.
AI加载说明:本技能覆盖暴露的版本控制元数据、常见备份工件及相关错误配置的检测和恢复。仅可在授权评估中使用。将恢复得到的凭证和URL视为敏感信息,不得超出范围泄露真实数据。如需大范围发现工作流,当工作区中存在对应技能时,可交叉加载recon-for-sec和recon-and-methodology。
0. QUICK START
0. 快速开始
High-value paths to probe first (GET or HEAD, respect rate limits):
http
/.git/HEAD
/.git/config
/.svn/entries
/.svn/wc.db
/.hg/requires
/.bzr/README
/.DS_Store
/.env中文路由提示:快速扫这些路径;若需完整侦察流程,从 、 技能载入方法论后再深入。
recon-for-secrecon-and-methodology优先探测的高价值路径(使用GET或HEAD请求,遵守速率限制):
http
/.git/HEAD
/.git/config
/.svn/entries
/.svn/wc.db
/.hg/requires
/.bzr/README
/.DS_Store
/.env中文路由提示:快速扫这些路径;若需完整侦察流程,从 、 技能载入方法论后再深入。
recon-for-secrecon-and-methodology1. GIT EXPOSURE
1. GIT暴露
Detection
检测
- — valid repo often returns plain text like:
/.git/HEAD
text
ref: refs/heads/main- — may expose
/.git/config, user identity, or embedded credentials.remote.origin.url - ,
/.git/index— partial object store access enables reconstruction with the right tools./.git/objects/
- — 有效仓库通常会返回类似如下的纯文本:
/.git/HEAD
text
ref: refs/heads/main- — 可能暴露
/.git/config、用户身份或内置凭证。remote.origin.url - 、
/.git/index— 只要能访问部分对象存储,就可以通过合适的工具重建代码。/.git/objects/
403 vs 404
403与404的区别
- — path likely absent or fully blocked at the edge.
404 - on
403— directory may exist but listing is denied; still try direct file URLs:/.git/
http
/.git/HEAD
/.git/config
/.git/logs/HEAD
/.git/refs/heads/mainA 403 on the directory plus 200 on strongly indicates exposure.
HEAD- — 路径大概率不存在,或在边缘层被完全拦截。
404 - 返回
/.git/— 目录可能存在,但目录列表被禁止,仍可尝试直接访问文件URL:403
http
/.git/HEAD
/.git/config
/.git/logs/HEAD
/.git/refs/heads/main目录返回403且文件返回200强烈表明存在泄露。
HEADRecovery tools (open source)
恢复工具(开源)
- — dumps reachable
arthaud/git-dumpertree when individual files are fetchable..git - — Dumper, Extractor, Finder modules for partial/corrupt dumps.
internetwache/GitTools - — alternative recovery when standard dumpers miss edge cases.
WangYihang/GitHacker
- — 当单个文件可获取时,导出可访问的
arthaud/git-dumper目录树。.git - — 包含用于处理部分/损坏导出内容的导出器、提取器、查找器模块。
internetwache/GitTools - — 当标准导出工具无法覆盖边缘场景时的替代恢复工具。
WangYihang/GitHacker
Key files to prioritize
需要优先关注的关键文件
| Path | Why it matters |
|---|---|
| Remotes, credentials, hooks paths |
| Commit history, reflog-style leakage |
| Branch tips, commit SHAs |
| Packed branch/tag refs |
| Object blobs for reconstruction |
| 路径 | 重要性原因 |
|---|---|
| 远程仓库地址、凭证、钩子路径 |
| 提交历史、引用日志类泄露 |
| 分支尖端、提交SHA值 |
| 打包的分支/标签引用 |
| 用于重建代码的对象blob |
2. SVN EXPOSURE
2. SVN暴露
Detection
检测
- SVN before 1.7: — XML or text metadata listing paths and revisions.
/.svn/entries - SVN ≥ 1.7: — SQLite working copy database (
/.svn/wc.dbafter download).PRAGMA table_info
Example probe:
http
GET /.svn/entries HTTP/1.1
GET /.svn/wc.db HTTP/1.1- 1.7版本之前的SVN:— 列出路径和版本号的XML或纯文本元数据。
/.svn/entries - 1.7及以上版本的SVN:— SQLite格式的工作副本数据库(下载后可执行
/.svn/wc.db查看结构)。PRAGMA table_info
探测示例:
http
GET /.svn/entries HTTP/1.1
GET /.svn/wc.db HTTP/1.1Recovery
恢复
- — automated extraction from exposed
anantshri/svn-extractor..svn - Manual: download , query with
wc.dbfor file paths and checksums, then requestsqlite3blobs if exposed./.svn/pristine/
- — 从暴露的
anantshri/svn-extractor自动提取内容。.svn - 手动方式:下载,使用
wc.db查询文件路径和校验和,如果暴露的话再请求**sqlite3**下的blob文件。/.svn/pristine/
3. MERCURIAL EXPOSURE
3. MERCURIAL暴露
Detection
检测
- — small text file listing repository features; confirms Mercurial metadata.
/.hg/requires
http
GET /.hg/requires HTTP/1.1
GET /.hg/store/ HTTP/1.1- — 列出仓库特性的小型纯文本文件,可用于确认存在Mercurial元数据。
/.hg/requires
http
GET /.hg/requires HTTP/1.1
GET /.hg/store/ HTTP/1.1Recovery
恢复
- — dumps repository when store paths are reachable.
sahildhar/mercurial_source_code_dumper
- — 当存储路径可访问时导出仓库内容。
sahildhar/mercurial_source_code_dumper
4. OTHER LEAKS
4. 其他泄露
Bazaar (Bzr)
Bazaar (Bzr)
- Probe and
/.bzr/READMEfor Bazaar metadata./.bzr/branch-format
- 探测**和
/.bzr/README**确认是否存在Bazaar元数据。/.bzr/branch-format
macOS .DS_Store
.DS_StoremacOS .DS_Store
.DS_Store- can encode directory and filename listings.
/.DS_Store - Tools: ,
gehaxelt/ds-store— parselijiejie/ds_store_expoffline..DS_Store
- 可能包含目录和文件名列表信息。
/.DS_Store - 工具:、
gehaxelt/ds-store— 离线解析lijiejie/ds_store_exp文件。.DS_Store
Backup and config artifacts
备份和配置工件
Probe (adjust for app root and naming conventions):
text
/.env
/backup.zip
/backup.tar.gz
/wwwroot.rar
/backup.sql
/config.php.bak
/.config.php.swp探测路径(可根据应用根目录和命名规范调整):
text
/.env
/backup.zip
/backup.tar.gz
/wwwroot.rar
/backup.sql
/config.php.bak
/.config.php.swpWeb server misconfiguration signal (example: NGINX)
Web服务器配置错误信号(示例:NGINX)
- — may return 403 for
location /.git { deny all; }while still allowing or denying specific subpaths depending on rules./.git/ - 403 on a protected location can confirm the route exists; always distinguish from 404 on non-existent paths.
- — 可能会对
location /.git { deny all; }返回403,但根据规则仍可能允许或拒绝特定子路径的访问。/.git/ - 受保护位置返回403可确认路由存在,注意要和不存在路径返回的404区分开。
5. DECISION TREE
5. 决策树
- Probe →
/.git/HEADpattern? → run git-dumper / GitTools / GitHacker; reviewref: refs/heads/andconfigfor secrets.logs/HEAD - Else probe or
/.svn/wc.db→ success? → svn-extractor or manualentries+ pristine recovery.wc.db - Else probe → success? → mercurial dumper.
/.hg/requires - Else probe → Bazaar tooling or manual path walk.
/.bzr/README - Parallel: fetch ,
/.DS_Store, common backup extensions on app root and parent paths./.env - Interpret status codes: 403 on directory + 200 on specific files → treat as high priority for file-by-file extraction.
- 探测→ 是否存在
/.git/HEAD格式?→ 运行git-dumper / GitTools / GitHacker;检查ref: refs/heads/和config中的机密信息。logs/HEAD - 否则探测或
/.svn/wc.db→ 成功?→ 使用svn-extractor或手动entries+原始文件恢复。wc.db - 否则探测→ 成功?→ 使用mercurial导出工具。
/.hg/requires - 否则探测→ 使用Bazaar工具或手动路径遍历。
/.bzr/README - 并行操作:获取应用根目录和父路径下的**、
/.DS_Store、常见后缀的备份文件**。/.env - 解释状态码:目录返回403 + 特定文件返回200 → 视为高优先级,逐文件提取。
6. RELATED ROUTING
6. 相关联动
- From recon-for-sec — scope-safe discovery, crawling, and fingerprinting before deep VCS tests.
- From recon-and-methodology — structured methodology and evidence handling.
中文:与侦察类技能联动——先定范围与速率,再针对 VCS/备份做定向验证。
- 来自 recon-for-sec — 在深入VCS测试之前的范围安全发现、爬虫和指纹识别。
- 来自 recon-and-methodology — 结构化方法论和证据处理。
中文:与侦察类技能联动——先定范围与速率,再针对VCS/备份做定向验证。