Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
Malicious package

pyyiPyPI

Advisory published Updated

pyyi is a confirmed malicious PyPI package (MAL-2026-17866) that steals credentials and exfiltrates sensitive data (malicious versions 2.4, 2.4.1, 2.4.2…). Do not install it — remove it immediately and rotate any exposed credentials.

Malicious code in pyyi (PyPI)

MAL-2026-17866
Immediate action
Remove the package, then rotate any secrets the build/runtime could reach.
pip uninstall pyyi

What this malware does

The verified PyPI wheel declares a console command named python2 (pyyi.cli:main). For commands other than the local REPL, help, version, unlock, or uninstall paths, it obtains configuration and calls run_payload(). Registration sends the hostname and OS to a configured space-z.ai server and stores the returned apiKey in ~/.python2/config.json. The REPL presents a normal Python banner but silently sends eligible single-token inputs to /api/cli/unlock as the password field, subject to filtering and attempt limits. run_payload() fetches code from /api/cli/payload, base64-decodes and gzip-decompresses it, then executes it in memory using exec(compile(src, '<adv>', 'exec'), g) at pyyi/cli.py:640 and calls its main function. Loader failures are disguised as Python's can't open file error. The malicious assessment is based on the combination of interpreter impersonation, concealed input transmission, remote code execution, and deliberate failure concealment, rather than encoding or exec alone. Static review and isolated, network-disabled mock tests confirmed the input-to-request and response-to-execution data flows using synthetic canaries and payloads. No live endpoint was contacted, and the actual server-supplied payload and its subsequent behavior remain unknown. Wheel SHA-256: 003828175a747a9a3de8029e6a028ad2c3739abf1dad7b468b25636e391e91f4.

The package advertises itself as a 'cryptographic modules' library (README references pyyi.generate_key() / pyyi.encrypt()) but ships none of that API — init.py only defines version. The real payload is a console_scripts entry registered as the literal name python3.7, which on PATH shadows the user's real Python 3.7 interpreter and is also written to /usr/local/bin/python3.7, ~/.local/bin/python3.7, and %LOCALAPPDATA%...\python3.7.exe. When invoked, the CLI resolves an obfuscated destination (base64 ciphertext XORed with a 16-byte hex key, stored in _ENC_NET and decoded only at runtime by _baked_hosts), POSTs to <server>/api/update, and if a payload field is returned, base64-decodes and gzip-decompresses it and runs exec(compile(src, '<adv>', 'exec'), g); g['main'](argv) with no pinning, signature, or hash check — the remote operator chooses what Python code runs on the host. The CLI also stands up a fake REPL (_GateConsole) that reproduces the real Python {sys.version} on {sys.platform} banner and reads input with terminal echo disabled via _quiet_read; single-token entries are treated as candidate passwords and POSTed as {apiKey, password} to the same obfuscated endpoint (op=2), with accepted values persisted locally XORed by a per-machine key. The combination of a cover-story package description, interpreter impersonation on PATH, obfuscated C2 destination, unauthenticated in-memory exec of server-supplied code, and an echo-off password-capturing fake REPL constitutes installer-side remote code execution and credential theft.

Malicious versions

9 flagged
2.42.4.12.4.22.5.02.5.12.5.22.5.32.5.42.5.5

Indicators of compromise (SHA-256)

7c36f3b8e69fc44eadb3a47bbb2b8a46d7beb8802aab88ca009b05d601d45fd0
7ac60870a568a1e1336d1d1696b9129a0f8bc13da7395fc24ed23ec4e8bf791e
9cf00d6eaf64906d3dc7feaf25f521d20d150832a04df89ecde5c667a4ac3d2d
9f5a8173a4900be512c6a66fd0eb76e30d1bd55f60b9ed931107447070d9d6e0
c2b987db2bc9b14bd26856280ea2a0ef32b6d5f168cee211959dc9aadc7dcbbf
4765ecf214740c466954b89b776b0db7a87eeec0d1e5c4dbfb2e91ba5d688692
79b1360595b32736c76d9cb0ee954382456bf44a18af80dbe78d84884ba0e0cc
7f723466cb3f5d65fafcc0022b32dc408b67a7b33fb5cc0060672434bf1fc406

Detection & response playbook

Credential / info stealer
  1. Find it

    Search your lockfiles and build artifacts for pyyi (9 malicious versions).

  2. If you installed it — respond

    pyyi is built to steal secrets, so assume every credential the build or runtime could read is compromised. Remove it from your project and lockfile, then rotate ALL exposed secrets — npm/registry tokens, cloud keys, CI/CD secrets, SSH keys, and any .env values — from a known-clean machine. Audit logs for unauthorized use of those credentials.

  3. Did it already run?

    If pyyi was installed, its post-install payload may already have run. Removing the package does not undo that — check outbound connections and credential use from the install window onward.

Frequently asked questions

No. pyyi on PyPI has been identified as a malicious package (versions 2.4, 2.4.1, 2.4.2, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, and 1 more flagged). It should be removed immediately — do not install or keep it in your dependency tree.

Campaign

IN-MAL-2026-021509IN-MAL-2026-021508IN-MAL-2026-021539IN-MAL-2026-021543IN-MAL-2026-021545IN-MAL-2026-021541IN-MAL-2026-021538IN-MAL-2026-021540

References

Credits

  • Amazon Inspector · finder
  • smiling-hyena · finder

Detect & block this

O3 blocks pyyi-class packages before install and in CI — and if it already ran, its runtime egress monitoring catches the credential exfiltration and severs the channel.

Explore

pyyi (PyPI) malicious package — MAL-2026-17866 | O3 Security