Protection Features
VxLang provides Code Obfuscation, Code Virtualization, Code Flattening, Runtime Code Encryption, and Packer & Protector to protect code and data in Windows executables.
This document first explains the SDK markers used to designate protected regions in C/C++ source code, then introduces the purpose and characteristics of each protection method. For detailed JSON settings, see Project Configuration (JSON).
1. SDK Protection Markers
1.1. Overview
The VxLang SDK provides BEGIN/END markers for designating regions of C/C++ code to protect. By placing markers around the intended code, VxLang can identify the corresponding region during protection.
The supplied vxlib.h declares the following markers:
| Protection method | Begin marker | End marker | Description |
|---|---|---|---|
| Code Obfuscation | VL_OBFUSCATION_BEGIN |
VL_OBFUSCATION_END |
General code obfuscation |
| Lite Obfuscation | VL_LITE_OBFUSCATION_BEGIN |
VL_LITE_OBFUSCATION_END |
Region for lightweight obfuscation |
| Code Flattening | VL_CODE_FLATTENING_BEGIN |
VL_CODE_FLATTENING_END |
Control-flow obfuscation |
| Code Virtualization | VL_VIRTUALIZATION_BEGIN |
VL_VIRTUALIZATION_END |
VM-based virtualization |
| Dual-Mode | VL_DUAL_MODE_BEGIN |
VL_DUAL_MODE_END |
Combined protection mode |
| TMA Virtualization / Super Operators | VL_TMA_VIRTUALIZATION_BEGIN |
VL_TMA_VIRTUALIZATION_END |
TMA virtualization using Super Operators |
| Runtime Code Encryption | VL_ENCRYPT_BEGIN |
VL_ENCRYPT_END |
User code section encryption |
| Runtime Encryption + Obfuscation | VL_ENCRYPT_OBFUSCATION_BEGIN |
VL_ENCRYPT_OBFUSCATION_END |
Combined encryption and obfuscation for VxLang code sections |
Note: TMA Virtualization and Super Operators refer to the same protection feature in this documentation; they are not presented as separate features.
1.2. SDK Header and Macro Activation
When USE_VL_MACRO is defined and vxlib.h is included, protection marker macros expand into SDK function calls such as VxVirtualizationBegin().
#define USE_VL_MACRO
#include "vxlib.h"
If USE_VL_MACRO is not defined, the protection-region BEGIN/END macros expand to nothing in the provided header. Make sure this setting is enabled in builds that should contain the protection markers.
Builds that invoke SDK functions also require the appropriate linkage and implementation. The integration procedure is covered in SDK Integration.
1.3. Code Protection Example
The following example marks a portion of a function for virtualization:
#define USE_VL_MACRO
#include "vxlib.h"
int CalculateValue(int value)
{
int result = 0;
VL_VIRTUALIZATION_BEGIN;
result = (value * 7) + 13;
VL_VIRTUALIZATION_END;
return result;
}
Place BEGIN/END markers so that they enclose the code you actually want to protect. For general obfuscation, use VL_OBFUSCATION_BEGIN / VL_OBFUSCATION_END. For TMA virtualization, use VL_TMA_VIRTUALIZATION_BEGIN / VL_TMA_VIRTUALIZATION_END.
1.4. Runtime Code Encryption Markers
Runtime encryption decrypts a protected code region when it is needed for execution and re-encrypts it when use is complete.
VL_ENCRYPT_BEGIN;
// User code to protect
VL_ENCRYPT_END;
To combine obfuscation and runtime encryption for a VxLang code section, use:
VL_ENCRYPT_OBFUSCATION_BEGIN;
// Code to protect
VL_ENCRYPT_OBFUSCATION_END;
According to vxlib.h, the combined markers expand in this order: begin obfuscation → begin encryption; on exit, end encryption → end obfuscation. Runtime Code Encryption depends on integration with VxLang-Core.
1.5. String Link Events
vxlib.h also provides link-event macros for strings and resource release.
| Macro | Purpose |
|---|---|
VL_ALLOC_STR(str) |
Invokes an ANSI string-related link event |
VL_ALLOC_WSTR(str) |
Invokes a wide-string-related link event |
VL_FREE(value) |
Requests release of a resource allocated through a link event |
Unlike the protection-region markers, these are APIs that return values or manage resources. When USE_VL_MACRO is disabled, these macros expand to nothing, so code using the string APIs must account for the selected build configuration. See SDK Integration for detailed string-handling and return-value rules.
1.6. Usage Notes
- Use BEGIN/END markers in pairs, and be careful with branches or early exits that leave a protected region.
- Compiler optimization and inlining can cause the generated machine-code region to differ from the source-code region.
- Prefer important functions or sensitive code regions over performance-critical loops.
- For
VL_ENCRYPT_*markers, verify correct BEGIN/END execution and multithreaded behavior. - The marker names and macro expansion behavior described here are based on the supplied
vxlib.h.
2. Protection Methods Overview
| Protection method | Primary target | Main purpose |
|---|---|---|
| Packer & Protector | Overall executable structure and loading process | Packing, protection of file structure and sensitive information, integrity checking |
| Code Obfuscation | Selected functions or instruction regions | Make code representation and analysis structure more complex |
| Code Virtualization | Selected critical code regions | Transform native code into a virtual-instruction execution model |
| Code Flattening | Function control flow | Increase the difficulty of analyzing branches and execution flow |
| Runtime Code Encryption | Designated code regions | Decrypt only when needed and re-encrypt after use |
Note: Availability and detailed behavior may vary depending on the VxLang version, target environment, and configuration.
3. Packer & Protector
3.1. Overview
Packer & Protector protects a target binary's structure and loading process. It works together with VxLang-Core to run protected executables and can include features such as compression and Import Table protection.
This is the basic configuration typically used when applying protection to an entire program.
3.2. Executable Packing
Executable Packing transforms a target binary into VxLang's protected format. Protected executables run through VxLang-Core initialization and execution flow.
Key characteristics
- Adds a protected loading structure to the executable.
- Makes direct analysis of the original executable structure and entry process more difficult.
- Can be combined with other code-protection methods.
3.3. Compression
Compression compresses executable data. It can be enabled or disabled in the project configuration.
{
"protector": {
"compress": true
}
}
true: Enable compression.false: Disable compression.
Compression is part of the protected-file format; compression alone does not prevent analysis of the code itself. The resulting file size can vary with the compression ratio and the additional protection code.
3.4. Import Table Protection
The Import Table in a Windows PE file contains information about external libraries and APIs used by the application. VxLang provides options to transform the Import Table structure or protect associated information.
| Project option | Description |
|---|---|
mutate-import-table |
Enables Import Table mutation. |
remove-import-table |
Enables the Import Table removal-related feature. |
These features are intended to make it harder to identify external API dependencies through static analysis. Verify the actual effect of enabling both options for your target binary and VxLang version.
3.5. Entry Point Protection
The Entry Point is where program execution begins. Protecting this region can make analysis of the initial execution path more difficult.
VxLang can configure virtualization or obfuscation of the Entry Point through project settings.
virtualizer.entry-point: Entry Point virtualizationobfuscator.entry-point: Entry Point obfuscation
Specific behavior and support conditions may depend on the target file. Verify startup and shutdown behavior after applying protection.
3.6. Anti-Tamper Protection
Anti-Tamper is designed to detect or respond to unauthorized modifications to protected applications. The supplied project format includes:
| Project option | Description |
|---|---|
protector.anti-tamper.enable |
Enables Anti-Tamper. |
protector.anti-tamper.enable-integrity-check |
Enables integrity checking. |
protector.anti-tamper.message |
Sets the message displayed on detection. |
This feature does not guarantee detection of every modification or analysis attempt. It can be used alongside other safeguards, including code signing, distribution-file verification, and server-side validation.
3.7. Reflection
Reflection is a protection option that adjusts aspects of executable loading.
protector.reflection.enable: Enables Reflection.protector.reflection.ldr-update: Controls updating Windows loader-management (LDR) information.
Compatibility testing may be necessary with security software that interacts with the loader and in certain execution environments.
4. Code Obfuscation
4.1. Overview
Code Obfuscation changes the representation and structure of instructions while preserving the behavior of the program's operations. Its purpose is to maintain the same results while complicating static analysis, pattern matching, and automated code interpretation.
VxLang can apply obfuscation to selected functions or code regions.
4.2. Instruction Transformation
Instruction transformation replaces existing instructions with semantically equivalent sequences. For example, it may split simple arithmetic or logic operations into multiple operations, introduce intermediate calculations, or change instruction arrangements.
Results depend on the selected protection core and options.
4.3. MBA Obfuscation
MBA (Mixed Boolean-Arithmetic) combines arithmetic and Boolean operations to express an original calculation in a more complex form.
Expected benefits
- Makes the meaning of code harder to recognize directly.
- Complicates simple instruction-pattern matching.
- Can increase the effort needed to analyze and simplify expressions.
Applying more MBA transformations can increase code size and execution time.
4.4. Function-Level Obfuscation
Function-level obfuscation protects the implementation of selected functions, such as license checks, critical calculations, and security validation.
The obfuscator.obfuscation array stores the selection information for code regions to obfuscate. The format of individual array entries is described in Project Configuration.
The obfuscator.function-entry option configures obfuscation associated with function entry points.
4.5. Protection Core Selection
VxLang uses the core-name setting to select a protection core for general obfuscation.
| Core | Description | Recommendation |
|---|---|---|
phobos |
Default protection core | Recommended for general use |
deimos |
Core designed to provide polymorphic hash-based MBA obfuscation | Check compatibility during ongoing core improvements |
vxlang |
Core name included in the project configuration | Verify support in the distributed version |
The currently recommended core is phobos. If core-name is omitted, phobos is used by default.
In the current core architecture, core-name applies to general obfuscation and the obfuscation API; it does not select the core used by the Packer Shell or VM Handlers. deimos may increase code-block splitting and affect performance, and it may be incompatible during core refactoring.
5. Code Virtualization
5.1. Overview
Code Virtualization converts selected native code into VxLang's virtual-instruction format. A VxLang virtual execution engine is used to execute protected code.
By adding a translation layer between the original machine instructions and the virtual instructions handled at runtime, virtualization aims to make direct reconstruction of the original algorithm and control flow more difficult.
5.2. Virtual Machine-Based Protection
A typical protection flow is:
Original Native Code
|
v
VxLang Virtualization
|
v
Virtual Instructions + VM Execution Engine
|
v
Protected Code Execution
The selected code region is handled by VxLang's virtual execution model. This transformation can make it harder to understand the code's behavior using native-code analysis alone.
5.3. Multiple Virtual Machines
VxLang supports configurations using multiple virtual machines. The supplied project file contains:
virtualizer.machine-count: Setting related to the number of virtual machines.
Using more than one VM does not automatically guarantee stronger protection; code size and execution overhead should also be considered.
5.4. Dual-Mode Protection
Dual-Mode combines Code Obfuscation and Code Virtualization for selected code.
Selected Code
|
v
Obfuscation + Virtualization
|
v
Protected Execution
It can add complexity compared with virtualization alone, but may also affect performance and binary size. Use virtualizer.dual-mode to specify protected regions.
5.5. TMA Virtualization (Super Operators)
TMA Virtualization and Super Operators are the same feature. VxLang provides its Super Operator-based execution model under the name TMA Virtualization. They are not separate virtualization options.
Use the following SDK markers in C/C++:
VL_TMA_VIRTUALIZATION_BEGINVL_TMA_VIRTUALIZATION_END
TMA has a distinct SDK interface from standard virtualization. Check support requirements and runtime performance with your target application and distributed version.
5.6. Performance Considerations
Virtualization can add processing overhead compared with native instruction execution. Performance degradation may be particularly noticeable when applied broadly to frequently called code or tight loops.
Recommendation: Apply virtualization selectively to critical algorithms, validation logic, and high-priority code regions, then compare performance before and after protection.
6. Code Flattening
6.1. Overview
Code Flattening (Control Flow Flattening) is an obfuscation method that transforms a program's branch and execution-flow structure. It complicates analysis of the original function's control flow and execution order.
6.2. Control Flow Transformation
Use obfuscator.flattening in the project to specify regions for this protection.
Typical functions have relatively recognizable branch graphs formed by conditions and loops. Code Flattening can restructure these flows using state-based dispatch or similar constructs, making the original control flow more difficult to read directly.
Before
Entry
|
Condition
/ \
A B
\ /
Exit
After (conceptual)
Entry
|
Dispatcher <----+
/ \ |
State A State B --+
|
Exit
This is a conceptual illustration; the generated control flow will not necessarily have exactly this structure.
6.3. Usage Considerations
- Prioritize functions where protection is most valuable instead of applying flattening indiscriminately.
- Output code size and execution time may vary with function size and complexity.
- Test protected functions that contain branches, loops, exception handling, and compiler optimizations.
7. Runtime Code Encryption
7.1. Overview
Runtime Code Encryption keeps designated code regions encrypted, decrypts them when execution is required, and re-encrypts them after use.
It is designed to account for analysis of process memory at runtime as well as examination of the executable on disk.
7.2. Encryption Lifecycle
Encrypted Code (at rest)
|
| BEGIN
v
Decrypted Code (in use)
|
| Protected code executes
v
END
|
v
Re-encrypted Code
- BEGIN: Decrypts the protected code region so it can execute.
- Protected Execution: The decrypted code performs its required operations.
- END: Re-encrypts the designated protected region.
There may be an interval during execution when protected code exists in plaintext. Therefore, Runtime Code Encryption does not mean that original code can never appear in memory.
7.3. VxLang-Core Dependency
Runtime Code Encryption is designed to operate together with VxLang-Core.
Removing the Packer Shell from a protected executable does not automatically restore the encrypted original code or make it executable. The required VxLang-Core components must be loaded to decrypt and execute encrypted code.
This is an important distinction between unpacking an executable and recovering its original code.
7.4. Protected Code Types
The SDK can designate regions for Runtime Code Encryption.
| Protected region | SDK macros |
|---|---|
| User code section protection | VL_ENCRYPT_BEGIN / VL_ENCRYPT_END |
| VxLang code section protection | VL_ENCRYPT_OBFUSCATION_BEGIN / VL_ENCRYPT_OBFUSCATION_END |
The VxLang code section protection API can also be used in configurations with Axion memory protection. Actual declarations, linking requirements, and examples are covered in SDK Integration.
7.5. Thread-Safe Execution
Runtime Code Encryption is designed around reference counting to account for cases where multiple threads use the same encrypted code region.
This is intended to prevent premature re-encryption while a thread is still executing the code. Test nested protected regions and thread-termination scenarios in the target application.
7.6. Protection Benefits
Hinders code collection through memory dumps
Code stays encrypted when not in use, which may make it harder to capture all original code in a protected region from a memory dump taken at an arbitrary moment.
Increases dynamic analysis effort
An analyst may need to track the precise decryption and execution windows, requiring more work than conventional bulk dumping and code collection.
Separates unpacking from original-code recovery
The VxLang-Core-dependent encryption design can restrict decryption and execution even after the Packer Shell has been removed.
Increases the difficulty of AI-assisted analysis
By limiting the time and scope in which plaintext code is available, the feature may make automated code collection and subsequent analysis more difficult. It does not, however, completely conceal code exposed during execution or the results of execution.
8. Choosing a Protection Method
Consider the following options based on what you need to protect.
| Goal | Feature to consider first |
|---|---|
| Baseline protection for the entire executable | Packer & Protector |
| Increase analysis difficulty for ordinary functions | Code Obfuscation |
| Protect critical algorithms or validation logic | Code Virtualization |
| Combine virtualization and obfuscation | Dual-Mode |
| Protect branching and control-flow structure | Code Flattening |
| Minimize continuous exposure of code during execution | Runtime Code Encryption |
| Combine methods for critical functions | Evaluate compatible combinations of Virtualization / Obfuscation / Runtime Code Encryption |
Recommended approach: Start with baseline executable protection, selectively add obfuscation or virtualization to critical functions, and apply Runtime Code Encryption where needed. Choose combinations based on actual feature support and performance testing.
9. Important Considerations
- Performance: Some protection methods increase execution time, memory usage, or output file size.
- Compatibility: Certain options may be limited by the OS, CPU, compiler, exception-handling model, or target binary structure.
- Compiler optimization: With SDK BEGIN/END regions, compiler code movement or merging may cause the actual protected region to differ from the intended one.
- Feature combinations: Options apply at different execution layers, so not all combinations are supported in the same way.
- Validation: After protection, test startup, shutdown, primary functionality, multithreading, exception handling, and performance in the actual deployment environment.
10. Related Documentation
- Getting Started — Installation and creation of your first project
- Project Configuration (JSON) — Protection options and project fields
- Using Obscurion (GUI) — Selecting protected regions through the GUI
- SDK Integration — Designating protected code regions in C/C++
- Advanced Configuration — Advanced settings for performance and compatibility
This is a user-facing overview of VxLang protection features. Refer to the configuration and API reference for your distributed version to confirm the exact feature support and option usage.
