All Projects → jacob-baines → jit_obfuscation_poc

jacob-baines / jit_obfuscation_poc

Licence: BSD-3-Clause license
Using GNU lightning to generate xor deobfuscation at runtime

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to jit obfuscation poc

react-obfuscate
An intelligent React component to obfuscate any contact link!
Stars: ✭ 87 (+278.26%)
Mutual labels:  obfuscation
silencio
Silencio is a Java library for transforming and converting XML, JSON, YAML, Properties and other formats. It is applicable for most operations such as obfuscation, encryption, minimisation (minifying), anonymous. Library is fully customizable and extensible.
Stars: ✭ 23 (+0%)
Mutual labels:  obfuscation
id-mask
IDMask is a Java library for masking internal ids (e.g. from your DB) when they need to be published to hide their actual value and to prevent forging. It has support optional randomisation has a wide support for various Java types including long, UUID and BigInteger. This library bases its security on strong cryptographic primitives.
Stars: ✭ 39 (+69.57%)
Mutual labels:  obfuscation
nand nor
C++ Compile time NAND/NOR obfuscation
Stars: ✭ 32 (+39.13%)
Mutual labels:  obfuscation
Powershell-Obfuscator
Powerful script for logical obfuscation of powershell scripts
Stars: ✭ 27 (+17.39%)
Mutual labels:  obfuscation
ConfuserExPlugins
Transforms all types to generics, and all constructor calls and method calls into generic call factories.
Stars: ✭ 32 (+39.13%)
Mutual labels:  obfuscation
dumb-obfuscator
Tutorial on how to write the dumbest obfuscator I could think of.
Stars: ✭ 147 (+539.13%)
Mutual labels:  obfuscation
dark-lord-obama
AV-evading Pythonic Reverse Shell with Dynamic Adaption Capabilities
Stars: ✭ 61 (+165.22%)
Mutual labels:  obfuscation
rusty-jsyc
JavaScript-To-Bytecode compiler written in Rust
Stars: ✭ 109 (+373.91%)
Mutual labels:  obfuscation
email-concealer
Conceal e-mail addresses in a string by replacing their domain
Stars: ✭ 47 (+104.35%)
Mutual labels:  obfuscation
chameleon
PowerShell Script Obfuscator
Stars: ✭ 319 (+1286.96%)
Mutual labels:  obfuscation
LLVM-Obfuscator
LLVM Obfuscator
Stars: ✭ 44 (+91.3%)
Mutual labels:  obfuscation
js-confuser
JS-Confuser is a JavaScript obfuscation tool to make your programs *impossible* to read.
Stars: ✭ 38 (+65.22%)
Mutual labels:  obfuscation
VisualBasicObfuscator
Visual Basic Code universal Obfuscator intended to be used during penetration testing assignments.
Stars: ✭ 115 (+400%)
Mutual labels:  obfuscation
Deobfuscation
Binary Deobfuscation Series
Stars: ✭ 15 (-34.78%)
Mutual labels:  obfuscation
folm
Folm
Stars: ✭ 16 (-30.43%)
Mutual labels:  obfuscation
Alom
Alom PHP Obfuscator / Encoder can protect from your codes
Stars: ✭ 50 (+117.39%)
Mutual labels:  obfuscation
data obfuscation
Data Obfuscation for C/C++ Code Based on Residue Number Coding (RNC)
Stars: ✭ 15 (-34.78%)
Mutual labels:  obfuscation
defendjs
A free and open source JavaScript and Node.js obfuscator.
Stars: ✭ 26 (+13.04%)
Mutual labels:  obfuscation
Discord-AIO
Discord AIO (All In One) - discord stealer/token grabber builder with token checks, webhook spammer, obfuscation, encryption, crypto miner, RAT and a lot of extra features.
Stars: ✭ 105 (+356.52%)
Mutual labels:  obfuscation

JIT Obfuscation Proof of Concept

In my adventures I came across GNU lightning. Lightning generates assembly at runtime and is great for implementing a just-in-time compiler. A really neat example is this Brainfuck JIT compiler by Erik Dubbelboer.

I thought that was pretty neat and wanted to play with lightning a little. However, I didn't want to code up my own fullblown VM. That would require some serious effort and I'm not that interested. So I wrote this little toy that xor deobfuscates a function in memory using lightning. The the bindshell is the same one I used in my Anti-Reversing Techniques book. You can see more here.

If you don't want to compile the project yourself then you can find it on VirusTotal:

https://www.virustotal.com/#/file/1c149f2f467e0e178bb819e3a862de016239db9e4116402d11aa5030b20a54c2/detection

Dependencies

The code was written and tested on Ubuntu 16.04 x64. I can't promise it works anywhere else. Furthermore, the project depends on:

  1. musl
  2. cmake
  3. lightning

You can install musl and cmake the following command

sudo apt-get install cmake musl-dev musl-tools

There is no package for lightning so you'll have to download and compile it yourself.

Compiling

To compile create a build directory, run cmake, and the type make. For example:

albinolobster@ubuntu:~/jit_obfuscation$ cd build/
albinolobster@ubuntu:~/jit_obfuscation/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/albinolobster/jit_obfuscation/build
albinolobster@ubuntu:~/jit_obfuscation/build$ make
Scanning dependencies of target stripBinary
[ 16%] Building CXX object stripBinary/CMakeFiles/stripBinary.dir/src/stripBinary.cpp.o
[ 33%] Linking CXX executable stripBinary
[ 33%] Built target stripBinary
Scanning dependencies of target xorFunction
[ 50%] Building CXX object xorFunction/CMakeFiles/xorFunction.dir/src/xorFunction.cpp.o
[ 66%] Linking CXX executable xorFunction
[ 66%] Built target xorFunction
Scanning dependencies of target addLDS
[ 66%] Built target addLDS
Scanning dependencies of target trouble
[ 83%] Building C object trouble/CMakeFiles/trouble.dir/src/trouble.c.o
[100%] Linking C executable trouble
The bind shell password is: rsMzp7gqOME8J5KOAVeDnmNUQb4z7pKU
[ 99%] Bind shell function obfuscated!
[100%] Built target trouble
albinolobster@ubuntu:~/jit_obfuscation/build$ 

Executing the program

Simply run the "trouble" binary like so:

albinolobster@ubuntu:~/jit_obfuscation/build$ ./trouble/trouble

This will cause the program to begin listening on port 1270.

Connecting to the bind shell

You'll need the bind shell password in order to successfully connect. The password is output when you compile the program. In the output above the bind shell password is "rsMzp7gqOME8J5KOAVeDnmNUQb4z7pKU". Here is an example of connecting to the bindshell:

albinolobster@ubuntu:~$ nc 127.0.0.1 1270
rsMzp7gqOME8J5KOAVeDnmNUQb4z7pKU
pwd
/home/albinolobster/jit_obfuscation/build
ls -l
total 40
-rw-rw-r-- 1 albinolobster albinolobster 12151 Aug 22 05:35 CMakeCache.txt
drwxrwxr-x 4 albinolobster albinolobster  4096 Aug 22 05:35 CMakeFiles
-rw-rw-r-- 1 albinolobster albinolobster  5499 Aug 22 05:35 Makefile
-rw-rw-r-- 1 albinolobster albinolobster  1711 Aug 22 05:35 cmake_install.cmake
drwxrwxr-x 3 albinolobster albinolobster  4096 Aug 22 05:35 stripBinary
drwxrwxr-x 3 albinolobster albinolobster  4096 Aug 22 05:35 trouble
drwxrwxr-x 3 albinolobster albinolobster  4096 Aug 22 05:35 xorFunction
exit
albinolobster@ubuntu:~$

License

BSD-3-Clause

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].