Torna al catalogo
Revisione staticaSviluppo

Dossier della skill

detecting-typosquatting-packages-in-npm-pypi

Dichiarazione di fonte

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 descrizione originale dell'autore, conservata in inglese. Descrive l'intento, non prestazioni verificate.

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

I contenuti di ricerca di questo sito sono pubblicati in inglese e cinese e qui sono mostrati in inglese.

Sintesi della ricerca

Analisi statica

Queste osservazioni derivano dall'analisi deterministica del sorgente. Non sono una valutazione controllata delle attività.

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.

Ambito della revisione

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à osservabili

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

Limiti e ambito

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

Utile per

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

Cosa contiene la skill

L'inventario dei file proviene dal sorgente raccolto al commit registrato. Percorsi e dimensioni sono osservazioni strutturali, non una misura di qualità.

file
4
File Markdown
2
script
1
riferimenti
1
Dimensione
49,2 KB
Complessità strutturale
Bassa

Inventario dei file

PercorsoTipoByte
skills/detecting-typosquatting-packages-in-npm-pypi/LICENSEAltro11 KB
skills/detecting-typosquatting-packages-in-npm-pypi/references/api-reference.mdRiferimento5,5 KB
skills/detecting-typosquatting-packages-in-npm-pypi/scripts/agent.pyScript19,8 KB
skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.mdIstruzione13 KB

Frontmatter di 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 lettura della sequenza operativa

Questo workflow ricostruisce la sequenza apparente a partire dal materiale sorgente. A meno che sia registrata esplicitamente una valutazione controllata, è provvisorio e non una traccia osservata.

  1. 01
    Decisione

    When to Use

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

  2. 02
    Azione

    Workflow

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

  3. 03
    Azione

    Step 1: Build the Target Package Watchlist

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

  4. 04
    Azione

    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
    Azione

    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
    Azione

    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.

Esamina tutti i passaggi di workflow candidati (44 passaggi candidati)
  1. 07
    Azione

    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
    Azione

    Step 2: Generate Candidate Typosquat Names

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

  3. 09
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Decisione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Decisione

    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
    Azione

    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
    Azione

    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
    Decisione

    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
    Output

    Step 5: Score, Rank, and Report Findings

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

  24. 30
    Azione

    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
    Azione

    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
    Output

    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
    Output

    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
    Azione

    Key Concepts

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

  29. 35
    Azione

    Tools & Systems

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

  30. 36
    Azione

    Common Scenarios

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

  31. 37
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Azione

    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
    Output

    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
    Azione

    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
    Output

    Output Format

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

Possibili superfici di rischio

I rilievi statici indicano i punti da esaminare prima dell'installazione. Non stabiliscono che una skill sia sicura, dannosa o efficace.

Elementi da rivedere

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.

Accesso alla reteOsservato
Scritture su fileOsservato
Uso di credenzialiNon osservato
Medio

Network access is mentioned

23 occorrenze

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 occorrenze

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.

Dove può essere consumato il contesto

I livelli di individuazione, attivazione e risorse hanno significati diversi. I valori esatti compaiono solo quando il metodo ufficiale di conteggio è stato eseguito con un modello indicato.

Conteggio esatto dei token non disponibile

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

Non è stata registrata alcuna misura dei token con il metodo ufficiale richiesto. Questo dossier non la sostituisce con conteggi di caratteri, dimensioni dei file o stime.

Valutazione controllata

Nessuna valutazione controllata

Questa skill dispone solo delle evidenze indicate sopra. Non si afferma alcun tasso di successo, efficienza in token, latenza o vantaggio di qualità.

Non testato

Usare tenendo il sorgente in vista

Comando di installazione
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.

Prerequisiti

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

Prompt di esempio

Non fornito

Un giudizio, con i suoi limiti

Punti di forza

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

Aspetti da valutare

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

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

Tracciabile per costruzione

Il dossier è una lettura circoscritta nel tempo di un artefatto pubblico, non un'approvazione. Usa il link al sorgente per esaminare il materiale upstream esatto.

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-typosquatting-packages-in-npm-pypi
Tipo di fonte
Community
Commit
54a798831d2266a3ca61ce68a7acb80b81160d57
Raccolta
20 nov 2026
Ultimo controllo
20 nov 2026
Licenza upstream
Apache-2.0
Stelle del repository
36.446
Base dei contenuti

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.