Malicious code in tiktoken-mcp (PyPI)
The tiktoken-mcp package on PyPI is a malicious typosquatting package impersonating the legitimate OpenAI tiktoken package. It includes a .pth file that executes obfuscated JavaScript code via the Bun runtime on every Python interpreter start. This code downloads the Bun runtime, searches for attacker-controlled JavaScript files on sys.path, and executes them, enabling stealthy execution outside Python inspection. The package acts as an infostealer, collecting sensitive data such as API keys, credentials, cryptocurrency assets, and password manager data, and attempts persistence and propagation by publishing infected packages. It may also perform destructive actions if invalid GitHub tokens are detected. The affected versions are 0.13.1 and 0.13.2.
AI Analysis
Technical Summary
tiktoken-mcp is a malicious PyPI package that impersonates the legitimate OpenAI tiktoken package by copying metadata and bundling the upstream README. It installs a tiktoken-setup.pth file that executes an obfuscated JavaScript payload using the Bun runtime on Python startup. This payload downloads the Bun runtime, extracts it to a temporary directory, and executes any '_index.js' files found on sys.path, which are attacker-controlled. The package itself does not include these files, enabling runtime-resolved malicious code execution outside Python's inspection. The infostealer collects a wide range of sensitive data including API keys, repository credentials, cryptocurrency assets, and password manager data. It also attempts to gain persistence and spread by publishing infected packages using stolen credentials. The code may wipe user data if invalid GitHub tokens are detected. This campaign is linked to the Mini Shai Hulud campaign and is categorized as a malicious package with clear intent to steal information and cause harm.
Potential Impact
This malicious package can lead to severe compromise of affected systems by exfiltrating sensitive information such as API keys, cloud tokens, repository credentials, cryptocurrency assets, and password manager data. It can also execute arbitrary attacker-controlled JavaScript code on Python startup, bypassing Python-only security inspections. The package attempts persistence and propagation by publishing infected packages using stolen credentials. Additionally, it may perform destructive actions including wiping user data if invalid GitHub tokens are detected, posing a risk of data loss.
Mitigation Recommendations
No official patch or remediation is available for this malicious package. The best mitigation is to avoid installing tiktoken-mcp versions 0.13.1 and 0.13.2 and to remove any existing installations immediately. Users should verify the authenticity of packages before installation, prefer official sources, and monitor for suspicious activity related to package repositories and credentials. Cleanup should be performed with caution due to potential destructive payloads. Consult vendor advisories or trusted security sources for updates on remediation or detection tools.
Malicious code in tiktoken-mcp (PyPI)
Description
The tiktoken-mcp package on PyPI is a malicious typosquatting package impersonating the legitimate OpenAI tiktoken package. It includes a .pth file that executes obfuscated JavaScript code via the Bun runtime on every Python interpreter start. This code downloads the Bun runtime, searches for attacker-controlled JavaScript files on sys.path, and executes them, enabling stealthy execution outside Python inspection. The package acts as an infostealer, collecting sensitive data such as API keys, credentials, cryptocurrency assets, and password manager data, and attempts persistence and propagation by publishing infected packages. It may also perform destructive actions if invalid GitHub tokens are detected. The affected versions are 0.13.1 and 0.13.2.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
tiktoken-mcp is a malicious PyPI package that impersonates the legitimate OpenAI tiktoken package by copying metadata and bundling the upstream README. It installs a tiktoken-setup.pth file that executes an obfuscated JavaScript payload using the Bun runtime on Python startup. This payload downloads the Bun runtime, extracts it to a temporary directory, and executes any '_index.js' files found on sys.path, which are attacker-controlled. The package itself does not include these files, enabling runtime-resolved malicious code execution outside Python's inspection. The infostealer collects a wide range of sensitive data including API keys, repository credentials, cryptocurrency assets, and password manager data. It also attempts to gain persistence and spread by publishing infected packages using stolen credentials. The code may wipe user data if invalid GitHub tokens are detected. This campaign is linked to the Mini Shai Hulud campaign and is categorized as a malicious package with clear intent to steal information and cause harm.
Potential Impact
This malicious package can lead to severe compromise of affected systems by exfiltrating sensitive information such as API keys, cloud tokens, repository credentials, cryptocurrency assets, and password manager data. It can also execute arbitrary attacker-controlled JavaScript code on Python startup, bypassing Python-only security inspections. The package attempts persistence and propagation by publishing infected packages using stolen credentials. Additionally, it may perform destructive actions including wiping user data if invalid GitHub tokens are detected, posing a risk of data loss.
Mitigation Recommendations
No official patch or remediation is available for this malicious package. The best mitigation is to avoid installing tiktoken-mcp versions 0.13.1 and 0.13.2 and to remove any existing installations immediately. Users should verify the authenticity of packages before installation, prefer official sources, and monitor for suspicious activity related to package repositories and credentials. Cleanup should be performed with caution due to potential destructive payloads. Consult vendor advisories or trusted security sources for updates on remediation or detection tools.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- MAL-2026-5326
- Osv Schema Version
- 1.7.4
- Aliases
- []
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- null
- Cvss Version
- null
Threat ID: 6a50ba8f68715ace435821dc
Added to database: 07/10/2026, 09:25:35 UTC
Last enriched: 07/10/2026, 10:07:36 UTC
Last updated: 07/30/2026, 18:15:20 UTC
Views: 21
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.