How oni-kuki/rc-obfuscator works
Project Overview
• Purpose: To obfuscate binary shellcode by injecting it into resource files (ICO or Bitmap) and subsequently loading the payload using the ntmapViewOfSection technique.
• Modes: There are two primary modes – one for ICO conversion and one for Bitmap injection. Both methods include a “service” variant to manage payload run/start/stop using the Windows service interface.
Main Components
a. Shellcode Payload Input:
• The project expects a binary shellcode file as the initial input.
b. ICO Processing Module:
• Conversion of binary data into an ICO file:
• Core Files: Ico/Ico/Ico.cpp and supporting header (Ico/Ico/Native.h)
• Conversion Helper: Ico/Iconvert.cpp
• Service Variant:
• Service Files: Ico/Service/IcoServ.cpp and Ico/Service/Native.h
c. Bitmap Processing Module:
• Bitmap Generation and Injection:
• Bitmap Creation: Bitmap/CreateBitmap.cpp
• Injection: Bitmap/BitmapInsert/BitmapInsert.cpp (to inject the payload into an existing or newly created bitmap)
• Resource Loader: Bitmap/Bitmap/BMP.cpp and Bitmap/Bitmap/Native.h
• Service Variant:
• Service Files: Bitmap/Service/BMPServ.cpp and Bitmap/Service/Native.h
d. Resource Loader Technique:
• Both methods rely on the ntmapViewOfSection technique to load the payload-embedded files.
e. External Assets and Documentation:
• Assets for demonstration (e.g., Images folder) and a README hosting usage examples and visual guides.
f. Operating System Service Interaction:
• The usage examples in the README (using sc create, sc start) indicate an integration with Windows service control.
Relationships and Interactions
• For both ICO and Bitmap modules, the flow starts with the shellcode file. From here:
• In the ICO flow, the payload is converted (using Iconvert or Ico.cpp), and there’s an option to manage it as a service via Ico/Service.
• In the Bitmap flow, the process first creates a Bitmap (via CreateBitmap), then injects the payload (via BitmapInsert), with an optional service layer provided in Bitmap/Service.
• Both flows eventually lead to loading the obfuscated resource with the ntmapViewOfSection method.
Architectural Patterns and Design Principles
• Modularity: The design naturally splits into two separate modules (ICO and Bitmap) that do not interfere with one another.
• Service Orientation: Both methods offer a service-based interface to manage execution.
• Clear Separation of Concerns: Resource file creation/injection and loading mechanisms are handled in different parts of the codebase.
• Reusability: The conversion/injection components are reusable in both standalone and service-oriented contexts.