All Projects → d35ha → Callobfuscator

d35ha / Callobfuscator

Obfuscate specific windows apis with different apis

Projects that are alternatives of or similar to Callobfuscator

Freki
🐺 Malware analysis platform
Stars: ✭ 285 (-43.56%)
Mutual labels:  malware-research
Stoq
An open source framework for enterprise level automated analysis.
Stars: ✭ 352 (-30.3%)
Mutual labels:  malware-research
Threatingestor
Extract and aggregate threat intelligence.
Stars: ✭ 439 (-13.07%)
Mutual labels:  malware-research
Phishing.database
Phishing Domains, urls websites and threats database. We use the PyFunceble testing tool to validate the status of all known Phishing domains and provide stats to reveal how many unique domains used for Phishing are still active.
Stars: ✭ 296 (-41.39%)
Mutual labels:  malware-research
Winappdbg
WinAppDbg Debugger
Stars: ✭ 338 (-33.07%)
Mutual labels:  malware-research
Simplify
Android virtual machine and deobfuscator
Stars: ✭ 3,865 (+665.35%)
Mutual labels:  malware-research
freki
🐺 Malware analysis platform
Stars: ✭ 327 (-35.25%)
Mutual labels:  malware-research
Malwaresourcecode
Collection of malware source code for a variety of platforms in an array of different programming languages.
Stars: ✭ 8,666 (+1616.04%)
Mutual labels:  malware-research
Malware Jail
Sandbox for semi-automatic Javascript malware analysis, deobfuscation and payload extraction. Written for Node.js
Stars: ✭ 349 (-30.89%)
Mutual labels:  malware-research
Pev
The PE file analysis toolkit
Stars: ✭ 422 (-16.44%)
Mutual labels:  malware-research
Python Iocextract
Defanged Indicator of Compromise (IOC) Extractor.
Stars: ✭ 300 (-40.59%)
Mutual labels:  malware-research
Coldfire
Golang malware development framework
Stars: ✭ 309 (-38.81%)
Mutual labels:  malware-research
Drakvuf Sandbox
DRAKVUF Sandbox - automated hypervisor-level malware analysis system
Stars: ✭ 384 (-23.96%)
Mutual labels:  malware-research
Vxug Papers
Research code & papers from members of vx-underground.
Stars: ✭ 291 (-42.38%)
Mutual labels:  malware-research
Wdbgark
WinDBG Anti-RootKit Extension
Stars: ✭ 450 (-10.89%)
Mutual labels:  malware-research
Malware Research
Code written as part of our various malware investigations
Stars: ✭ 281 (-44.36%)
Mutual labels:  malware-research
Javascript Malware Collection
Collection of almost 40.000 javascript malware samples
Stars: ✭ 367 (-27.33%)
Mutual labels:  malware-research
Multiscanner
Modular file scanning/analysis framework
Stars: ✭ 494 (-2.18%)
Mutual labels:  malware-research
Linux.mirai
Leaked Linux.Mirai Source Code for Research/IoC Development Purposes
Stars: ✭ 466 (-7.72%)
Mutual labels:  malware-research
Dex Oracle
A pattern based Dalvik deobfuscator which uses limited execution to improve semantic analysis
Stars: ✭ 398 (-21.19%)
Mutual labels:  malware-research

CallObfuscator

Obfuscate (hide) the PE imports from static/dynamic analysis tools.

Theory

This's pretty forward, let's say I've used VirtualProtect and I want to obfuscate it with Sleep, the tool will manipulate the IAT so that the thunk that points to VirtualProtect will point instead to Sleep, now at executing the file, windows loader will load Sleep instead of VirtualProtect, and moves the execution to the entry point, from there the execution will be redirected to the shellcode, the tool put before, to find the address of VirtualProtect and use it to replace the address of Sleep which assigned before by the loader.

How to use

  • It can be included directly as a library, see the following snippet (based on the example), also you can take a look at cli.cpp.
#include <cobf.hpp>

int main() {
	cobf obf_file = cobf("sample.exe");
	obf_file.load_pe();
	obf_file.obf_sym("kernel32.dll", "SetLastError", "Beep");
	obf_file.obf_sym("kernel32.dll", "GetLastError", "GetACP");
	obf_file.generate("sample_obfuscated.exe");
	obf_file.unload_pe();
	return 0;
};
  • Also can be used as a command line tool by supplying it with the input PE path, the output PE path and optionally the path to the configuration file (default is config.ini). cobf.exe <input file> <out file> [config file] The config file contains the obfuscations needed (dlls, symbols, ...). Here is a template for the config file content
; Template for the config file:
; 	* Sections can be written as:
; 		[dll_name]
; 		old_sym=new_sym
;	* The dll name is case insensitive, but 
;	the old and the new symbols are not.
; 	* You can use the wildcard on both the
; 	dll name and the old symbol.
; 	* You can use '#' at the start of
; 	the old or the new symbol to flag 
; 	an ordinal.
;	* The new symbol should be exported
;	by the dll so the windows loader can resolve it.
; For example:
; 	* Obfuscating all of the symbols
;	imported from user32.dll with ordinal 1600.
[user32.dll]
*=#1600
;	* Obfuscating symbols imported from both
;	kernel32.dll and kernelbase.dll with Sleep.
[kernel*.dll]
*=Sleep
;	* Obfuscating fprintf with exit.
[*]
fprintf=exit

Example

Build this code sample

#include <windows.h>
#include <stdio.h>

int main() {
	SetLastError(5);
	printf("Last error is %d\n", GetLastError());
	return 0;
};

After building it, this is how the kernel32 imports look like

pic1

Now let's obfuscate both SetLastError and GetLastError with Beep and GetACP (actually any api from kernel32 will be ok even if it's not imported at all). The used configurations are

[kernel32.dll]
SetLastError=Beep
GetLastError=GetACP

Here is the output (also you can use the library directly as shown above).

pic2

Again let's have a look on the kernel32 imports

pic3

There's no existence of SetLastError or GetLastError A confirmation that two files will work properly

pic4

Impact

IDA HexRays Decompiler

pic5

IDA Debugger

pic6

Ghidra

pic7

ApiMonitor

pic8

That's because all of the static analysis tool depend on what is the api name written at IAT which can be manipulated as shown. For ApiMonitor, because of using IAT hooking, the same problem exists.

On the other side, for tools like x64dbg the shown api names will only depend on what is actually called (not what written at the IAT).

pic9

Additional

  • Dumping the obfuscated PE out from memory won't deobfuscate it, because the manipulated IAT will be the same.
  • The main purpose for this tool is to mess up with the analysis process (make it slower).
  • One can obfuscate any imported symbol (by name or by ordinal) with another symbol (name or ordinal).
  • The shellcode is executed as the first tls callback to process the obfuscated symbols needed by the other tls callbacks before the entry point is executed.
  • The shellcode is shipped as c code, generated when the tool is compiled to facilitate editing it.
  • The obfuscated symbols names are being resolved by hash not by name directly.
  • The tool disables the relocations and strips any of the debug symbols.
  • The tool creates a new rwx section named .cobf for holding the shellcode and the other needed datas.
  • It can be used multiple times on the same obfuscated PE.
  • Tested only on Windows 10 x64.
  • Get source with git clone https://github.com/d35ha/CallObfuscator.
  • Download binaries from the Release Section.

TODO

  • Shellcode obfuscation (probably with obfusion).
  • Support the delay-loaded symbols.
  • Minimize the created section size.
  • Compile time hashing.
  • Better testing.
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].