Volver al catálogo
Revisión estáticaDesarrollo

Dosier de la skill

detecting-typosquatting-packages-in-npm-pypi

Declaración de origen

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 descripción original del autor, conservada en inglés. Describe la intención, no un rendimiento verificado.

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

El contenido de investigación de este sitio está publicado en inglés y chino, y aquí se muestra en inglés.

Resumen de la investigación

Análisis estático

Estas observaciones proceden del análisis determinista del código fuente. No son una evaluación controlada de tareas.

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.

Alcance de la revisión

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.

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

Limitaciones y alcance

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

Relevante para

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

Qué incluye la skill

El inventario de archivos procede del código fuente recopilado en el commit registrado. Las rutas y los tamaños son observaciones estructurales, no una medida de calidad.

archivos
4
Archivos Markdown
2
scripts
1
referencias
1
Tamaño
49,2 KB
Complejidad estructural
Baja

Inventario de archivos

RutaTipoBytes
skills/detecting-typosquatting-packages-in-npm-pypi/LICENSEOtro11 KB
skills/detecting-typosquatting-packages-in-npm-pypi/references/api-reference.mdReferencia5,5 KB
skills/detecting-typosquatting-packages-in-npm-pypi/scripts/agent.pyScript19,8 KB
skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.mdInstrucción13 KB

Frontmatter de 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"
  ]
}

Una lectura de la secuencia de funcionamiento

Este flujo de trabajo reconstruye la secuencia aparente a partir del material de origen. A menos que se registre explícitamente una evaluación controlada, es provisional y no un seguimiento observado.

  1. 01
    Decisión

    When to Use

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

  2. 02
    Acción

    Workflow

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

  3. 03
    Acción

    Step 1: Build the Target Package Watchlist

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

  4. 04
    Acción

    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
    Acción

    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
    Acción

    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.

Examinar todos los pasos de flujo de trabajo candidatos (44 pasos candidatos)
  1. 07
    Acción

    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
    Acción

    Step 2: Generate Candidate Typosquat Names

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

  3. 09
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Decisión

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Decisión

    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
    Acción

    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
    Acción

    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
    Decisión

    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
    Salida

    Step 5: Score, Rank, and Report Findings

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

  24. 30
    Acción

    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
    Acción

    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
    Salida

    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
    Salida

    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
    Acción

    Key Concepts

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

  29. 35
    Acción

    Tools & Systems

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

  30. 36
    Acción

    Common Scenarios

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

  31. 37
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Acción

    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
    Salida

    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
    Acción

    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
    Salida

    Output Format

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

Posibles superficies de riesgo

Los hallazgos estáticos señalan puntos que conviene revisar antes de instalar. No establecen que una skill sea segura, maliciosa ni eficaz.

Elementos que requieren revisión

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.

Acceso a la redObservado
Escrituras de archivosObservado
Uso de credencialesNo observado
Media

Network access is mentioned

23 ocurrencias

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.

Nota

File modification is described or implemented

45 ocurrencias

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.

Dónde puede consumirse el contexto

Las capas de descubrimiento, activación y recursos tienen significados distintos. Los valores exactos solo aparecen cuando el método oficial de recuento se ejecutó con un modelo identificado.

Recuento exacto de tokens no disponible

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

No se registró ninguna medición de tokens con el método oficial requerido. Este dosier no la sustituye por recuentos de caracteres, tamaños de archivo ni estimaciones.

Evaluación controlada

Sin evaluación controlada

Esta skill solo cuenta con las evidencias indicadas arriba. No se afirma ninguna tasa de éxito, eficiencia de tokens, latencia ni ventaja de calidad.

Sin probar

Úsala con el código fuente a la vista

Comando de instalación
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.

Requisitos previos

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

Prompts de ejemplo

No proporcionado

Una decisión, con sus límites

Fortalezas

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

Aspectos a considerar

  • No functional, security, or model-quality result has been established. Inspect source context and all cited findings before installation or publication.
Conclusión de la investigación

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

Trazable por construcción

El dosier es una lectura acotada en el tiempo de un artefacto público, no un respaldo. Usa el enlace al código fuente para inspeccionar el material original exacto.

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-typosquatting-packages-in-npm-pypi
Tipo de origen
Comunidad
Commit
54a798831d2266a3ca61ce68a7acb80b81160d57
Recopilado
20 nov 2026
Última comprobación
20 nov 2026
Licencia original
Apache-2.0
Estrellas del repositorio
36.446
Base del contenido

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.