Skip to main content

Malicious code in flask-header-guard (PyPI)

0
Critical
Published: 08/29/2026 (08/29/2026, 11:29:06 UTC)
Source: GCVE Database
Product: flask-header-guard

Description

The flask-header-guard package on PyPI (version 1.0.0) is a malicious package masquerading as Flask security-headers middleware. It executes hostile code during installation and when imported, including exfiltration of sensitive environment variables and system files, establishing persistence via a reverse shell, local privilege escalation, and an unauthenticated remote code execution backdoor in Flask apps.

Affected software

PyPIghsa
flask-header-guard
Affected versions
=1.0.0

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

AILast updated: 09/09/2026, 21:52:58 UTC

Technical Analysis

The flask-header-guard PyPI package (version 1.0.0) contains malicious code that executes at install time and runtime. During installation, it base64-decodes and executes a payload that collects environment variables related to credentials and reads sensitive system files such as /etc/passwd, /etc/shadow, and logs, saving this data locally. It establishes persistence by installing a reverse shell script triggered every minute via cron and attempts local privilege escalation by adding a passwordless sudoers entry if run with sufficient privileges. When imported into a Flask application, it registers a hidden route allowing unauthenticated remote code execution, arbitrary file read, directory listing, file upload, and a shell interface. The package's stated purpose as security middleware is a cover for credential theft, persistent command and control, privilege escalation, and a web backdoor.

Potential Impact

This malicious package enables attackers to steal sensitive environment variables and system files, maintain persistent remote access via a reverse shell, escalate privileges to root without a password, and remotely execute arbitrary commands on any Flask application importing the package. This compromises confidentiality, integrity, and availability of affected systems and data.

Mitigation Recommendations

No official patch or remediation is currently documented. Users should immediately uninstall flask-header-guard version 1.0.0 and audit systems for signs of compromise, including unauthorized cron jobs, suspicious sudoers entries, and unexpected network connections. Avoid installing untrusted or unknown PyPI packages, and verify package authenticity before use. Monitor for updates or advisories from trusted sources regarding this package.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
MAL-2026-15566
Osv Schema Version
1.7.4
Ecosystems
["PyPI"]

Threat ID: 6a92f7d1acd9273b49e75826

Added to database: 08/29/2026, 15:16:33 UTC

Last enriched: 09/09/2026, 21:52:58 UTC

Last updated: 10/01/2026, 22:26:48 UTC

Views: 38

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses