Skip to content
supplychainattack.orgSupply chain attack incident catalog
resolvedcritical

Malicious code in a3s-code (PyPI)

The a3s-code PyPI package contained malicious code that fetched and executed native binaries (.so/.pyd/.dylib) from a GitHub organization (A3S-Lab) distinct from the documented project (AI45Lab), bypassing pip build isolation and hash verification.

ShareXLinkedInHacker News
Disclosed
Last updated
Blast radius
All users who imported a3s-code from PyPI
Ecosystems
Attack vectors
Affected entities
  • a3s-codePyPI package

The a3s-code package on PyPI contained malicious code in its top-level __init__.py that invoked _bootstrap.ensure_native_loaded() on first import. This function performed an HTTP GET request to https://github.com/A3S-Lab/Code/releases/download/... to fetch platform-specific native binaries (.so, .pyd, or .dylib files), which were written to ~/.cache/a3s-code/ and loaded via importlib.machinery.ExtensionFileLoader, executing arbitrary native code at import time.

The attack exploited a discrepancy between documented and actual code sources. Package metadata (README.md, PKG-INFO, and pyproject.toml) consistently declared the project as github.com/AI45Lab/Code, but the hard-coded fetch URL in _bootstrap.py pointed to github.com/A3S-Lab/Code—a visually similar but distinct GitHub organization. This allowed the attacker to control the native binaries executed on victim machines.

Hash verification was implemented but ineffective: the manifest containing hashes was served from the same base URL as the binaries, and verification was silently skipped if the manifest fetch failed. This provided no integrity guarantee against a compromised fetch source. Users reviewing the documented repository would not discover the actual code being executed on their systems.

The incident was identified and credited to the OpenSSF's malicious-packages project.

Indicators of compromise

Packages
  • a3s-code
Domains
  • github.com/A3S-Lab/Code

Remediation

  • Uninstall a3s-code immediately from all affected systems
  • Review system logs and process execution history for suspicious native code execution from ~/.cache/a3s-code/
  • Audit any systems that imported a3s-code for signs of compromise or data exfiltration
  • Use dependency scanning tools to detect a3s-code in project dependencies
  • Verify the legitimacy of any similar-named packages before installation, checking both package metadata and actual source URLs
  • Consider using pip audit or similar tools to detect known malicious packages

Sources

  1. GitHub Advisory GHSA-7h9h-pqmg-8fwx · GitHub Advisory Database

Cite this entry

"Malicious code in a3s-code (PyPI)." supplychainattack.org, Supply Chain Attack Incident Catalog. Disclosed July 21, 2026; last updated July 21, 2026. https://supplychainattack.org/incident/malicious-code-in-a3s-code-pypi-8zaorf

Suggest a correction

Found an error or have a newer source? Corrections to factual errors take priority over new entries.

  1. containedcritical

    Malicious code in fastapii (PyPI)

    The fastapii package on PyPI is a typosquatting attack imitating the popular FastAPI library. During installation, it executes obfuscated code that downloads and runs a malicious executable, exfiltrating cryptocurrency wallet data and potentially other sensitive information.

    2026 08 FlasqPyPITyposquattingCompromised package
  2. containedcritical

    Malicious code in idnna (PyPI)

    A malicious package named idnna was published to PyPI, imitating a legitimate library. During installation, the package executes obfuscated code that downloads and runs a malicious executable, exfiltrating cryptocurrency wallet data and potentially other sensitive information.

    PyPITyposquattingCompromised package
  3. containedcritical

    Malicious code in pydanticc (PyPI)

    The PyPI package pydanticc is a typosquatting attack imitating the popular pydantic library. During installation, it executes obfuscated code that downloads and runs a malicious executable, exfiltrating cryptocurrency wallet data and potentially other sensitive information.

    2026 08 FlasqPyPITyposquattingCompromised package
  4. containedcritical

    Malicious code in flasq (PyPI)

    A malicious package named flasq was published on PyPI, imitating a popular library. During installation, it executes obfuscated code that downloads and runs a malicious executable, exfiltrating cryptocurrency wallet data and potentially other sensitive information.

    PyPITyposquattingCompromised package