I've had several readers ask me about The recently, so I decided to write a comprehensive article about it.
Found this helpful? Share it with your team and leave a comment below!
正文
The Secret Guide To Virtualization Obfuscation In JavaScript
Well, now that I posted it, it’s not really a secret anymore. But you might enjoy it anyways.
In this blog post, I am going to introduce you to the basics of virtualization obfuscation in JS and how to design an instruction-set to make it all work. This post is inspired by
where I built a compiler and VM for virtualization obfuscation.
Virtualization obfuscation is a state-of-the-art obfuscation scheme. It obfuscates the code by compiling it into bytecode which is then executed by a virtual machine (VM). Thus, the VM gets distributed along with the compiled bytecode. It is then called with this bytecode and executes it and is thereby executing the actual code.
A showcase on how to deploy virtualization obfuscation
Since the bytecode is executed instruction by instruction, the original code is never restored anywhere. So, any potential attacker must first reverse engineer the VM, which may be heavily obfuscated. One must then understand the underlying architecture and instruction-set before being able to analyze the actual bytecode.
Since any two virtualization obfuscations are potentially different, the use of automated tools is limited.
Before building either VM or bytecode, you must think about how both are designed. There are many different architectures. Get inspired by them or, even better, come up with something new and exotic.
You want people to NOT understand it. So, make it complicated and nasty.
An example how Rusty-JSYC’s disassembled bytecode looks like
is based on registers and a text/data-segment which is the bytecode itself. This segment is a sequence of operations.
Instruction: one-byte operation code (op code), i.e.:
Operands represent strings, numbers, arrays or registers Building a virtual machine
This sounds a lot more horrifying than it actually is. Trust me.
More Details
There are a few more points worth noting. First, browser compatibility varies across different browsers. Second, performance optimization is crucial when handling large amounts of data. Finally, key management is also an important consideration.
This article was first published on JSVMP Blog. Reposting with attribution is welcome.
Reference: The Secret Guide To Virtualization Obfuscation In JavaScript | Johannes Willbold