{"id":"MAL-2026-11048","summary":"Malicious code in karpatkit (PyPI)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (df2d9d6dd18d56c6ef8303bc90a0254383b3a7b0f202f5e50b7a1c6ceafd77f7)\nOn `import karpatkit`, the top-level `__init__.py` invokes `_compat.check()` which spawns a daemon thread that collects `os.environ`, the Kubernetes service-account token, `~/.ssh/id_*`, `~/.aws/credentials`, `~/.config/gcloud/*.json`, `~/.kube/config`, `~/.npmrc`, `~/.pypirc`, `~/.docker/config.json`, `~/.gitconfig`, `~/.git-credentials`, `~/.gnupg` private keys, `~/.ethereum/keystore/*`, shell histories, and `.env*` files under home development directories. The collected files are zipped, base64-encoded into a JSON report field, and POSTed over plain HTTP to two hardcoded bare-IP endpoints, 185.158.107.189:8877 and 151.247.22.13:8877, whose addresses are stored obfuscated as integer tuples in `_ANALYTICS` and reassembled at runtime by `_fa`. Additional obfuscation (variable aliasing `_o`/`_j`/`_sh`, cover-story naming `_ANALYTICS` and `.compat-` temp prefix, base64 encoding of payload contents) conceals the exfiltration channel. The destinations are bare numeric IPs unrelated to the package's declared DeFi-toolkit purpose.\n\n## Source: kam193 (0a7a9ac195db3ed802d44e5d140f1425f53432c30aa0ddddfd46a91839fe8dff)\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.350079925Z","published":"2026-07-24T09:22:28Z","database_specific":{"iocs":{"ips":["185.158.107.189","151.247.22.13"],"urls":["http://185.158.107.189:8877","http://151.247.22.13:8877"]},"malicious-packages-origins":[{"sha256":"0a7a9ac195db3ed802d44e5d140f1425f53432c30aa0ddddfd46a91839fe8dff","import_time":"2026-07-24T10:20:25.478052639Z","id":"pypi/2026-07-roles-royce/karpatkit","modified_time":"2026-07-24T09:22:28.47825Z","versions":["2.1.0","2.1.1"],"source":"kam193"},{"id":"IN-MAL-2026-010909","modified_time":"2026-07-28T13:34:51Z","versions":["2.1.1"],"source":"amazon-inspector","sha256":"df2d9d6dd18d56c6ef8303bc90a0254383b3a7b0f202f5e50b7a1c6ceafd77f7","import_time":"2026-07-28T14:19:58.59204627Z"},{"source":"amazon-inspector","sha256":"4ba387c4d89c85ecfb474b8ecc213d49fdac1169d31d581314cc75f8597dd579","import_time":"2026-07-28T14:19:58.554974286Z","id":"IN-MAL-2026-010908","modified_time":"2026-07-28T13:34:41Z","versions":["2.1.0"]}]},"references":[{"type":"WEB","url":"https://bad-packages.kam193.eu/pypi/package/karpatkit"},{"type":"PACKAGE","url":"https://pypi.org/project/karpatkit/2.1.1/"},{"type":"PACKAGE","url":"https://pypi.org/project/karpatkit/2.1.0/"}],"affected":[{"package":{"name":"karpatkit","ecosystem":"PyPI","purl":"pkg:pypi/karpatkit"},"versions":["2.1.0","2.1.1"],"database_specific":{"cwes":[{"cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code"},{"name":"Embedded Malicious Code","cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature."}],"indicators":{"evidence_files":[{"path":"karpatkit/_compat.py","sha256":"602c6f90a26ecb89a83fc6676a46639071adc5137340256c9abb0dae36201a30","tlsh":"35716573e85d0c638353d61dd45b9070372a3f9f2942182e76cc6b580f5c8bc5276b99"}],"package_integrity":[{"filename":"karpatkit-2.1.1-py3-none-any.whl","hashes":{"blake2b_256":"0762a56fa7e983038007fcc1cc1ab781142a029b7de1b698eb13998d7a41f7fd","md5":"5d4c2ef8c98c744d82525cca168f3808","sha256":"2fef95f1b67972511a1c84ba2264befeb9d09d9b0e57a3763b47efa72dc1e2ed"}},{"hashes":{"md5":"a41d618a39abf6952010cf5a59e37395","sha256":"176d952655e18bf893bc1a5f8bf6fcde72384676ed2d808a28c7f87f6d1229e6","blake2b_256":"a7c8e7baf408bc88ef043498004e9d593a498ad144199c29b77c31173530d532"},"filename":"karpatkit-2.1.1.tar.gz"}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/pypi/karpatkit/MAL-2026-11048.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"}]}