{"id":"MAL-2026-5318","summary":"Malicious code in langchain-core-mcp (PyPI)","details":"\n---\n_-= Per source details. Do not edit below this line.=-_\n\n## Source: amazon-inspector (bd42d83950d8d8fc559905eed104af38cd6c8aef683b96778f0b8d778dd6bd5a)\nPackage `langchain-core-mcp` impersonates the legitimate `langchain-core` publisher: METADATA sets Project-URL Repository to https://github.com/langchain-ai/langchain and reproduces the upstream README/description verbatim. On install, the package drops two.pth files at the site-packages root — `langchain_core-setup.pth` (notably using the legitimate package's name) and `langchain_core_mcp-setup.pth` — both of which Python auto-loads on every interpreter start. The.pth payload is obfuscated into a single line using single-letter aliases (`_O`, `_T`, `_u`, `_s`, `_b`, `_j`, `_z`,...) and wrapped in `exec('...')` to evade simple grep-based scanners. When executed, the code creates a sentinel at `/tmp/.bun_ran`, downloads the Bun runtime ZIP from `https://github.com/oven-sh/bun/releases/download/bun-v1.3.13/bun-{platform}-{arch}.zip` via `urllib.request.urlretrieve` to `/tmp/b/bun`, extracts and chmods +x, then spawns `bun run _index.js` in the background against the bundled 5.35 MB `langchain_core_mcp/_index.js` payload. The use of an alien JS runtime (Bun) to execute an opaque bundled payload bypasses Python-only inspection; auto-execution via.pth bypasses pip build isolation and fires on every Python interpreter launch on the installer's machine, not just on import of this package.\n\n## Source: kam193 (ccea64b925d1d7ce4f42ceaeeb77320244fd0c3714ed6c605428e90d42956f96)\nVersions 1.4.2, 1.4.3 were compromised.\n\n\nCompromised packages start an obfuscated infostealer. The infostealer is a heavily obfuscated JavaScript code executed using Bun runtime on Python startup. It collectes all kinds of sensitive data, including API keys, credentials to package repositories, cryptocurrency assets, password manager data. Infostealer actively queries online services to collect additional secrets as well as attempts to gain persistence and spread further by publishing infected packages using collected credentials. Data are exfiltrated likely using Github. The code seems to threaten to wipe the user's data if it detects invalid GitHub tokens. Cleanup should be done with caution.\n\nIt seems to be related to the recent Mini Shai Hulud campaign.\n\n\n---\n\nCategory: MALICIOUS - The campaign has clearly malicious intent, like infostealers.\n\n\nCampaign: 2026-06-compr-woodpecker\n\n\nReasons (based on the campaign):\n\n\n - compromised-package\n\n\n - exfiltration-env-variables\n\n\n - exfiltration-cloud-tokens\n\n\n - exfiltration-credentials\n\n\n - abuses-pth\n\n\n - obfuscation\n\n\n - infostealer\n\n\n - The package contains code to detect if it is running in a sandbox environment.\n\n\n - exfiltration-crypto\n\n\n - files-exfiltration\n\n\n - destructive-actions\n","modified":"2026-06-11T08:01:34.495640028Z","published":"2026-06-06T06:13:57Z","database_specific":{"malicious-packages-origins":[{"sha256":"ccea64b925d1d7ce4f42ceaeeb77320244fd0c3714ed6c605428e90d42956f96","id":"pypi/2026-06-compr-woodpecker/langchain-core-mcp","versions":["1.4.2","1.4.3"],"modified_time":"2026-06-06T06:13:57Z","source":"kam193","import_time":"2026-06-08T11:41:02.527543875Z"},{"sha256":"c3ddf8b245e4cd5c0030820746ec600528f74841c1b2143b9c287eb9ecd132fa","id":"pypi/2026-06-compr-woodpecker/langchain-core-mcp","versions":["1.4.2","1.4.3"],"modified_time":"2026-06-08T10:07:51Z","source":"kam193","import_time":"2026-06-08T19:19:19.182764479Z"},{"sha256":"0176ed5978bd6b152fb3e8b99fe973aa4e82af218340401089f3febebfa19ddf","source":"kam193","versions":["1.4.2","1.4.3"],"modified_time":"2026-06-08T10:07:51Z","id":"pypi/2026-06-compr-woodpecker/langchain-core-mcp","import_time":"2026-06-09T07:48:29.642054067Z"},{"sha256":"bd42d83950d8d8fc559905eed104af38cd6c8aef683b96778f0b8d778dd6bd5a","id":"IN-MAL-2026-005466","versions":["1.4.3"],"modified_time":"2026-06-11T04:44:31Z","source":"amazon-inspector","import_time":"2026-06-11T05:40:57.732145902Z"},{"sha256":"582996fb0cf299f73f174ff284c6486392265b1fe39d6be2880ac94877035aa0","id":"IN-MAL-2026-005636","versions":["1.4.2"],"modified_time":"2026-06-11T06:33:57Z","source":"amazon-inspector","import_time":"2026-06-11T07:49:35.268420128Z"}]},"references":[{"type":"WEB","url":"https://socket.dev/blog/shai-hulud-descends-to-hades-miasma-pypi-wave"},{"type":"WEB","url":"https://o3.security/blog/pypi-supply-chain-attack-pth-file-miasma"},{"type":"WEB","url":"https://bad-packages.kam193.eu/pypi/campaign/2026-06-compr-woodpecker"},{"type":"WEB","url":"https://socket.dev/blog/mini-shai-hulud-miasma-and-hades-worms-target-bioinformatics-and-mcp-developers-via-malicious"},{"type":"PACKAGE","url":"https://pypi.org/project/langchain-core-mcp/1.4.3/"},{"type":"PACKAGE","url":"https://pypi.org/project/langchain-core-mcp/1.4.2/"}],"affected":[{"package":{"name":"langchain-core-mcp","ecosystem":"PyPI","purl":"pkg:pypi/langchain-core-mcp"},"versions":["1.4.2","1.4.3"],"database_specific":{"source":"https://github.com/ossf/malicious-packages/blob/main/osv/malicious/pypi/langchain-core-mcp/MAL-2026-5318.json","cwes":[{"cweId":"CWE-506","name":"Embedded Malicious Code","description":"The product contains code that appears to be malicious in nature."},{"cweId":"CWE-506","name":"Embedded Malicious Code","description":"The product contains code that appears to be malicious in nature."}],"indicators":{"evidence_files":[{"sha256":"6506d31707a39949f89534bf9705bcf889f1ecae3dbc6f4ff88d67a8be3d01b2","tlsh":"8721015780038160da72d627cb2929f4278b0cbb4e538b1b8de8d9c172d0d1197b6b48","path":"langchain_core-setup.pth"},{"sha256":"0fcc111eace56547deabac87428119abc6744877924e49aa3f69d5ff4a3e275b","tlsh":"c291fff353c45ae44bc309cb92296688f633e578e989e4ed9f76402dc5115a2c23b4ed","path":"langchain_core_mcp-1.4.3.dist-info/METADATA"}],"package_integrity":[{"hashes":{"sha256":"8ba657716b25bfb74e7fc69afb8c5e4a76a177385ea1fa360d9df3fbf74fa60d","md5":"9d1bb4d2bc0874fe839f826bdf0956a6","blake2b_256":"51defc5e079bf959bc729044aa0bf8139e87567689d59ee9611ed2a5929ef77a"},"filename":"langchain_core_mcp-1.4.3-py3-none-any.whl"}]}}}],"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":"ANALYST"}]}