Techniques07-Feb-26|11 min read

The XOR Key Epidemic

Why builder defaults keep reappearing in malware, and what defenders gain from it

Definition:

The XOR key epidemic refers to the reuse of the same encryption keys across many samples, builds and operators. Cobalt Strike is the clearest public case: its beacon configuration is obscured with a fixed byte, 0x69 in version 3 and 0x2e in version 4, and the overwhelming majority of collected beacons carry one of the two. Reuse stems from default tool configurations, copied code, and operational inertia. For defenders, it creates a useful attribution signal: a successful decryption with a known key decodes the payload and suggests a probable tool or family to check.

Encryption keys are meant to be secrets, yet the same key byte turns up in sample after sample, from operators who have never met and campaigns aimed at different victims. The explanation is mundane: builders get copied and defaults get inherited, which leaves a pattern defenders can use. The encryption keys as threat intelligence article covered the methodology for building key databases. This article focuses on a specific phenomenon: why keys converge across families, and what that convergence reveals.

Have a blob rather than a key? The XOR string decoder recovers the text behind a single-byte key.

The Cobalt Strike case

Cobalt Strike stores its beacon configuration XOR-encoded with a single hardcoded byte: 0x69 in version 3 and 0x2e in version 4 (SentinelLabs, 2020). Config extractors try those two values before anything else, and that ordering works because the byte is not something an operator can set.

Changing it means patching the beacon or the team server, and most operators don't. When NCC Group mined configurations from a large set of collected beacons, the two defaults were by far the most common keys, and a non-default key was itself a useful finding, because it marked a beacon someone had modified (NCC Group, 2022).

The same framework carries a second recurring key one stage earlier. Its PowerShell stager decodes the embedded shellcode with -bxor 35, and analysts still find that loop unchanged in real intrusions (ThreatDown, 2024). Neither key is secret any more, so both work as detection leads.

The Copy-Paste Economy

Most malware isn't written from scratch. It's assembled from components: a loader template from one source, an encryption routine from another, a persistence mechanism from a tutorial, a C2 protocol from a leaked builder. The underground malware economy runs on code reuse.

When a builder tool ships with a hardcoded encryption key, every operator who uses that builder produces samples with the same key. If the builder gets cracked and distributed on forums, the key spreads further. If someone writes a blog post analysing the builder and mentions the key, it gets copied into other projects.

A builder sold in 2019 with a hardcoded key is still generating samples in 2026. The operators using it may not even know the key is configurable. They click "generate," get a working payload, and move on. The key persists because nobody has a reason to change it.

Operational Inertia

Even when operators know the key is configurable, they often don't change it. Changing keys means rebuilding payloads, retesting delivery chains, updating any infrastructure that expects specific encrypted formats, and risking breakage in a process that currently works.

For high-volume campaigns pushing thousands of samples per week, that operational overhead isn't worth the marginal improvement. The encryption isn't there to be unbreakable. It's there to beat signature scanners. A different key doesn't make the encryption stronger against brute-force. It just means the attacker spent time changing something that didn't improve their outcome.

XOR is chosen for speed and simplicity, and those same properties make it easy to brute-force. Key reuse shortens the search further, because a handful of known defaults can be tried before the full keyspace.

Common Convergence Points

The keys below are the ones public research ties to a specific tool. Unsourced values are left out.

Key Examples
0x69
TypeSingle-byte XOR
Known associationCobalt Strike beacon configuration, version 3
Why it persistsHardcoded, not an operator setting (SentinelLabs, 2020)
0x2e
TypeSingle-byte XOR
Known associationCobalt Strike beacon configuration, version 4
Why it persistsHardcoded, not an operator setting (SentinelLabs, 2020; NCC Group, 2022)
35 (0x23)
TypeSingle-byte XOR
Known associationShellcode in Cobalt Strike PowerShell stagers
Why it persistsTemplate default left unchanged (ThreatDown, 2024)

Multi-byte keys show less convergence because the keyspace is larger, but patterns still emerge. Keys like 0xDEADBEEF and 0xCAFEBABE can recur because they're memorable placeholder values that developers use during testing and forget to replace. ASCII keys like KEY, PASS, and SECRET appear in builder configurations that treat encryption as an afterthought.

The Defender's Advantage

Key convergence creates a practical shortcut. Instead of brute-forcing all 255 single-byte values for every sample, a tool can try known keys first, ordered by prevalence. If one of the common keys produces recognisable output, the analysis is done in milliseconds instead of seconds.

The bigger advantage is attribution. When a configuration blob decrypts cleanly with 0x2e, the analyst has a starting hypothesis: check for Cobalt Strike indicators. The investigation starts with context instead of starting from zero.

Building a key-to-family database turns every successful decryption into both intelligence extraction and attribution. The decoded content gives you IOCs. The key match gives you a family hypothesis. Both come from the same operation.

Campaign Correlation Through Keys

Key reuse enables a specific type of campaign correlation. When two seemingly unrelated samples share an unusual multi-byte XOR key, it suggests common tooling or a shared operator. The C2 domains might be different. The file hashes are certainly different. But the encryption key points to a common origin.

This is especially valuable when keys rotate slowly. An operator might change C2 domains weekly but use the same encryption key for months. The key becomes a more stable identifier than traditional IOCs, connecting samples across time periods where other indicators have rotated.

Combined with decoder chain analysis, where the sequence of obfuscation layers also acts as a fingerprint, key tracking provides a durable attribution signal that persists through infrastructure changes.

What Changes When You Track Keys

Without key tracking, deobfuscation is a mechanical task. Decode the content, extract the IOCs, move to the next sample. With key tracking, every successful decryption adds to a growing intelligence picture: which keys are active, which families are using them, whether key usage is shifting over time.

Attackers reuse keys because changing them is inconvenient, and that makes commodity malware easier to identify. Track the keys.

KlaroSkope maintains a curated key database and automatically attempts known keys during deobfuscation, turning every decryption into both payload extraction and family attribution. Try KlaroSkope Free

Frequently Asked Questions

Q

What is XOR encryption in malware?

XOR (exclusive or) is a bitwise operation commonly used by malware to encrypt payloads. Each byte of the payload is XORed with a key byte to produce ciphertext. The same operation reverses it. Single-byte XOR has only 255 possible keys, making it trivially brute-forceable, but it remains effective at evading signature-based detection tools.
Q

Why do different malware families use the same XOR key?

Key convergence happens because malware authors copy code from shared sources: underground forums, cracked builder tools, leaked framework code, and tutorial examples. A builder sold in 2019 with a hardcoded default key still produces samples in 2026. Operators often don't know the key exists, don't know how to change it, or don't care enough to bother.
Q

Can XOR keys identify which malware family infected a system?

A key match is a lead. A successful decrypt with one of Cobalt Strike's configuration defaults (0x69 in version 3, 0x2e in version 4), combined with the configuration structure in the decrypted bytes, makes Cobalt Strike a strong hypothesis. A single-byte match on its own is weak evidence, because any byte can recur by coincidence.
Q

How many XOR keys do defenders need to track?

Fewer than you might expect, because builder defaults recur. Track the keys that public research ties to a specific tool, such as Cobalt Strike's configuration bytes, and record where each one was observed. For anything else, a single-byte keyspace is small enough to search exhaustively.

Found this useful? Sharing is caring!

Ready to decode?

See KlaroSkope transform obfuscated scripts into actionable intelligence.

Try It Free