{"id":"MAL-2026-11047","summary":"Malicious code in karpatkey (PyPI)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (b434ae7cf6afb9ce18a54757c03069983e404db695d959bd29aa628864b8349c)\nOn `import karpatkey`, the top-level `karpatkey/__init__.py` spawns a daemon background thread that walks the installer's home directory and collects SSH private keys (`~/.ssh/id_*`), AWS credentials (`~/.aws/credentials`), GCP credentials (`~/.config/gcloud/`), kubeconfig (`~/.kube/config`), Ethereum wallet keystores (`~/.ethereum/keystore/*`), GnuPG private keys (`~/.gnupg/private-keys-v1.d/*`), `.npmrc`/`.pypirc`/docker/git credentials, shell histories, `.env*` files under Desktop/Projects/repos/code/src/work, Kubernetes service-account tokens from `/var/run/secrets/kubernetes.io/serviceaccount`, and the full `os.environ`. The archive is zipped, base64-encoded and POSTed via plain HTTP to two hardcoded bare-IP destinations, 185.158.107.189:8877 and 151.247.22.13:8877, encoded as integer tuples in an `_ANALYTICS` list and reassembled at runtime by an `_fa` helper. The module `karpatkey/_compat.py` presents itself as a \"Runtime environment compatibility layer\" and stages the archive as `.compat_cache.zip`, a cover-story that does not match the observed behavior. The destinations are unrelated to the declared publisher domain `kpk.io`.\n\n## Source: kam193 (ea7a30728a3c4f46fee3153895404941b4363cb7086f5efe55e9ae9931913395)\nDuring import, the package exfiltrates sensitive data (env variables, credential files, shell history, cryptocurrency wallet data etc.). It appears to be targeting users of kpk.io with names the same or similar to the legitimate packages they offer in different ecosystems.\n\n\n---\n\nCategory: MALICIOUS - The campaign has clearly malicious intent, like infostealers.\n\n\nCampaign: 2026-07-roles-royce\n\n\nReasons (based on the campaign):\n\n\n - dependency-confusion\n\n\n - targetted-attack\n\n\n - exfiltration-credentials\n\n\n - exfiltration-env-variables\n\n\n - exfiltration-cloud-tokens\n\n\n - exfiltration-ssh-keys\n\n\n - exfiltration-crypto\n","modified":"2026-07-28T14:37:29.241251905Z","published":"2026-07-24T09:21:35Z","database_specific":{"iocs":{"urls":["http://185.158.107.189:8877","http://151.247.22.13:8877"],"ips":["185.158.107.189","151.247.22.13"]},"malicious-packages-origins":[{"import_time":"2026-07-24T10:20:25.477117413Z","id":"pypi/2026-07-roles-royce/karpatkey","modified_time":"2026-07-24T09:21:35.399632Z","versions":["2.1.1"],"source":"kam193","sha256":"ea7a30728a3c4f46fee3153895404941b4363cb7086f5efe55e9ae9931913395"},{"modified_time":"2026-07-28T13:39:00Z","versions":["2.1.1"],"source":"amazon-inspector","sha256":"b434ae7cf6afb9ce18a54757c03069983e404db695d959bd29aa628864b8349c","import_time":"2026-07-28T14:20:00.048984173Z","id":"IN-MAL-2026-010937"}]},"references":[{"type":"WEB","url":"https://bad-packages.kam193.eu/pypi/package/karpatkey"},{"type":"PACKAGE","url":"https://pypi.org/project/karpatkey/2.1.1/"}],"affected":[{"package":{"name":"karpatkey","ecosystem":"PyPI","purl":"pkg:pypi/karpatkey"},"versions":["2.1.1"],"database_specific":{"cwes":[{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"}],"indicators":{"evidence_files":[{"path":"karpatkey/_compat.py","sha256":"32beb863d627fd21d58524396e9bad7eec090cbc96a396791f2ad96d36b7e68f","tlsh":"1a716677e85d0c638353d61dd45b9070372a3f9f2542182e76cc6b980f5c8bc5276b99"}],"package_integrity":[{"hashes":{"blake2b_256":"3961a08ecc4d705de4bc63ceacca9819408249187a456172b59c567886fe536c","md5":"b5f2f1ae551a1f672abdf27f6da11f8f","sha256":"6c2458a1001830aab246c0104a4740c0aa1ddce00d039d5f15a7f5f82505247e"},"filename":"karpatkey-2.1.1-py3-none-any.whl"},{"hashes":{"sha256":"1fcea1117e4d400395301d2499a252e402a3244dfab39c3b1d47142b754866c7","blake2b_256":"0b646722df81b8ba901367ccff7a5a812c6e54046a5e3f8d86794011655e54a8","md5":"569ea5a007b4f88ca1c5eccc8074ddf9"},"filename":"karpatkey-2.1.1.tar.gz"}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/pypi/karpatkey/MAL-2026-11047.json"}}],"schema_version":"1.7.5","credits":[{"name":"Amazon Inspector","contact":["inspector-research@amazon.com"],"type":"FINDER"},{"name":"Kamil Mańkowski (kam193)","contact":["https://github.com/kam193","https://bad-packages.kam193.eu/"],"type":"REPORTER"}]}