detecting-typosquatting-packages-in-npm-pypi
यह क्या करती है
यह टूल npm और PyPI रिपॉज़िटरी में मशहूर पैकेजों से मिलते-जुलते नामों वाले पैकेजों की जांच करता है। यह ऐसे नाम ढूंढता है जो टाइपिंग की गलती जैसे लगते हैं या जानबूझकर यूज़र्स को धोखा देने के लिए बनाए गए हैं।
कब इस्तेमाल करें
- ✓अपने प्रोजेक्ट की डिपेंडेंसी की जांच करते समय, ताकि पक्का हो कि कोई 'नकली' पैकेज न हो।
- ✓यह देखने के लिए कि कोई आपकी कंपनी के नाम से 'नकली' पैकेज तो नहीं बना रहा।
- ✓जब आपको शक हो कि किसी डेवलपर ने गलती से गलत पैकेज इंस्टॉल कर लिया है।
Skill का लिंक
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“npm और PyPI पर 'react' से मिलते-जुलते नाम वाले पैकेज देखो।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह टूल टेक्स्ट समानता के मापदंडों से पैकेज के नामों की तुलना करता है और देखता है कि वे कब बने और उनके कितने डाउनलोड हैं। जिन पैकेजों के नाम मिलते-जुलते हों, हाल में बने हों और जिनके डाउनलोड कम हों, उन्हें संदिग्ध मार्क किया जाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Detecting Typosquatting Packages in npm and PyPI
When to Use
- Auditing project dependencies to identify packages whose names are suspiciously similar to popular libraries
- Proactively scanning package registries for newly published packages that may be typosquats of your organization's packages
- Investigating a suspected supply chain compromise where a developer installed a misspelled package name
- Building automated monitoring that alerts when new packages appear with names close to critical dependencies
- Assessing the risk profile of unfamiliar packages before adding them to a project's dependency tree
Do not use as the sole determination of malicious intent; name similarity alone does not prove a package is malicious. Do not use for bulk automated takedown requests without manual review of flagged packages. Do not use against private registries without authorization.
Prerequisites
- Python 3.9+ with
requestsandpython-Levenshtein(orrapidfuzz) packages installed - Network access to
https://pypi.org/pypi/<package>/json(PyPI JSON API) andhttps://registry.npmjs.org/<package>(npm registry API) - A list of popular or critical packages to monitor (e.g., top 1000 PyPI packages, organization's dependency list)
- Understanding of common typosquatting patterns: character omission, transposition, insertion, substitution, and hyphen/underscore manipulation
Workflow
Step 1: Build the Target Package Watchlist
Establish the set of legitimate packages to monitor for typosquats:
- Extract project dependencies: Parse
requirements.txt,Pipfile.lock,package.json, orpackage-lock.jsonto extract all direct and transitive dependency names - Include popular packages: Supplement with high-value targets from the top 1000 PyPI downloads (available from
https://hugovk.github.io/top-pypi-packages/) or top npm packages by download count - Add organization packages: Include any packages published by your organization that attackers might target with typosquats to intercept internal installations
- Normalize names: PyPI treats hyphens, underscores, and periods as equivalent (PEP 503 normalization:
re.sub(r"[-_.]+", "-", name).lower()). npm package names are case-sensitive but scoped packages use@scope/nameformat. Normalize before comparison.
Step 2: Generate Candidate Typosquat Names
Produce potential typosquat variants for each target package:
- Character omission: Remove each character one at a time (
requests->rquests,requets,reqests) - Character transposition: Swap adjacent characters (
requests->erquests,rqeuests,reques ts) - Character substitution: Replace characters with keyboard-adjacent keys using a QWERTY distance map (
requests->rrquests,requesta) - Character insertion: Insert common characters at each position (
requests->rrequests,reqquests) - Separator manipulation: For hyphenated names, try removing, doubling, or replacing separators (
my-package->mypackage,my--package,my_package) - Common prefix/suffix attacks: Prepend or append common strings (
python-requests,requests-python,requests2,requests-lib)
Step 3: Query Registry APIs for Candidate Packages
Check whether generated candidate names actually exist in the registry:
- PyPI JSON API: Send
GET https://pypi.org/pypi/<candidate>/jsonfor each candidate. A200response means the package exists;404means it does not. Extract from the response:info.name,info.version,info.author,info.summary,info.home_page,info.project_urls, andreleases(keyed by version withupload_time_iso_8601timestamps). - npm registry API: Send
GET https://registry.npmjs.org/<candidate>withAccept: application/json. Extract:name,description,dist-tags.latest,time.created,time.modified,maintainers, andversions. - Rate limiting: PyPI has no published rate limits but respect reasonable request rates (1-2 requests/second). npm registry returns
429when rate limited; implement exponential backoff. - Batch optimization: For large candidate lists, parallelize requests with connection pooling (
requests.Session) and limit concurrency to avoid triggering abuse protections.
Step 4: Analyze Package Metadata for Suspicion Signals
Score each existing candidate package against multiple heuristic signals:
…
अक्सर पूछे जाने वाले सवाल
'typosquatting' क्या है?
जब कोई किसी मौजूदा नाम से बहुत मिलता-जुलता डोमेन नाम या पैकेज नाम रजिस्टर कर लेता है, ताकि लोग उसे असली समझ लें, तो इसे typosquatting कहते हैं।
यह खतरनाक क्यों है?
खतरनाक पैकेज जानकारी चुरा सकते हैं, सिस्टम को नुकसान पहुंचा सकते हैं या वायरस फैला सकते हैं। गलती से 'नकली' पैकेज इस्तेमाल करने से आपके प्रोजेक्ट की सुरक्षा खतरे में पड़ सकती है।
क्या यह टूल पक्का बताता है कि पैकेज खतरनाक है?
नहीं। यह टूल सिर्फ नाम और कुछ खासियतों के आधार पर संदिग्ध पैकेज को फ्लैग करता है। किसी पैकेज को सचमुच खतरनाक मानने से पहले उसकी मैन्युअल जांच ज़रूरी है।
जानकारी
लेखक का मूल विवरण
Detects typosquatting attacks in npm and PyPI package registries by analyzing package name similarity using Levenshtein distance and other string metrics, examining publish date heuristics to identify recently created packages mimicking established ones, and flagging download count anomalies where suspicious packages have disproportionately low usage compared to their legitimate targets. The analy
लोकप्रियता
- GitHub स्टार
- 35k
- रैंकिंग में स्थान
- #7884
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 31/8/2026
कमेंट
- …
इस repository की और skills
abusing-dpapi-for-credential-access
35kआपके AI एजेंट को किसी खास काम के लिए तैयार instructions देता है, ताकि वह उसे बेहतर और तेज़ी से कर सके।
abusing-shadow-credentials-for-privesc
35kआपके AI एजेंट को साफ़ और अच्छी तरह से व्यवस्थित लिखना सिखाता है।
achieving-cmmc-level-2-compliance
35kयह आपके एजेंट को CMMC Level 2 compliance के लिए environment तैयार करने में मदद करता है। यह security requirements लागू करता है और ज़रूरी documentation संभालता है।
acquiring-disk-image-with-dd-and-dcfldd
35kआपके एजेंट को hard drives की exact copies बनाने में मदद करता है। जाँच के दौरान किसी भी जानकारी के खोने या बदलने से बचाने के लिए यह उपयोगी है।
मिलती-जुलती skills
add-model-provider
394kयह आपके एजेंट को सुरक्षित कमांड से OpenClaw में नया AI मॉडल प्रोवाइडर जोड़ने, API कीज़ को सादे टेक्स्ट से बचाने और लाइव टेस्ट चलाने देती है।
acp-router
394kयह आपके एजेंट को OpenClaw के ज़रिए Claude Code या Cursor जैसे कोडिंग असिस्टेंट को काम भेजने देती है, ताकि काम उसी टूल में चले।
browser-automation
394kयह आपके एजेंट को लॉगिन, टैब और अटकी वेब पेज से उबरने समेत, वेबसाइट पर चरण-दर-चरण काम करना सिखाती है।