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

detecting-dependency-confusion

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

यह टूल आपके software projects को 'dependency confusion' नाम के हमले से बचाने में मदद करता है। यह जांचता है कि आपकी कंपनी के internal packages को कोई हमलावर public registry पर उसी नाम से package डालकर 'हाईजैक' तो नहीं कर सकता।

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

  • ✓जब आप कंपनी के लिए कोई नई security पहल शुरू कर रहे हों।
  • ✓जब आपके build systems public और private दोनों package sources साथ इस्तेमाल करते हों।
  • ✓किसी security घटना के बाद, जब internal package नाम उजागर हुए हों।

Skill का लिंक

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-dependency-confusion/SKILL.md

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

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

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

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

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

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

“जांचो कि हमारे कोई internal packages dependency confusion के लिए खतरे में तो नहीं हैं।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह आपके projects में इस्तेमाल हो रहे internal packages के नाम स्कैन करता है। फिर देखता है कि public registries पर कोई हमलावर उसी नाम से package डाल सकता है या नहीं। अगर कोई internal नाम public पर रजिस्टर नहीं है, तो उसे बचाव के तौर पर 'claim' किया जा सकता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Detecting Dependency Confusion

Legal Notice: This skill is for authorized security testing, defensive engineering, and educational purposes only. Registering or claiming package namespaces you do not own, or testing build pipelines without written authorization, may be illegal and may violate the terms of service of public registries. Only run namespace-claiming or resolution-testing activities against names and infrastructure you control or are explicitly authorized to assess.

Overview

Dependency confusion (also called a substitution or namespace-shadowing attack) was popularized by Alex Birsan in 2021 when he forced malicious code into the internal build systems of Apple, Microsoft, PayPal, and dozens of others. The root cause is that many package managers, when configured to resolve from both an internal/private registry and a public one, will prefer whichever copy has the higher version number rather than honoring the source. An attacker who learns the name of a private package (@acme/internal-utils, acme-billing-sdk) can publish a malicious package of the same name to the public registry (npmjs.com, PyPI, Maven Central) with a very high version (e.g. 99.0.0). When the victim's CI/CD runner or a developer machine resolves dependencies, it pulls the attacker's public package, executes its install scripts, and the supply chain is compromised.

This skill covers both halves of the problem: detection — enumerating internal package names that are not registered (squatted defensively) on public registries and are therefore claimable, using confused and OWASP dep-scan — and prevention — pinning scopes/namespaces to private registries, registering placeholder packages, and enforcing source restrictions in .npmrc, pip.conf/pyproject.toml, and Maven settings.xml. Internal package names leak constantly: in committed lockfiles, sourcemaps, public JS bundles, Docker layers, and error stack traces, so this is treated as an attack-surface management problem, not a one-time check.

When to Use

  • When onboarding a repository or organization to a supply-chain security program and you need to baseline which internal packages are claimable on public registries.
  • When CI/CD pipelines resolve dependencies from both private and public registries (mixed/hybrid feeds).
  • After any incident where internal package names may have been exposed (leaked source, public bundle, breached repo).
  • When auditing package.json, requirements.txt, pom.xml, composer.json, or Gemfile.lock files for confusable dependencies.
  • As a recurring scheduled control to detect newly added internal packages that have not yet been defensively registered.

Prerequisites

  • Go 1.20+ to install confused:
    go install github.com/visma-prodsec/confused@latest
    # binary lands in $(go env GOPATH)/bin/confused
    
  • Python 3.10+ for OWASP dep-scan:
    pip install owasp-depscan
    # or container: docker pull ghcr.io/owasp-dep-scan/dep-scan
    
  • Node.js + npm (for .npmrc and npm config remediation) and access to your private registry (Artifactory, Nexus, Azure Artifacts, GitHub Packages, AWS CodeArtifact).
  • Read access to the repositories / lockfiles being assessed and write access to your private registry for defensive registration.

Objectives

  • Enumerate every internal dependency declared in project manifests across npm, PyPI, Maven, Composer, and RubyGems.
  • Determine which internal names are not present on the corresponding public registry and are therefore claimable.
  • Distinguish true exposure from false positives (scoped packages, already-mirrored names).
  • Apply registry-pinning and scope-restriction controls that make public substitution impossible.
  • Defensively register placeholder packages for unclaimed internal names.
  • Establish a recurring detection control in CI to catch newly introduced confusable dependencies.

MITRE ATT&CK Mapping

Technique ID Technique Name Relevance
T1195.001 Supply Chain Compromise: Compromise Software Dependencies and Development Tools Core technique — attacker substitutes a malicious public package for an internal dependency.
T1195.002 Supply Chain Compromise: Compromise Software Supply Chain Broader category covering the compromised build artifacts produced once confusion succeeds.

…

अक्सर पूछे जाने वाले सवाल

'dependency confusion' क्या है?

यह ऐसा हमला है जिसमें कोई बुरा व्यक्ति public registry पर आपकी कंपनी के internal package जैसा नाम रखकर खतरनाक package डाल देता है। अगर आपका build system public वाले version को पसंद करता है (जैसे उसका version नंबर ज़्यादा हो), तो वह उसे डाउनलोड करके चला सकता है।

यह दिक्कत क्यों है?

इससे आपके सिस्टम में खतरनाक कोड चल सकता है, जिससे data, systems और software supply chain खतरे में पड़ सकते हैं।

यह टूल इससे कैसे बचाता है?

यह पहचानता है कि कौन से internal package नाम public पर रजिस्टर नहीं हैं और इसलिए खतरे में हैं। यह आपके टूल्स को इस तरह कॉन्फ़िगर करने में भी मदद करता है कि वे हमेशा सही internal packages ही इस्तेमाल करें, भले ही उन नामों से public packages मौजूद हों।

जानकारी

लेखक का मूल विवरण

Detect and prevent dependency confusion (public-over-private package name resolution) in npm, PyPI, and Maven by enumerating claimable internal package names with tools like `confused` and OWASP `dep-scan`, then enforcing source restrictions via `.npmrc`, `pip.conf`/`pyproject.toml`, and Maven `settings.xml`. Use when onboarding a repo to a supply-chain security program, auditing lockfiles/manifes

repo: mukul975/Anthropic-Cybersecurity-Skills

लोकप्रियता

GitHub स्टार
35k
रैंकिंग में स्थान
#7821
लाइसेंस
Apache-2.0
अपडेट की गई
31/8/2026

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

0

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

कमेंट

  • …

इस repository की और skills

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