Zurück zum Katalog
Statische PrüfungEntwicklung

Skill-Dossier

detecting-typosquatting-packages-in-npm-pypi

Quellenangabe

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 analyst queries the PyPI JSON API and npm registry API to gather package metadata for automated comparison. Activates for requests involving package typosquatting detection, dependency confusion analysis, malicious package identification, or software supply chain threat hunting in package registries.

Die ursprüngliche Beschreibung der Autorinnen und Autoren, unverändert auf Englisch. Sie beschreibt die Absicht, nicht die geprüfte Leistung.

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 analyst queries the PyPI JSON API and npm registry API to gather package metadata for automated comparison. Activates for requests involving package typosquatting detection, dependency confusion analysis, malicious package identification, or software supply chain threat hunting in package registries.

developmentreferencesscripts

Die Forschungsinhalte dieser Website sind auf Englisch und Chinesisch veröffentlicht und werden hier auf Englisch angezeigt.

Forschungszusammenfassung

Statische Analyse

Diese Beobachtungen stammen aus deterministischem Quell-Parsing. Sie sind keine kontrollierte Aufgabenevaluation.

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 analyst queries the PyPI JSON API and npm registry API to gather package metadata for automated comparison. Activates for requests involving package typosquatting detection, dependency confusion analysis, malicious package identification, or software supply chain threat hunting in package registries. This bilingual summary is generated deterministically from collected source text and file structure; it is from static parsing.

Prüfungsumfang

Deterministic static analysis of collected SKILL.md and supporting text/code. Machine-assisted candidates and findings are static-analysis candidates; no dynamic behavior or effect is assessed.

Beobachtbare Fähigkeiten

  • Workflow [Source statement; provisional, not tested. Evidence: skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md:L58]
  • Step 1: Build the Target Package Watchlist [Source statement; provisional, not tested. Evidence: skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md:L60]
  • Step 2: Generate Candidate Typosquat Names [Source statement; provisional, not tested. Evidence: skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md:L69]
  • Step 3: Query Registry APIs for Candidate Packages [Source statement; provisional, not tested. Evidence: skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md:L80]
  • Step 4: Analyze Package Metadata for Suspicion Signals [Source statement; provisional, not tested. Evidence: skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md:L89]
  • Step 5: Score, Rank, and Report Findings [Source statement; provisional, not tested. Evidence: skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md:L101]

Grenzen & Umfang

  • Static analysis cannot assess runtime behavior, command success, network reachability, or model output quality.
  • No commands, scripts, network requests, model calls, or controlled skill executions were performed.
  • Category, tags, capabilities, workflows, and bilingual editorial summaries are deterministic candidates from static parsing, not verified outcomes.
  • Exact token counts are unavailable until a later pipeline performs and records an official model-specific count.

Relevant für

  • Practitioners evaluating whether to inspect and install the source skill; this audience is inferred from the product context, not measured usage. [Evidence: skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md:L1-L38]

Was der Skill enthält

Die Dateiübersicht stammt aus der erfassten Quelle beim protokollierten Commit. Pfade und Größen sind strukturelle Beobachtungen, kein Qualitätsmaß.

Dateien
4
Markdown-Dateien
2
Skripte
1
Verweise
1
Größe
49,2 KB
Strukturelle Komplexität
Niedrig

Dateiübersicht

PfadArtBytes
skills/detecting-typosquatting-packages-in-npm-pypi/LICENSESonstiges11 KB
skills/detecting-typosquatting-packages-in-npm-pypi/references/api-reference.mdVerweis5,5 KB
skills/detecting-typosquatting-packages-in-npm-pypi/scripts/agent.pySkript19,8 KB
skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.mdAnweisung13 KB

SKILL.md-Frontmatter

{
  "name": "detecting-typosquatting-packages-in-npm-pypi",
  "description": "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 analyst queries the PyPI JSON API and npm registry API to gather package metadata for automated comparison. Activates for requests involving package typosquatting detection, dependency confusion analysis, malicious package identification, or software supply chain threat hunting in package registries.\n",
  "domain": "cybersecurity",
  "subdomain": "supply-chain-security",
  "tags": [
    "typosquatting",
    "npm",
    "pypi",
    "supply-chain",
    "package-security",
    "Levenshtein",
    "dependency-confusion",
    "malicious-packages"
  ],
  "version": "1.0.0",
  "author": "mukul975",
  "license": "Apache-2.0",
  "nist_csf": [
    "GV.SC-01",
    "GV.SC-03",
    "GV.SC-06",
    "GV.SC-07"
  ],
  "mitre_attack": [
    "T1195.001",
    "T1195.002",
    "T1608.001",
    "T1554"
  ]
}

Eine Lesart des Ablaufs

Dieser Workflow rekonstruiert die offensichtliche Reihenfolge aus dem Quellmaterial. Sofern nicht ausdrücklich eine kontrollierte Evaluation protokolliert ist, ist er vorläufig und keine beobachtete Ausführung.

  1. 01
    Entscheidung

    When to Use

    Source-described decision candidate under “When to Use”; not verified execution.

  2. 02
    Aktion

    Workflow

    Source-described action candidate under “Workflow”; not verified execution.

  3. 03
    Aktion

    Step 1: Build the Target Package Watchlist

    Source-described action candidate under “Step 1: Build the Target Package Watchlist”; not verified execution.

  4. 04
    Aktion

    Extract project dependencies: Parse `requirements.txt`, `Pipfile.lock`, `package.json`, or `package-lock.json` to extract all direct and transitive dependency names

    Source-described action candidate under “Step 1: Build the Target Package Watchlist”; not verified execution.

  5. 05
    Aktion

    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

    Source-described action candidate under “Step 1: Build the Target Package Watchlist”; not verified execution.

  6. 06
    Aktion

    Add organization packages: Include any packages published by your organization that attackers might target with typosquats to intercept internal installations

    Source-described action candidate under “Step 1: Build the Target Package Watchlist”; not verified execution.

Alle extrahierten Workflow-Kandidaten ansehen (44 Kandidatenschritte)
  1. 07
    Aktion

    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/name` format. Normalize before comparison.

    Source-described action candidate under “Step 1: Build the Target Package Watchlist”; not verified execution.

  2. 08
    Aktion

    Step 2: Generate Candidate Typosquat Names

    Source-described action candidate under “Step 2: Generate Candidate Typosquat Names”; not verified execution.

  3. 09
    Aktion

    Character omission: Remove each character one at a time (`requests` -> `rquests`, `requets`, `reqests`)

    Source-described action candidate under “Step 2: Generate Candidate Typosquat Names”; not verified execution.

  4. 10
    Aktion

    Character transposition: Swap adjacent characters (`requests` -> `erquests`, `rqeuests`, `reques ts`)

    Source-described action candidate under “Step 2: Generate Candidate Typosquat Names”; not verified execution.

  5. 11
    Aktion

    Character substitution: Replace characters with keyboard-adjacent keys using a QWERTY distance map (`requests` -> `rrquests`, `requesta`)

    Source-described action candidate under “Step 2: Generate Candidate Typosquat Names”; not verified execution.

  6. 12
    Aktion

    Character insertion: Insert common characters at each position (`requests` -> `rrequests`, `reqquests`)

    Source-described action candidate under “Step 2: Generate Candidate Typosquat Names”; not verified execution.

  7. 13
    Aktion

    Separator manipulation: For hyphenated names, try removing, doubling, or replacing separators (`my-package` -> `mypackage`, `my--package`, `mypackage`)

    Source-described action candidate under “Step 2: Generate Candidate Typosquat Names”; not verified execution.

  8. 14
    Aktion

    Common prefix/suffix attacks: Prepend or append common strings (`python-requests`, `requests-python`, `requests2`, `requests-lib`)

    Source-described action candidate under “Step 2: Generate Candidate Typosquat Names”; not verified execution.

  9. 15
    Aktion

    Step 3: Query Registry APIs for Candidate Packages

    Source-described action candidate under “Step 3: Query Registry APIs for Candidate Packages”; not verified execution.

  10. 16
    Entscheidung

    Check whether generated candidate names actually exist in the registry:

    Source-described decision candidate under “Step 3: Query Registry APIs for Candidate Packages”; not verified execution.

  11. 17
    Aktion

    PyPI JSON API: Send `GET https://pypi.org/pypi/<candidate>/json` for each candidate. A `200` response means the package exists; `404` means it does not. Extract from the response: `info.name`, `info.version`, `info.author`, `info.summary`, `info.homepage`, `info.projecturls`, and `releases` (keyed by version with `uploadtimeiso8601` timestamps).

    Source-described action candidate under “Step 3: Query Registry APIs for Candidate Packages”; not verified execution.

  12. 18
    Aktion

    npm registry API: Send `GET https://registry.npmjs.org/<candidate>` with `Accept: application/json`. Extract: `name`, `description`, `dist-tags.latest`, `time.created`, `time.modified`, `maintainers`, and `versions`.

    Source-described action candidate under “Step 3: Query Registry APIs for Candidate Packages”; not verified execution.

  13. 19
    Aktion

    Rate limiting: PyPI has no published rate limits but respect reasonable request rates (1-2 requests/second). npm registry returns `429` when rate limited; implement exponential backoff.

    Source-described action candidate under “Step 3: Query Registry APIs for Candidate Packages”; not verified execution.

  14. 20
    Aktion

    Batch optimization: For large candidate lists, parallelize requests with connection pooling (`requests.Session`) and limit concurrency to avoid triggering abuse protections.

    Source-described action candidate under “Step 3: Query Registry APIs for Candidate Packages”; not verified execution.

  15. 21
    Aktion

    Step 4: Analyze Package Metadata for Suspicion Signals

    Source-described action candidate under “Step 4: Analyze Package Metadata for Suspicion Signals”; not verified execution.

  16. 22
    Aktion

    Levenshtein distance: Calculate the edit distance between the candidate name and the target. Packages with distance 1-2 from a popular package are high-priority suspects. Historical analysis shows 18 of 40 known typosquats had Levenshtein distance of 2 or less from their targets.

    Source-described action candidate under “Step 4: Analyze Package Metadata for Suspicion Signals”; not verified execution.

  17. 23
    Aktion

    Publish date recency: Compare the candidate's first publish date against the target's. A package created years after its near-namesake is more suspicious. Flag packages created within the last 90 days that are similar to packages published years ago.

    Source-described action candidate under “Step 4: Analyze Package Metadata for Suspicion Signals”; not verified execution.

  18. 24
    Aktion

    Download count disparity: Compare weekly downloads. Legitimate similarly-named packages typically have comparable or explainable download counts. A package with 50 downloads versus its near-namesake with 5 million downloads is suspicious. PyPI download stats are available via BigQuery (`pypistats.org/api/`); npm provides download counts at `https://api.npmjs.org/downloads/point/last-week/<package>`.

    Source-described action candidate under “Step 4: Analyze Package Metadata for Suspicion Signals”; not verified execution.

  19. 25
    Entscheidung

    Author and maintainer analysis: Check if the candidate package author matches the legitimate package author. Different authors for near-identical names increase suspicion.

    Source-described decision candidate under “Step 4: Analyze Package Metadata for Suspicion Signals”; not verified execution.

  20. 26
    Aktion

    Description similarity: Compare package descriptions. Typosquats frequently copy or closely paraphrase the target package description to appear legitimate.

    Source-described action candidate under “Step 4: Analyze Package Metadata for Suspicion Signals”; not verified execution.

  21. 27
    Aktion

    Version count: Legitimate packages typically have many versions over time. A package with only 1-2 versions and a name similar to a popular package is suspicious.

    Source-described action candidate under “Step 4: Analyze Package Metadata for Suspicion Signals”; not verified execution.

  22. 28
    Entscheidung

    Repository URL analysis: Check if the candidate links to the same repository as the target (likely legitimate fork/mirror) or has no repository URL (suspicious).

    Source-described decision candidate under “Step 4: Analyze Package Metadata for Suspicion Signals”; not verified execution.

  23. 29
    Ausgabe

    Step 5: Score, Rank, and Report Findings

    Source-described output candidate under “Step 5: Score, Rank, and Report Findings”; not verified execution.

  24. 30
    Aktion

    Weighted scoring: Assign weights to each signal. Example: Levenshtein distance 1 = 40 points, Levenshtein distance 2 = 25 points, created < 90 days ago = 15 points, download ratio < 0.001 = 15 points, different author = 10 points, single version = 5 points. Total score out of 100.

    Source-described action candidate under “Step 5: Score, Rank, and Report Findings”; not verified execution.

  25. 31
    Aktion

    Threshold classification: Score >= 70: HIGH risk (likely typosquat), 40-69: MEDIUM risk (requires manual review), < 40: LOW risk (likely legitimate)

    Source-described action candidate under “Step 5: Score, Rank, and Report Findings”; not verified execution.

  26. 32
    Ausgabe

    Generate report: For each flagged package, include the target it mimics, all signal values, the composite score, direct links to both packages on the registry, and a recommendation (block, investigate, or allow)

    Source-described output candidate under “Step 5: Score, Rank, and Report Findings”; not verified execution.

  27. 33
    Ausgabe

    Actionable output: Produce a blocklist of flagged package names that can be imported into package manager deny-lists, CI/CD policy engines, or artifact repository proxy rules

    Source-described output candidate under “Step 5: Score, Rank, and Report Findings”; not verified execution.

  28. 34
    Aktion

    Key Concepts

    Source-described action candidate under “Key Concepts”; not verified execution.

  29. 35
    Aktion

    Tools & Systems

    Source-described action candidate under “Tools & Systems”; not verified execution.

  30. 36
    Aktion

    Common Scenarios

    Source-described action candidate under “Common Scenarios”; not verified execution.

  31. 37
    Aktion

    Parse `requirements.txt` and `Pipfile.lock` to extract all 87 direct and transitive dependencies

    Source-described action candidate under “Scenario: Auditing a Python Project for Typosquatted Dependencies”; not verified execution.

  32. 38
    Aktion

    Generate typosquat candidates for each dependency using character omission, transposition, substitution, and separator manipulation, producing approximately 2,400 candidate names

    Source-described action candidate under “Scenario: Auditing a Python Project for Typosquatted Dependencies”; not verified execution.

  33. 39
    Aktion

    Query the PyPI JSON API for each candidate, finding 34 that actually exist as published packages

    Source-described action candidate under “Scenario: Auditing a Python Project for Typosquatted Dependencies”; not verified execution.

  34. 40
    Aktion

    Score each existing candidate: 3 packages score above 70 (HIGH risk) with Levenshtein distance 1, created within the last 60 days, single version, and fewer than 100 downloads

    Source-described action candidate under “Scenario: Auditing a Python Project for Typosquatted Dependencies”; not verified execution.

  35. 41
    Aktion

    Manual review confirms 2 of the 3 are malicious typosquats containing obfuscated code that exfiltrates environment variables during installation

    Source-described action candidate under “Scenario: Auditing a Python Project for Typosquatted Dependencies”; not verified execution.

  36. 42
    Ausgabe

    Block the malicious packages in the organization's artifact proxy, report to PyPI for takedown via `[email protected]`, and add all 87 dependencies to the ongoing monitoring watchlist

    Source-described output candidate under “Scenario: Auditing a Python Project for Typosquatted Dependencies”; not verified execution.

  37. 43
    Aktion

    Implement the detection agent as a scheduled CI job that runs weekly and alerts on new HIGH-risk findings

    Source-described action candidate under “Scenario: Auditing a Python Project for Typosquatted Dependencies”; not verified execution.

  38. 44
    Ausgabe

    Output Format

    Source-described output candidate under “Output Format”; not verified execution.

