Coder Social home page Coder Social logo

es3n1n / obfuscator Goto Github PK

View Code? Open in Web Editor NEW
448.0 14.0 44.0 306 KB

PE bin2bin obfuscator

Home Page: https://blog.es3n1n.eu/posts/obfuscator-pt-1

License: GNU General Public License v3.0

Python 1.61% C++ 98.37% Shell 0.02%
bin2bin cpp cpp23 obfuscation obfuscator reverse-engineering windows

obfuscator's Introduction

Obfuscator

A native code obfuscator written in c++23.

Available transforms:

  • Bogus Control Flow
  • Constant Crypt
  • Decompilation breaker (ida, ghidra)
  • Substitution

Usage

Available options:
    -h, --help                   -- This message
    -pdb         [path]          -- Set custom .pdb file location
    -map         [path]          -- Set custom .map file location
    -f           [name]          -- Start new function configuration
    -t           [name]          -- Start new transform configuration
    -g           [name]          -- Start new transform global configuration
    -v           [name] [value]  -- Push value
 
Examples:
    obfuscator hehe.exe -f main -t TransformName -v SomeName 1337
    obfuscator hehe.exe -f main -t TransformName -v SomeName 1337 -g TransformName -v SomeGlobalName 1337
    obfuscator hehe.exe -f main -t TransformName -v SomeName 1337 -v SomeName0 1337 -g TransformName -v SomeGlobalName 1337
    obfuscator hehe.exe -map mymap.map -pdb mypdb.pdb -f main -t TransformName -v SomeName 1337 -v SomeName0 1337 -g TransformName -v SomeGlobalName 1337

Writeup


Building

This project is designed to be used on both Linux and Windows, and on any architecture. Although you may need to update your compiler/libc++ to the latest version, as we're using some fancy C++23 features.

cmake -B build -DOBFUSCATOR_BUILD_TESTS=0
cmake --build build --config Release

If you are using Visual Studio on Windows, you can generate the sln project using the first command and build the project using the generated .sln file.

Contributing

Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Bug reporting

Before reporting any bugs that could be related to code generation, please ensure that you attach the random seed used by the obfuscator. You can obtain this seed from the obfuscator logs; it is printed as the first message and looks like this:

12:11:30.150 | [  info  ] random: seed is 0xcb91ccbef7cbcdc1

Special thanks

License

GPL-3.0

obfuscator's People

Contributors

es3n1n avatar unvociferously avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

obfuscator's Issues

What is the enviroment&version of build tool-chain?

I have tried clang17/libc++abi-17-dev on kali but failed on linker (looks like some symbols couldn't found in libc++, compiled 100% )
Then I tried other llvm docker but also failed .
If would be helpful to provide some version information as c++23 is not stably supported

Does nothing

Command I've used to perform:

"C:\Users\geork\Documents\Github\obfuscator\build\src\RelWithDebInfo\obfuscator.exe" C:\Users\geork\Documents\Github\obfox\test_app\AppKey\x64\Debug\AppKey.exe -pdb C:\Users\geork\Documents\Github\obfox\test_app\AppKey\x64\Debug\AppKey.pdb -f main -t ConstantCrypt -t BogusControlFlow -t DecompBreak -t Substitution -v SomeValue0 133

AppKey source code:

#include <stdio.h>
#include <string.h>


#define PASS "key01234"
#define BUFF_SIZE 0xFF

int main(void) {
	printf("Enter key: ");
	char key[BUFF_SIZE];

	fgets(key, BUFF_SIZE, stdin);
	key[sizeof(PASS) - 1] = '\0';

	if (strcmp(key, PASS) == 0) {
		printf("Correct key!\n");
	} else {
		printf("Incorrect key!\n");
	}

	getchar();
	return 0;
}

I've tried both Release and Release with debug info versions of obfuscator. Both do nothing, guess it because of exception:

image

Console output:

image

If I remove all of the transforms I want to apply to program and leave only, for example, ConstantCrypt still doesn't work.

runtime error: parsed 0 functions

PS C:\Users\user\Desktop\obfuscator> C:\Users\user\Desktop\obfuscator\build\src\Release\obfuscator.exe ..\test.exe
09:45:08.662 | [  info  ] random: seed is 0x87ee46b82834fc34
09:45:08.666 | [  info  ] main: loading binary from ..\test.exe
09:45:08.696 | [ debug  ] pe: parsed 15 sections
09:45:08.700 | [ debug  ] pe: parsed total number of 29309 relocations
09:45:08.701 | [  info  ] func_parser: discovering functions: 0%
09:45:08.702 | [  info  ] func_parser: discovering functions: 25%
09:45:08.703 | [  info  ] func_parser: discovering functions: 50%
09:45:08.705 | [  info  ] func_parser: discovering functions: 75%
09:45:08.708 | [  info  ] func_parser: discovering functions: 100% took 7 ms
09:45:08.712 | [critical] RUNTIME ERROR: parser: Parsed 0 functions in total

text.exe is a golang binary, I also tried a c binary and same issue. Any idea how to fix the issue?

RUNTIME ERROR: obfuscator: got 0 functions to protect

13:10:14.962 | [ info ] random: seed is 0x5904f32cf6a0ce77
13:10:14.964 | [ info ] main: loading binary from test.exe
13:10:14.968 | [ debug ] pe: parsed 6 sections
13:10:14.969 | [ debug ] pe: parsed total number of 232 relocations
13:10:14.970 | [ info ] func_parser: discovering functions: 0%
13:10:15.026 | [ debug ] pdb: Parsed 38 types of DBI symbols
13:10:15.058 | [ info ] func_parser: discovering functions: 25%
13:10:15.058 | [ info ] func_parser: discovering functions: 50%
13:10:15.062 | [ info ] func_parser: discovering functions: 75%
13:10:15.066 | [ info ] func_parser: discovering functions: 100% took 96 ms
13:10:15.068 | [ debug ] func_parser: discovered 3089 functions
13:10:15.069 | [ info ] obfuscator: setting up functions: 9223372036854775808% took 13 microseconds
13:10:15.070 | [ info ] obfuscator: got 0 function(s) to obfuscate
13:10:15.075 | [critical] RUNTIME ERROR: obfuscator: got 0 functions to protect

It gives me this error for every .exe that I try

Feedback

This topic is truly fascinating and, unfortunately, there isn't much about it on the internet. It would be interesting if, in the future, we could see some basic content regarding bin2bin code virtualization. ๐Ÿ˜Š

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.