本文へスキップ
Skillpedia
セキュリティ10k · #11972

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がスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/SnailSploit/Claude-Red/blob/main/Skills/supply-chain/offensive-dependency-confusion/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

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

  1. Perform reconnaissance to discover internal/private package names used by the target.
  2. Identify the target's package ecosystems and registry configuration.
  3. Verify that candidate package names are unclaimed on the corresponding public registry.
  4. Prepare a safe PoC package with a DNS canary or HTTP callback and a high version number.
  5. Publish the PoC to the public registry with a clear security research description.
  6. Monitor the callback endpoint for execution confirmations from target infrastructure.
  7. Record callback metadata (hostname, username, CI flag, timestamp) as evidence.
  8. Remove the PoC package from the public registry after confirmation or engagement window closes.
  9. 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

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル