Retour au catalogue
Examen statiqueDéveloppement

Dossier du skill

detecting-typosquatting-packages-in-npm-pypi

Déclaration de la source

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.

La description originale de l'auteur, conservée en anglais. Elle décrit l'intention, pas des performances vérifiées.

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

Le contenu de recherche de ce site est publié en anglais et en chinois ; il est affiché ici en anglais.

Résumé de la recherche

Analyse statique

Ces observations proviennent d'une analyse déterministe de la source. Ce n'est pas une évaluation de tâche contrôlée.

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.

Portée de l'examen

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.

Capacités observables

  • 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]

Limites et portée

  • 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.

Pertinent pour

  • 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]

Ce que contient le skill

L'inventaire des fichiers provient de la source collectée au commit consigné. Les chemins et les tailles sont des observations structurelles, pas une mesure de qualité.

fichiers
4
Fichiers Markdown
2
scripts
1
références
1
Taille
49,2 KB
Complexité structurelle
Faible

Inventaire des fichiers

CheminTypeOctets
skills/detecting-typosquatting-packages-in-npm-pypi/LICENSEAutre11 KB
skills/detecting-typosquatting-packages-in-npm-pypi/references/api-reference.mdRéférence5,5 KB
skills/detecting-typosquatting-packages-in-npm-pypi/scripts/agent.pyScript19,8 KB
skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.mdInstruction13 KB

Frontmatter du SKILL.md

{
  "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"
  ]
}

Une lecture de la séquence de fonctionnement

Ce workflow reconstitue la séquence apparente à partir du matériel source. Sauf si une évaluation contrôlée est explicitement consignée, il est provisoire et non une trace observée.

  1. 01
    Décision

    When to Use

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

  2. 02
    Action

    Workflow

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

  3. 03
    Action

    Step 1: Build the Target Package Watchlist

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

  4. 04
    Action

    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
    Action

    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
    Action

    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.

Examiner toutes les étapes de workflow candidates (44 étapes candidates)
  1. 07
    Action

    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
    Action

    Step 2: Generate Candidate Typosquat Names

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

  3. 09
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Décision

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Décision

    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
    Action

    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
    Action

    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
    Décision

    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
    Sortie

    Step 5: Score, Rank, and Report Findings

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

  24. 30
    Action

    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
    Action

    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
    Sortie

    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
    Sortie

    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
    Action

    Key Concepts

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

  29. 35
    Action

    Tools & Systems

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

  30. 36
    Action

    Common Scenarios

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

  31. 37
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Action

    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
    Sortie

    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
    Action

    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
    Sortie

    Output Format

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

Surfaces de risque potentielles

Les constats statiques signalent les points à examiner avant l'installation. Ils n'établissent pas qu'un skill est sûr, malveillant ou efficace.

Éléments à examiner

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.

Accès réseauObservé
Écritures de fichiersObservé
Utilisation d'identifiantsNon observé
Moyen

Network access is mentioned

23 occurrences

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.

Note

File modification is described or implemented

45 occurrences

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.

Où le contexte peut être consommé

Les couches de découverte, d'activation et de ressources n'ont pas la même signification. Les valeurs exactes n'apparaissent que si la méthode officielle de comptage a été exécutée avec un modèle nommé.

Comptage exact des tokens indisponible

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

Aucune mesure de tokens n'a été consignée selon la méthode officielle requise. Ce dossier ne la remplace ni par un nombre de caractères, ni par une taille de fichier, ni par une estimation.

Évaluation contrôlée

Aucune évaluation contrôlée

Ce skill ne dispose que des preuves identifiées ci-dessus. Aucun taux de réussite, gain d'efficience en tokens, latence ou avantage de qualité n'est affirmé.

Non testé

Utiliser en gardant la source en vue

Commande d'installation
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.

Prérequis

  • 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.

Exemples de prompts

Non renseigné

Une conclusion, avec ses limites

Points forts

  • 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]

Points d'attention

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

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

Traçable par construction

Le dossier est une lecture datée d'un artefact public, pas une approbation. Utilisez le lien source pour examiner le contenu amont exact.

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-typosquatting-packages-in-npm-pypi
Type de source
Communauté
Commit
54a798831d2266a3ca61ce68a7acb80b81160d57
Collecté
20 nov. 2026
Dernière vérification
20 nov. 2026
Licence amont
Apache-2.0
Étoiles du dépôt
36 446
Base du contenu

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.