Back to catalog
Static reviewDevelopment

Skill dossier

detecting-typosquatting-packages-in-npm-pypi

Source declaration

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.

The author's original description, preserved in English. It describes intent, not verified performance.

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

Research summary

Machine-generated analysis; pending human review

These observations come from deterministic source parsing, not a human security review or controlled task evaluation.

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 pending human editorial review.

Review scope

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

Observable capabilities

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

Limitations & scope

  • 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 pending human review, not verified outcomes.
  • Exact token counts are unavailable until a later pipeline performs and records an official model-specific count.

Relevant for

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

What ships with the skill

The file inventory comes from the collected source at the recorded commit. Paths and sizes are structural observations, not a measure of quality.

files
4
Markdown files
2
scripts
1
references
1
Size
49.2 KB
Structural complexity
Low

File inventory

PathTypeBytes
skills/detecting-typosquatting-packages-in-npm-pypi/LICENSEOther11 KB
skills/detecting-typosquatting-packages-in-npm-pypi/references/api-reference.mdReference5.5 KB
skills/detecting-typosquatting-packages-in-npm-pypi/scripts/agent.pyScript19.8 KB
skills/detecting-typosquatting-packages-in-npm-pypi/SKILL.mdInstruction13 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"
  ]
}

A reading of the operating sequence

This workflow reconstructs the apparent sequence from source material. Unless controlled evaluation is explicitly recorded, it is provisional—not an observed trace.

  1. 01
    Decision

    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.

Inspect all extracted workflow candidates (44 candidate steps)
  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
    Decision

    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
    Decision

    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
    Decision

    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
    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
    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
    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
    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
    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
    Output

    Output Format

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

Potential risk surfaces

Static findings identify points to inspect before installation. They do not establish that a skill is safe, malicious, or effective.

Items warrant review

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.

Network accessObserved
File writesObserved
Credential useNot observed
Medium

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.

Where context can be spent

Discovery, activation, and resource layers have different meanings. Exact values appear only when the official token-counting method was run with a named model.

Exact token counts unavailable

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

No token measurement was recorded with the required official method. This dossier does not substitute character counts, file sizes, or estimates.

Controlled evaluation

No controlled evaluation

This skill has only the evidence identified above. No task success, token efficiency, latency, or quality advantage is claimed.

Not tested

Use with the source in view

Install command
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.

Prerequisites

  • 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 pending human review, not verified outcomes.
  • Exact token counts are unavailable until a later pipeline performs and records an official model-specific count.

Example prompts

Not provided

A decision, with its limits attached

Strengths

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

Considerations

  • No functional, security, or model-quality result has been established. Human review must inspect source context and all cited findings before installation or publication.
Research conclusion

Provisional deterministic static inventory only; pending human editorial review and, separately, controlled evaluation. No install recommendation, security assurance, or effectiveness claim is made.

Traceable by construction

The dossier is a time-bound reading of a public artifact, not an endorsement. Use the source link to inspect the exact upstream material.

mukul975Anthropic-Cybersecurity-Skillsskills/detecting-typosquatting-packages-in-npm-pypi
Source type
Community
Commit
54a798831d2266a3ca61ce68a7acb80b81160d57
Collected
20 Nov 2026
Last checked
20 Nov 2026
Upstream license
Apache-2.0
Repository stars
36,446
Content basis

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, dynamic testing, or human editorial approval.