Articles · String encryption

Why your binary's strings betray it

Before an attacker disassembles anything, they run one command. It takes a fraction of a second, needs no skill, and on an unprotected program it often hands over a map of the whole thing. That command scans the file for readable text — and the text your program embeds is more revealing than most developers realize.

What a strings scan sees

When you write a literal in your source — an error message, a URL, a registry key, a format string — the compiler stores those exact characters, in the clear, inside the binary. A scanner that walks the file looking for runs of printable characters pulls every one of them out:

strings app.exe — a sample of what leaks
Invalid license key
License valid until %d-%02d-%02d
SOFTWARE\MyApp\License
https://api.example.com/v1/activate
debug_unlock_all_features
C:\dev\myapp\src\licensing\verify.cpp

None of that is code, yet together it describes the program's design: there is a license, it has an expiry date, it is stored under a specific registry key, it phones an activation endpoint, there is a developer flag named debug_unlock_all_features, and the licensing logic lives in a file called verify.cpp. An analyst has learned the architecture of your protection without reading a single instruction.

Why this is worse than it looks

The danger is not only that the strings are readable — it is that they are anchors. Every string literal sits at a known address, and the code that uses it refers to that address. So a cross-reference search jumps straight from a human-readable message to the exact function that uses it. As covered in how crackers attack license checks, the error text "Invalid license key" leads directly to the branch that decides to show it. The string the honest user sees is the signpost that guides the attacker to the check.

Format strings, log messages and assertion text are especially generous: they often spell out variable names, states and conditions in plain language, effectively annotating the disassembly for whoever comes to read it.

How string encryption closes the gap

String encryption stores the sensitive literals as ciphertext on disk, so a scan of the file finds nothing readable. Each string is decrypted on demand, at the moment it is used, kept in plaintext only briefly in a private buffer, and — in a strong implementation — decrypted inside the protection layer rather than by an exposed, reusable routine. Two properties make this effective:

  • The map disappears. With no readable text in the file, the fast cross-reference attack has no starting point. Finding the license check becomes a search with no signpost.
  • Per-string keys beat a single toggle. If every string were decrypted by one shared function with one key, an attacker would hook that function once and dump them all. Encrypting each string independently, and decrypting within the virtual machine, denies that single choke point.

A well-designed implementation also handles a subtlety: some string literals are shared with unprotected parts of the program. Those are detected and left untouched, so encryption never breaks the rest of your application — both regular (ANSI) and wide (UTF-16) strings are supported.

What to encrypt

You do not need to encrypt every string in the program, and doing so blindly can hurt more than help. Concentrate on the literals that reveal design or aid an attacker: licensing and error messages, registry keys and paths, endpoint URLs, feature-flag names, and any text near sensitive logic. Encrypting those, together with virtualizing the functions that use them, removes both the map and the destination it points to.

The takeaway

A strings scan is the cheapest, fastest reconnaissance an attacker has, and on an unprotected binary it frequently succeeds. Encrypting your sensitive string literals — decrypted only briefly at run time, ideally inside a virtual machine, with shared strings left intact — removes that reconnaissance and, with it, the anchors that lead straight to the code you most want to protect.

Stop your strings from leaking

String encryption ships in the Basic and Pro editions, decrypting each literal on demand inside the VM. See how protection changes your binary — start with the free demo on your own .exe or .dll.

Download Free Demo