There is a new, increasing trend in contacting candidates profiles, mainly developers, usually through LinkedIn, with the intention of infiltrating malware in their computers.
The more checks you meet, the more probable you’re of being contacted by a group doing this scam.
I’ve personally faced about ~9 attacks, 6 of them actually within the spam of two weeks, one of them in the same day of writing this post, lol.
The scam consists of presenting a good to outstanding job offer, intending to have you running the intended malicious code on your computer.
The (often) common patterns they all tend to exhibit are:
Most of the time that JS code will come obfuscated in some way, by de-obfuscating it, we can deduce that:
Search, gather and upload any relevant browser data: Session, cookies, and browser extensions’ data, most importantly, those that are Crypto-related.
Pack it up in a zip file and upload it to a web server.
Check if you got Python installed, then download an obfuscated Python script that will run more malicious code. According to some sources, that Python script is basically a persistent keylogger that will also upload your clipboard to a remote web server.
eval
to run it.In the ~9 times I’ve been attacked, the ‘C’ and ‘E’ have not been used, but could be as well.
In case the source code does not directly contain the malware, the attack vector always resolves to one of the following to deferring the malicious code execution:
It would be just the same as in NodeJS, but this scam could work for any code or program if done with ‘A’. And for dynamic importing and executing code (B,C,D) basically anything that has an interpreter and can load external dependencies.
‘E’ will always depend on the package manager you use.
Another variation is to download/write a .dll
in Windows, .so
in Unix-like systems, then using dynamic linking as well.
If you ever need to execute any script code that you cannot simply fully read by yourself and be sure exactly what’s doing, then always run it into a sandbox.
If you don’t have or know how to set up a proper sandbox, or you just suspect, it just not worth the risk.
For NodeJS, we might as well just use Deno.
Deno will by default ask permissions for:
./
).process.env
).You can disable eval
by passing down a v8 flag to Node or Deno:
--disallow-code-generation-from-strings
--v8-flags=--disallow-code-generation-from-strings
In case you use Bun, and attackers targets it (extremely improbable but possible), other vectors are: FFI
and Bun.Transpiler
.
Deno also have FFI
, but must be directly enabled, at the moment of writing this post AFAIK Bun does not have any option to disable/forbid neither.
You may also use socket.dev to check package security report for NPM, PyPI, Gems and Maven. Also, GitHub Advisories offers a similar service, in case you wonder for other package managers like C# .NET’s NuGet.
If it is take home test it should be small enough so you can just swap to Deno, if that’s no possible, then simply forget about it and report them.
To avoid NodeJS install scripts to be executed when installing packages.
npm install --ignore-scripts
pnpm install --ignore-scripts
yarn install --ignore-scripts
You may also install packages with socket.dev’s install, or also, deno install
which by default forbids scripts and unintended file & network access.
.env
and similar files, then sending the text over an unsuspicious HTTP call.