Dev.to Security 🔐 Cybersecurity 👁 0 📖 8 min read

VMProtect SDK Explained: Markers, Modes and Real Usage Data

VMProtect is a commercial software protector that you run on a program after compiling it: you choose the functions worth protecting, and it rewrites each one by mutation, by virtualization into bytecode for its own embe

VMProtect SDK Explained: Markers, Modes and Real Usage Data

VMProtect is a commercial software protector that you run on a program after compiling it: you choose the functions worth protecting, and it rewrites each one by mutation, by virtualization into bytecode for its own embedded virtual machine, or by both. For this post we searched public GitHub code on 18 November 2026 for every function in the VMProtect SDK and found 190 repositories that call it. Their choices, read next to the vendor's own user manual, show what developers do with the protector in practice, and where the trade-offs sit.

Lost the source of your own protected build? Devirt reads VMProtect files from the analysis side, for files you own or are authorized to analyze. Software owners use VMProtect devirtualization to recover the logic of their own protected releases as LLVM IR, annotated pseudocode or an IDA database, with a coverage ledger that counts every protected function so nothing silently drops out.

This post is for developers deciding whether, and how, to protect a native or .NET build. It covers the mechanics and the trade-offs, not ways around them.

How do you mark code for VMProtect?

VMProtect protects the code regions you mark in source with SDK marker pairs. A call to VMProtectBegin, VMProtectBeginVirtualization, VMProtectBeginMutation or VMProtectBeginUltra opens a region, and VMProtectEnd closes it:

#include "VMProtectSDK.h"

bool check_license(const char *key)
{
    bool ok = false;
    VMProtectBeginVirtualization("check_license");
    ok = validate_key(key);   // the logic you want protected
    VMProtectEnd();
    return ok;
}

The markers do nothing at runtime. VMProtect finds them in the compiled file, protects the marked region with the chosen compilation type, and removes the references to the SDK, which is why the VMProtect user manual says the SDK DLL is only needed before protection and doesn't ship with your program. Plain VMProtectBegin leaves the compilation type to be set in VMProtect itself, so you can change it without touching the source.

Three details from the manual save debugging time:

  • Name every marker. Unnamed markers are numbered in order, so adding one renumbers all the others and your project settings no longer line up. The manual recommends always using named markers.
  • No jumps in from outside. Code outside a marked region must not jump into the middle of it, which happens easily if you wrap only part of a loop.
  • Markers skip the prologue and epilogue. A marked region never includes the function's own entry and exit code. To protect a whole function, select it by name in the VMProtect project instead, using the MAP or PDB file your compiler writes.

.NET methods are marked with the standard ObfuscationAttribute, and its Feature string picks the mode:

using System.Reflection;

[Obfuscation(Feature = "virtualization", Exclude = false)]
public static bool CheckLicense(string key) { /* ... */ }

The other Feature values the manual lists include mutation, ultra, the two lockbykey variants, renaming and strings.

vmprotect build pipeline

Mutation, virtualization or Ultra: which mode for which function?

VMProtect gives each marked function one of three compilation types, and each one trades execution speed for protection. The user manual rates them itself:

  • Mutation rewrites the function into different, more complicated native instructions. The manual says its main purpose is to stop automated signature analyzers from detecting the protected functions, and rates it low on protection and high on execution speed.
  • Virtualization translates the function into bytecode that only VMProtect's embedded virtual machine can run. A disassembler no longer sees your instructions, only the interpreter. The manual rates it average on both protection and speed.
  • Ultra applies mutation and then virtualization. The manual rates it high on protection and says it executes slowly.

vmprotect modes tradeoff

That gives a working rule. Put virtualization on code that decides something worth stealing or patching, such as a license check, key derivation or a proprietary algorithm, as long as it isn't on a hot path. Keep mutation for library and helper code you mainly want harder to fingerprint. Save Ultra for small routines that run rarely, where a slow interpreter costs you nothing. Everything else stays native.

What does the VMProtect SDK include besides markers?

The VMProtect SDK has three groups of functions: code markers, service functions and licensing functions. The markers are the ones above, plus two LockByKey variants that encrypt part of a virtualized region's VM commands with a key carried in the user's serial number, so the function can't run without a valid serial.

Group Functions What they do
Code markers VMProtectBegin, BeginVirtualization, BeginMutation, BeginUltra, BeginVirtualizationLockByKey, BeginUltraLockByKey, VMProtectEnd Mark regions and choose their compilation type
Service VMProtectIsProtected, IsDebuggerPresent, IsVirtualMachinePresent, IsValidImageCRC Runtime checks: was the file processed by VMProtect, is a debugger or virtual machine present, has the module been changed in memory
Service (strings) VMProtectDecryptStringA, DecryptStringW, FreeString Decrypt a string constant you added to the protected objects, so it isn't stored in plain text
Licensing VMProtectSetSerialNumber, GetSerialNumberState, GetSerialNumberData, GetCurrentHWID Serial number checks, with state flags for corrupted, invalid, blacklisted, expired, running time over, wrong hardware ID, and a serial that doesn't cover this build
Activation VMProtectActivateLicense, DeactivateLicense, GetOfflineActivationString, GetOfflineDeactivationString Online and offline activation