Mögliche Risikoflächen

Statische Befunde zeigen Stellen, die vor der Installation zu prüfen sind. Sie belegen nicht, dass ein Skill sicher, bösartig oder wirksam ist.

Punkte, die eine Prüfung erfordern

68 deterministic lexical finding(s) require review across the collected text. Findings can occur in documentation and do not prove execution or exploitability; binary-only files were not scanned.

NetzwerkzugriffBeobachtet
DateischreibzugriffeBeobachtet
Verwendung von ZugangsdatenNicht beobachtet
Mittel

Network access is mentioned

23 Vorkommen

A URL or network client appears in this source line. Review destinations, data sent, and trust boundaries; static text cannot establish actual network activity. This rule matched 23 location(s) in the collected text; 3 representative location(s) are cited. Matching text may be documentation, and the analyzer did not execute it.

Hinweis

File modification is described or implemented

45 Vorkommen

This line contains a possible file-write or redirection operation. Check destination paths and overwrite behavior; the static review did not write any file. This rule matched 45 location(s) in the collected text; 3 representative location(s) are cited. Matching text may be documentation, and the analyzer did not execute it.

Wo Kontext verbraucht werden kann

Discovery-, Aktivierungs- und Ressourcenschichten haben unterschiedliche Bedeutung. Exakte Werte erscheinen nur, wenn die offizielle Zählmethode mit einem benannten Modell lief.

Keine exakten Token-Zählwerte verfügbar

All token values, including per-file inventory, are null until the pipeline performs an official exact count with an explicit model.

Es wurde keine Token-Messung mit der vorgeschriebenen offiziellen Methode erfasst. Dieses Dossier ersetzt sie nicht durch Zeichenanzahl, Dateigröße oder Schätzwerte.

Kontrollierte Evaluation

Keine kontrollierte Evaluation

Für diesen Skill liegen nur die oben genannten Belege vor. Es wird keine Aufgabenerfolgsquote, Token-Effizienz, Latenz oder kein Qualitätsvorteil behauptet.

Nicht getestet

Verwendung mit der Quelle im Blick

Installationsbefehl
Inspect the pinned source at https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/54a798831d2266a3ca61ce68a7acb80b81160d57/skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md and follow the source repository's installation instructions. No installation was performed or verified by this static analyzer. Source license: Apache-2.0.

Voraussetzungen

  • Static analysis cannot assess runtime behavior, command success, network reachability, or model output quality.
  • No commands, scripts, network requests, model calls, or controlled skill executions were performed.
  • Category, tags, capabilities, workflows, and bilingual editorial summaries are deterministic candidates from static parsing, not verified outcomes.
  • Exact token counts are unavailable until a later pipeline performs and records an official model-specific count.

Beispiel-Prompts

Nicht angegeben

Ein Urteil, mit seinen Grenzen

Stärken

  • The snapshot contains 4 collected file(s), 2 Markdown file(s), and 1 script file(s), enabling source-level inspection. [Evidence: skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.md:L1]

Abwägungen

  • No functional, security, or model-quality result has been established. Inspect source context and all cited findings before installation or publication.
Forschungsfazit

Provisional deterministic static inventory only; from static parsing and, separately, controlled evaluation. No install recommendation, security assurance, or effectiveness claim is made.

Konstruktiv nachvollziehbar

Das Dossier ist eine zeitlich begrenzte Lesart eines öffentlichen Artefakts, keine Empfehlung. Über den Quelllink können Sie das exakte Upstream-Material prüfen.

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-typosquatting-packages-in-npm-pypi
Quellenart
Community
Commit
54a798831d2266a3ca61ce68a7acb80b81160d57
Erfasst
20. Nov. 2026
Zuletzt geprüft
20. Nov. 2026
Upstream-Lizenz
Apache-2.0
Repository-Sterne
36.446
Inhaltsgrundlage

Deterministic lexical parsing, YAML frontmatter validation, file inventory, source-described workflow extraction, and heuristic provisional classification of the supplied files only. Generated by machine; no LLM, execution, or dynamic testing.