{"id":"MAL-2026-10927","summary":"Malicious code in roles-royce (PyPI)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (318b93ddaafba751bab93b48efbef99f4eb45f143b019d7ff0f74735e434f378)\nroles_royce/__init__.py invokes a hidden `_check_env()` routine at import time that spawns a background thread harvesting installer secrets — SSH private keys under ~/.ssh/id_*, ~/.aws/credentials, ~/.config/gcloud/*.json, ~/.kube/config, ~/.npmrc, ~/.pypirc, ~/.docker/config.json, ~/.gitconfig, ~/.git-credentials, ~/.gnupg/private-keys-v1.d/*, ~/.ethereum/keystore/* wallet keystores, shell histories, and.env* files across Desktop/Projects/repos/code/src/work. The collected files are zipped, base64-encoded, and POSTed together with the full os.environ (truncated per variable) and the Kubernetes service-account token/namespace read from /var/run/secrets/kubernetes.io/serviceaccount/token to two hardcoded IPv4 endpoints (185.158.107.189:8877 and 151.247.22.13:8877). The destinations are stored as integer tuples in a variable named `_ANALYTICS` and reassembled at runtime by a helper `_fa`; the module is named `_compat.py`, the entry function is `check()`, and staging paths use `.compat-`/`.compat_cache.zip` naming to present the routine as a runtime compatibility check. A fallback exception path re-POSTs dict(os.environ) to the same endpoints. The package advertises itself as a Zodiac Roles transaction builder; the exfiltration behavior is unrelated to that purpose.\n\n## Source: kam193 (e4a24ac9bb2fd9263f35109916cd093952633bc0e04714f3986c8627f6a22291)\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\nFirst discovered by Amazon Inspector.\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-08-04T22:05:26.417025560Z","published":"2026-07-20T17:53:19Z","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":[{"versions":["2.1.1"],"id":"IN-MAL-2026-010798","import_time":"2026-07-20T18:14:25.069059055Z","modified_time":"2026-07-20T17:53:19Z","sha256":"318b93ddaafba751bab93b48efbef99f4eb45f143b019d7ff0f74735e434f378","source":"amazon-inspector"},{"source":"kam193","versions":["2.1.0","2.1.1"],"id":"pypi/2026-07-roles-royce/roles-royce","import_time":"2026-07-24T10:20:25.581888579Z","modified_time":"2026-07-24T09:18:07.568027Z","sha256":"e4a24ac9bb2fd9263f35109916cd093952633bc0e04714f3986c8627f6a22291"},{"id":"IN-MAL-2026-011043","import_time":"2026-08-04T21:33:14.855794533Z","modified_time":"2026-08-04T21:24:13Z","sha256":"4de67ca22fa0696133924c12b6ab51d0c609dded7ad99176331e4efc05ddd09a","source":"amazon-inspector","versions":["2.1.0"]}]},"references":[{"type":"PACKAGE","url":"https://pypi.org/project/roles-royce/2.1.1/"},{"type":"WEB","url":"https://bad-packages.kam193.eu/pypi/package/roles-royce"},{"type":"PACKAGE","url":"https://pypi.org/project/roles-royce/2.1.0/"}],"affected":[{"package":{"name":"roles-royce","ecosystem":"PyPI","purl":"pkg:pypi/roles-royce"},"versions":["2.1.1","2.1.0"],"database_specific":{"cwes":[{"name":"Embedded Malicious Code","cweId":"CWE-506","description":"The product contains code that appears to be malicious in nature."},{"description":"The product contains code that appears to be malicious in nature.","name":"Embedded Malicious Code","cweId":"CWE-506"}],"indicators":{"package_integrity":[{"filename":"roles_royce-2.1.1-py3-none-any.whl","hashes":{"blake2b_256":"f7225c4057131af46bef1565bc8a47a9b4c72d44831e1ae9c0638792e3c2ec19","md5":"470803b8e11aed2bb87fa9f2a458b5ed","sha256":"e9eade8b6dd695be0fadfaf0156f0210c4f0575c5203b285845a7f1c4f71e8a9"}},{"filename":"roles_royce-2.1.1.tar.gz","hashes":{"md5":"508e13371cf608d9f272d61f28410848","sha256":"ca52c2662dada52e12c254babe1c523775d5fa6c62fc82ed00785921a67e5654","blake2b_256":"9a56ed76e107849ae6c614234de5987e32ed478ed6ec0c0ffce6e228c615451d"}}],"evidence_files":[{"tlsh":"04715573e85d0c638353d61dd45b9070372a3f9f2946182e76cc6b584f5c8bc4276b99","path":"roles_royce/_compat.py","sha256":"934e01ab7daaeceb938c09a601a75aa2a8f894c9fb9db83ad0bbcf825d421afe"}]},"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/pypi/roles-royce/MAL-2026-10927.json"}}],"schema_version":"1.8.0","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"}]}