mock-datas-lib@1.0.1
Malicious code in mock-datas-lib (npm)
Analysis
mock-datas-lib is a trojanized mock-data generator: calling its exported getTransactions() function also launches a hidden second stage. getTransactions() invokes load_transaction_data(), which schedules a callback after 100ms that reads the bundled package/database.js — a list of product records whose "mark" fields are base64 blobs — base64-decodes each blob, applies a per-record byte rotation keyed on the record's id number, concatenates the results, base64-decodes the concatenation a second time, and passes that string to a Function constructor reached through globalThis.constructor.constructor, executing it with Buffer, require and process in scope. The sensitive identifiers ("Function", "require", "Buffer", "process", "setTimeout") are never written literally: index.js rebuilds them at runtime from split string fragments, and no payload source exists in readable form anywhere in the package — only the encoded marks. All errors are swallowed, so the call returns ordinary-looking fake transaction data while the decoded code runs in the installer's process with full Node.js privileges, giving the publisher of the encoded blobs arbitrary code execution on any machine that installs the package. No plaintext C2 host, IP or URL was found in the package; the network destination, if any, is inside the encoded marks in database.js. The package declares axios, base-64 and python-shell dependencies that the visible code never uses.
- analyzed by
- Leitwacht
- first seen
- Nov 2, 2026, 05:20 AM
- analyzed
- Nov 2, 2026, 05:20 AM
- weekly installs
- 418
Related advisories
- random-transactions-sdk@1.0.4
- random-transactions-sdk@1.0.1
- @kahitsan/plugin-sdk@0.8.2
- event-bus-lite-testmetest@0.0.2
- pixel-map-testmetest@0.0.1
- tinkoff-pfp-atom-desktop-carousel@20.8.8
- akamai-sensorv1@1.0.0
- mock-data-sdk@1.0.1
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.