The manual lists the licensing system for the Ultimate edition only. It also documents watermarks: hidden per-customer byte arrays embedded in the protected file, so a leaked copy can be traced to the licensee it was built for.

How do developers use the VMProtect SDK in public code?

In public code, VMProtect is mostly a marker tool. A GitHub code search census on 18 November 2026 found 190 public repositories with at least one verified call to a VMProtect SDK function, after leaving out forks, SDK headers and stubs, copies of the protector and copied projects. 156 of them use code markers, and 120 of those 156 (77%) call no other SDK function at all.

The mode choices surprised us:

  • Ultra, the mode the manual calls slow, is the most common: 67 of the 156 marker-using repositories (43%) call VMProtectBeginUltra.
  • Virtualization follows with 54 (35%, counting its LockByKey variant), then Mutation with 51 (33%).
  • Plain VMProtectBegin, which leaves the mode to the VMProtect project, shows up in 46 (29%).
  • The largest group names a single mode (82 repositories); 33 name two, 8 name all three and 33 only ever use plain VMProtectBegin. The LockByKey markers appear in one repository.

Beyond markers, 57 repositories call service functions. String decryption is the most used (34 repositories), then the debugger and virtual machine checks (25) and the image integrity check VMProtectIsValidImageCRC (14). The licensing API is rare in public code: 18 repositories, led by VMProtectSetSerialNumber (12) and VMProtectGetCurrentHWID (10). Only 3 call VMProtectActivateLicense, and none use the offline activation functions. That's no surprise. License code is the part a commercial product keeps private.

C and C++ dominate (176 of the 190 repositories). Others include 10 Java projects that name the markers in a @Native annotation on the methods to protect, 4 Delphi projects and one in V.

Public repositories are not a sample of VMProtect's customers, since most commercial software never publishes its source. It does show how developers who publish code reach for the SDK: markers first, Ultra often, and little else.

vmprotect sdk census

Does VMProtect slow down your program?

VMProtect slows down the code it virtualizes, because each virtualized instruction is executed by an interpreter inside the protected file rather than directly by the processor. The user manual says virtualization should only be applied to parts of the code that aren't critical to execution speed, and it doesn't publish overhead figures. Mutated code stays native and is the fast option. Ultra is the slow one.

In practice that means three things:

  1. Keep tight loops, per-frame code and anything called thousands of times a second outside virtualized regions.
  2. Virtualize the decision, not the work: the branch that checks the license, not the loop that renders the document afterwards.
  3. Measure your own build before and after protection. The cost depends on what you marked, so nobody else's number transfers to your program.

Why does antivirus flag a VMProtect-protected build?

Antivirus engines flag some VMProtect-protected files heuristically, because malware authors use the same protector and the protection layer looks alike whatever it wraps. The flag says the file is protected, not that it's malicious. If your own signed build gets flagged, the antivirus vendor's false-positive submission process is the place to start. The malware side of the story, and how analysts read these detections, is what our newsletter piece on what VMProtect is and why antivirus flags it covers.

What does VMProtect stop, and what doesn't it?

VMProtect virtualization raises the cost of reading a function; it doesn't make the function unreadable. A virtualized function still has to run on a real processor, so its behavior can be observed, and its bytecode can be translated back into readable logic with enough work. That translation is devirtualization, and it starts from how VMProtect's virtual machine turns each protected function into bytecode and handlers.

Anything the compiler already threw away doesn't come back either way: variable names, comments, the project's structure. So the realistic goal of protection is cost and time. A virtualized license check takes far longer to understand than a native one, and a key you never ship can't be recovered from the binary at all. Server-side checks still beat anything you protect on the client.

Recovery is also rarely all-or-nothing. Devirt reports every protected function it counts in one of four proof states: proven, runtime-dependent, unresolved or permanently bounded. Read from the developer's side, a function whose behavior depends on runtime data the analyst never sees, such as a server response, gives away the least.

How the census was run

The census ran on 18 November 2026 against GitHub's code search API, through the authenticated GitHub CLI. It searched for each of the 22 functions the VMProtect user manual documents (seven markers including VMProtectEnd, seven service functions, four licensing and four activation functions), splitting every query by file size so that no slice passed the API's 1,000-result cap, and asked for the matched text fragments. The 48 slices returned 21,606 unique file matches across 562 repositories. Five rules turned hits into usage:

  1. Exact names only. GitHub's search also matches longer names (a search for VMProtectBegin returns files that only contain VMProtectBeginMutation), so a hit counts only when a returned fragment contains the exact identifier.
  2. Calls only. SDK headers and bindings, stub implementations, #define wrappers, comments, strings, documentation and project files don't count.
  3. No protector copies. 31 repositories named after VMProtect (copies of the protector, SDK bindings, analysis tools) and 4 that carry the protector's own source were left out, along with the SDK's own example programs.
  4. No duplicates. No forks came back from the search, and 48 repositories with two or more call sites that all reappear in another repository were treated as copies and dropped.
  5. One count per repository per function, however many files call it.

The numbers are lower bounds. GitHub returns only a few text fragments per file, so a call outside them is missed, and GitHub's code search only covers default branches and files under 384 KB. Rerunning it takes one code search per function, split by file size, and the five filters above.

Written by Devirt, an automated devirtualization service for authorized analysis of protected software.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.