While DLL sideloading can be used for legitimate purposes, such as loading necessary libraries for a program to function, it can also be used for malicious purposes. Attackers can use DLL sideloading to execute arbitrary code on a target system, often by exploiting vulnerabilities in legitimate applications that are used to load DLLs.
To automate the DLL sideloading process and make it more effective, Chimera was created a tool that includes evasion methodologies to bypass EDR/AV products. This tool can automatically encrypt a shellcode via XOR with a random key and create template Images that can be imported into Visual Studio to create a malicious DLL.
Also, Dynamic Syscalls from SysWhispers3 is used and a modified assembly version to evade the pattern that the EDR search for, Random nop sleds are added and registers are moved. Furthermore, Early Bird Injection is also used to inject the shellcode in another process which the user can specify with Sandbox Evasion mechanisms like HardDisk check & if the process is being debugged. Finally Timing attack is placed in the loader which uses waitable timers to delay the execution of the shellcode.
This tool has been tested and shown to be effective at bypassing EDR/AV products and executing arbitrary code on a target system.
The updated version of Chimera Unleashed has demonstrated significant advancements in evading both static and dynamic analysis, particularly in the context of Microsoft 365's Endpoint Detection and Response (EDR) system. The tool's sideloading techniques, even when applied to well-known binaries like OneDrive, successfully eluded detection. However, it's noteworthy that while the sideloading aspect remained undetected, the Early Bird Injection process employed by the tool was identified by the EDR system. This highlights an area for further refinement in enhancing the tool's overall stealth capabilities.
Key Updates and Features:
- Reformatted Structure: The entire program has been restructured for enhanced development ease and future maintainability.
- Polymorphic Code Integration: Incorporation of polymorphic code, significantly enhancing evasion capabilities and making the tool more resilient against static analysis.
- SysWhispers 3 Integration: Transitioned from SysWhispers 2 to a modified version of SysWhispers 3. This update improves the tool's ability to evade pattern recognition mechanisms employed by EDR systems, using dynamic syscalls and modified assembly techniques.
- AES Encryption: Implemented AES encryption to secure shellcode, adding an additional layer of security and obfuscation.
- Early Bird Injection: The tool employs Early Bird Injection techniques, allowing for stealthier code execution within target processes.
- Module Stomping: Will be added in the future also you can implement your own code injection technique in the tool.
Chimera is written in python3 and there is no need to install any extra dependencies.
Chimera currently supports two DLL options either Microsoft teams or Microsoft OneDrive.
Someone can create userenv.dll which is a missing DLL from Microsoft Teams and insert it into the specific folder to
%USERPROFILE%/Appdata/local/Microsoft/Teams/current
For Microsoft OneDrive the script uses version DLL which is common because it's missing from the binary example onedriveupdater.exe
Chimera Unleashed uses argparser
for command-line argument parsing. The following arguments are available:
--raw
or-r
: Path to file containing shellcode. Required.--path
or-p
: Path to output the C template file. Required.--pname
or-n
: Name of process to inject shellcode into. Required.--dexports
or-d
: Specify which DLL Exports to use (either 'teams' or 'onedrive'). Required.--enc
or-e
: Specify preferred encryption (XOR / AES). Required.--inj
or-i
: Specify preferred injection technique (EB / MS). Required.--rshell
or-s
: [Optional] Replace shellcode variable name with a unique name. Default is 'encoded_shell'.--rxor
or-x
: [Optional] Replace xor encryption name with a unique name. Default is 'do_xor'.--rkey
or-k
: [Optional] Replace key variable name with a unique name. Default is 'key'.--rsleep
or-z
: [Optional] Total sleep time to include during execution (seconds). Default is 4000.--size
or-f
: [Optional] File size of junk data in KB. Zero (0) is disabled, and one (1) is random filesize. Default is 0.
Example usage: python Chimera.py --raw <path_to_shellcode> --path <output_path> --pname <process_name> --dexports <exports_file> --enc AES --inj EB --rshell my_shellcode
Once the compilation process is complete, a DLL will be generated, which should include either "version.dll" for OneDrive or "userenv.dll" for Microsoft Teams. Next, it is necessary to rename the original DLLs.
For instance, the original "userenv.dll" should be renamed as "tmpB0F7.dll," while the original "version.dll" should be renamed as "tmp44BC.dll." Additionally, you have the option to modify the name of the proxy DLL as desired by altering the source code of the DLL exports instead of using the default script names.
code.h file contains the shellcode.
Step 1: Creating a New Visual Studio Project with DLL Template
- Launch Visual Studio and click on "Create a new project" or go to "File" -> "New" -> "Project."
- In the project templates window, select "Visual C++" from the left-hand side.
- Choose "Empty Project" from the available templates.
- Provide a suitable name and location for the project, then click "OK."
- On the project properties window, navigate to "Configuration Properties" -> "General" and set the "Configuration Type" to "Dynamic Library (.dll)."
- Configure other project settings as desired and save the project.
Step 2: Importing Files into the Visual Studio Project
- Locate the "chimera_automation" folder containing the necessary Images.
- Open the folder and identify the following files: main.c, syscalls.c, syscallsstubs.std.x64.asm.
- In Visual Studio, right-click on the project in the "Solution Explorer" panel and select "Add" -> "Existing Item."
- Browse to the location of each file (main.c, syscalls.c, syscallsstubs.std.x64.asm) and select them one by one. Click "Add" to import them into the project.
- Create a folder named "header_files" within the project directory if it doesn't exist already.
- Locate the "syscalls_mem.h" header file in the "header_files" folder of the "chimera_automation" directory.
- Right-click on the "header_files" folder in Visual Studio's "Solution Explorer" panel and select "Add" -> "Existing Item."
- Browse to the location of "syscalls_mem.h" and select it. Click "Add" to import it into the project.
Step 3: Build Customization
- In the project properties window, navigate to "Configuration Properties" -> "Build Customizations."
- Click the "Build Customizations" button to open the build customization dialog.
Step 4: Enable MASM
- In the build customization dialog, check the box next to "masm" to enable it.
- Click "OK" to close the build customization dialog.
Step 5:
- Right-click in the assembly file → properties and choose the following
- Exclude from build → No
- Content → Yes
- Item type → Microsoft Macro Assembler
Step 1: Change optimization
- In Visual Studio choose Project → properties
- C/C++ Optimization and change to the following
Step 2: Remove Debug Information
- In Visual Studio choose Project → properties
- Linker → Debugging → Generate Debug Info → No
Original Contributor:
- George Sotiriadis
- Initial release and concept.
- Code refactoring in the updated version.
- Modified SysWhispers3 in the updated version.
Contributor:
- Efstratios Chatzoglou
- Added polymorphic code, obfuscator, and AES encryption in the updated version.
- Assisted in code refactoring and further development.
To the maximum extent permitted by applicable law, myself(George Sotiriadis) and/or affiliates who have submitted content to my repo, shall not be liable for any indirect, incidental, special, consequential or punitive damages, or any loss of profits or revenue, whether incurred directly or indirectly, or any loss of data, use, goodwill, or other intangible losses, resulting from (i) your access to this resource and/or inability to access this resource; (ii) any conduct or content of any third party referenced by this resource, including without limitation, any defamatory, offensive or illegal conduct or other users or third parties; (iii) any content obtained from this resource
https://evasions.checkpoint.com/
https://github.com/Flangvik/SharpDllProxy