Malicious Code Vulnerability in randomstringgen Package - Exfiltration Risk

randomstringgen Updated 28 Feb 2026

Summary

28/02/2026
CRITICAL
No i
Critical
Not published

MAL-2026-1089: Malicious code in randomstringgen (PyPI). Affects randomstringgen versions 0.1 – 0.4. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The randomstringgen package, available on PyPI, is designed to generate random strings for various applications. It is commonly used in Python projects for tasks such as creating unique identifiers or random passwords. However, this package has been compromised, leading to a significant security vulnerability that allows malicious code execution.

Vulnerability Detail

The vulnerability originates from a malicious code embedded in the randomstringgen package, specifically in versions 0.1 to 0.4. This code is designed to exfiltrate the user's current running file, likely their script, to a hardcoded location. The malicious intent is clear, as it aims to steal sensitive information from users without their consent. The campaign has been categorized as MALICIOUS due to its infostealer characteristics, posing a serious risk to users who have installed this package.

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

pip uninstall randomstringgen

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, users can avoid using the randomstringgen package until a secure version is released. Alternatively, consider using other libraries for generating random strings, such as 'secrets' or 'random', which do not have this vulnerability.

Conclusion

The randomstringgen package has been compromised, leading to a serious vulnerability that allows for the exfiltration of user scripts. It is crucial for users to update to a secure version or use alternative libraries to mitigate this risk. Monitoring tools like Vulert can assist in identifying vulnerabilities in your applications.

See every vulnerability recorded for randomstringgen →

Share this vulnerability

FAQ

randomstringgen is a Python package used to generate random strings for various applications, such as unique identifiers and passwords.

The vulnerability allows malicious code to exfiltrate users' scripts, potentially leading to data theft and unauthorized access to sensitive information.

Versions 0.1, 0.2, 0.3, and 0.4 of the randomstringgen package are affected by this vulnerability.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

If you cannot update the package, consider using alternative libraries for random string generation and avoid using randomstringgen until a secure version is available.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

This package is malicious. Remove it and rotate any credentials it could have accessed.

pip uninstall randomstringgen

If it arrived as a transitive dependency, remove the package that pulled it in, then reinstall.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback