offensive-dependency-confusion
できること
このスキルは、npm、PyPI、NuGetなどのパッケージのエコシステムで、依存関係の混乱をテストする方法論です。レジストリの設定と、リスクを安全に証明する方法を扱います。許可を得て、自分のパッケージの設定を確認するセキュリティの専門家と開発者向けです。
使う場面
- ✓自分の非公開のパッケージ名が、公開のレジストリで取られうるかを確認したいとき。
- ✓ビルドが公開と非公開の両方のレジストリからパッケージを解決しており、それをレビューしたいとき。
- ✓許可を得たテストで、依存関係の混乱の所見について、安全な概念実証が必要なとき。
スキルのリンク
https://github.com/SnailSploit/Claude-Red/blob/main/Skills/supply-chain/offensive-dependency-confusion/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私たちのnpmとPyPIの設定をテストする許可があります。非公開のパッケージ名が混乱から安全か確認してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、内部のパッケージ名を見つけ、レジストリの設定を確認し、候補の名前が公開のレジストリで未使用であることを確かめます。そのうえで、コールバックを報告するだけで、有害なペイロードのない安全な概念実証を準備します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Offensive Dependency Confusion and Namespace Attacks
Dependency confusion exploits a fundamental design tension in package managers: the need to resolve packages from multiple sources. When an organization maintains internal packages alongside public dependencies, the resolution logic becomes an attack surface. You exploit the gap between how developers intend packages to resolve and how package managers actually resolve them.
Alex Birsan's 2021 research demonstrated that this class of attack affected Apple, Microsoft, PayPal, Shopify, Netflix, Yelp, Tesla, and Uber, among others. The root cause -- preferring a higher-versioned public package over a lower-versioned private one -- remains exploitable wherever registry configuration is incomplete.
This skill provides ecosystem-specific exploitation techniques, safe PoC methodology, and comprehensive reconnaissance approaches for discovering internal package names during authorized engagements.
Quick Workflow
- Perform reconnaissance to discover internal/private package names used by the target.
- Identify the target's package ecosystems and registry configuration.
- Verify that candidate package names are unclaimed on the corresponding public registry.
- Prepare a safe PoC package with a DNS canary or HTTP callback and a high version number.
- Publish the PoC to the public registry with a clear security research description.
- Monitor the callback endpoint for execution confirmations from target infrastructure.
- Record callback metadata (hostname, username, CI flag, timestamp) as evidence.
- Remove the PoC package from the public registry after confirmation or engagement window closes.
- Document the full attack chain, impacted systems, and registry hardening recommendations.
Reconnaissance for Internal Package Names
Discovering what internal packages a target uses is the critical first step. You extract package names from every available artifact and signal.
Lock File Analysis
Lock files are the highest-fidelity source of internal package names. They list every resolved dependency with exact versions and, in some formats, the registry source.
# npm: package-lock.json reveals resolved URLs
# Internal packages often resolve to a private registry
cat package-lock.json | jq -r '
.packages | to_entries[] |
select(.value.resolved != null) |
select(.value.resolved | test("registry.npmjs.org") | not) |
.key
' | sed 's|node_modules/||' | sort -u
# yarn: yarn.lock includes registry URLs inline
grep -B1 'resolved "https://registry.yarnpkg.com' yarn.lock | \
grep -v 'resolved' | sed 's/@.*//' | sort -u > public_packages.txt
grep -B1 'resolved "https://' yarn.lock | \
grep -v 'resolved' | grep -v 'yarnpkg.com' | grep -v 'npmjs.org' | \
sed 's/@.*//' | sort -u > possibly_internal.txt
# pip: requirements.txt may reference internal packages
# Look for packages not found on public PyPI
grep -v '^#' requirements.txt | grep -v '^\s*$' | \
sed 's/[>=<!\[].*//; s/\s*$//' | while read pkg; do
code=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/$pkg/json")
[ "$code" = "404" ] && echo "[INTERNAL] $pkg"
done
# Pipfile.lock contains source information
cat Pipfile.lock | jq -r '.default | keys[]' > pipfile_packages.txt
JavaScript Source Maps
Production JavaScript bundles sometimes ship with source maps or readable module paths that reveal internal package names.
# Extract source map URLs from JavaScript bundles
curl -s https://target.example.com/app.js | \
grep -oP '//# sourceMappingURL=\K.*'
# Download and parse source map for internal module paths
curl -s https://target.example.com/app.js.map | \
jq -r '.sources[]' | grep -E 'node_modules/(@[^/]+/[^/]+|[^/]+)' | \
sed 's|.*node_modules/||; s|/.*||' | sort -u
# Look for webpack chunk manifests
curl -s https://target.example.com/ | \
grep -oP 'src="[^"]*chunk[^"]*"' | \
sed 's/src="//;s/"//' | while read chunk; do
curl -s "https://target.example.com/$chunk" | \
grep -oP '"[a-zA-Z@][a-zA-Z0-9_./-]+"' | sort -u
done
Error Messages and Stack Traces
Application errors leak internal package names in stack traces and module resolution failures. Trigger 404 pages, API errors, and debug endpoints.
curl -s https://target.example.com/nonexistent 2>&1 | \
grep -oP 'Cannot find module .?\K[a-zA-Z@][a-zA-Z0-9_.-/]+'
# Also search Wayback Machine for cached error pages with module names
GitHub Rep
よくある質問
概念実証は害を与えますか?
このスキルは、破壊的なペイロードのない、コールバック付きの安全な概念実証を求めます。
どのエコシステムを扱いますか?
npm、PyPI、NuGetを扱い、ほかのエコシステムにも言及しています。
許可を得たテストだけのためのものですか?
はい。許可を得た作業のために書かれています。
詳細
作者による元の説明
Deep-dive offensive methodology for dependency confusion and namespace attacks across all major package ecosystems. Covers npm scope confusion exploiting the gap between public and private scoped packages and .npmrc misconfigurations where registry mappings fail to pin internal scopes exclusively. Addresses PyPI namespace attacks through --extra-index-url resolution ordering, NuGet feed priority exploitation when multiple package sources are configured without clear directives, Maven and Gradle repository ordering where artifact resolution traverses repositories sequentially, Go module proxy a
repo: SnailSploit/Claude-Red
人気
- GitHubのスター
- 10k
- ランキング
- #11972
- ライセンス
- MIT
- 更新日
- 2026/10/12
コメント
- …
このリポジトリの他のスキル
offensive-active-directory
10kエージェントが、ネットワークの地図作成から Domain Adminへの攻撃経路の発見まで、許可を得た Active Directoryのセキュリティテストを計画できるよう支援します。
offensive-netexec
10kエージェントが、許可を得たネットワークのテストで、NetExec(nxc)ツールを使えるよう支援します。プロトコル、認証、認証情報の確認を扱います。
offensive-api-abuse
10kエージェントが、ビジネスロジックの悪用、GraphQLのリスク、競合状態を探す、許可を得たAPIのセキュリティテストを計画できるよう支援します。
offensive-api-security
10kエージェントが、OWASP API Top 10に基づき、REST、gRPC、WebSocketのAPIに対して許可を得たセキュリティテストを行えるよう支援します。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。