
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
js-virtualizer
Advanced tools
virtualization-based obfuscation for javascript
js-virtualizer is a proof-of-concept project which brings virtualization-based obfuscation to javascript. In this implementation, bytecode is fed to a virtual machine implemented javascript which runs on its own instruction set. A transpiler is included to convert individual functions to opcodes for the VM. It is important to note that js-virtualizer is not intended for use on entire programs, but rather for individual functions! There will be a significant performance hit if you try to run an entire program through the VM.
[!WARNING]
You need to mark the functions you want to virtualize by putting a comment with the text// @virtualizeabove the function.
// @virtualize
function virtualize() {
console.log("hello from the virtualized function");
}
function notVirtualized() {
console.log("this function will not be virtualized");
}
[!TIP] See examples/basic.js for a full example and the samples folder for some sample code you can try virtualizing.
const {transpile} = require("js-virtualizer");
async function main() {
const result = await transpile(`
// @virtualize
function virtualize() {
console.log("hello world from the JSVM");
}
virtualize()
`, {
// the filename of the code; will be used as the default output filename
fileName: 'example.js',
// whether or not the transpiler should directly write the output to a file
writeOutput: true,
// the path to write the vm for the transpiled code to
vmOutputPath: "./vm_output.js",
// the path to write the transpiled code to
transpiledOutputPath: "./output.js",
// the passes apply to the result before returning
passes: [
"RemoveUnused",
"ObfuscateVM",
"ObfuscateTranspiled"
]
});
console.log(`Virtualized code saved to: ${result.transpiledOutputPath}`);
}
main();
this context[!WARNING]
It is highly recommended that you modify and obfuscate the vm_dist.js file before using it in a production environment. For instance, including the opcode names in the VM makes it more trivial to reverse engineer the workings of the virtualized code
require statements and replacing them with the appropriate browser equivalents in vm_dist.jsvar is not supported. it is not guaranteed that the variable will behave as expected. you should use let or const insteadthis property to functionsFAQs
Virtualization-based obfuscation for JavaScript
We found that js-virtualizer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.