Invalid Metadata

Invalid metadata adds malformed metadata to your .NET modules, so decompilers fail to rebuild them while the runtime keeps executing your application normally.

  • .NET.NET
TL;DR

Invalid metadata exploits the gap between what the .NET runtime needs and what decompilers expect. It adds metadata that is malformed from a decompiler's point of view but harmless to the runtime. The application runs correctly, and decompilers fail to reconstruct it.

Definition

What is invalid metadata?

Every .NET assembly carries metadata: structured information describing its types, methods, and members. The runtime uses it to execute the application, and decompilers use it to rebuild readable source code.

Invalid metadata is an obfuscation technique that adds metadata which the runtime tolerates but decompilers cannot process. It targets the assumptions decompilers make about how metadata is structured.

The application behaves exactly as intended, because the runtime handles the metadata correctly. Decompilers, which expect well-formed metadata, fail: they crash, skip types, or produce output that cannot be rebuilt.

Mechanism

How invalid metadata works

Invalid metadata targets the metadata-parsing weaknesses of decompilers:

  • Malformed metadata entries. Metadata structures valid for the runtime but unexpected by decompilers are added.

  • Decompiler traps. Constructs known to break common .NET decompilers during metadata parsing are inserted.

  • Runtime-safe insertion. Every change is verified so the runtime loads and executes the assembly without error.

The assembly runs, but decompilers cannot rebuild it from its metadata.

Example

Invalid metadata example

The same .NET assembly, opened in a decompiler. Invalid metadata changes whether the decompiler can rebuild it at all.

Without invalid metadata

A decompiler reads the assembly's metadata and reconstructs its types and methods into clean, readable source.

With invalid metadata

The same decompiler hits the malformed metadata and fails to rebuild the assembly, producing broken or incomplete output.

Without invalid metadata
[assembly: AssemblyTitle("Acme.Vault")]

namespace Acme.Vault;

internal class SecretStore
{
    public byte[] Get(string id) { /* ... */ }
}
With invalid metadata
[assembly: AssemblyTitle("Acme.Vault")]

namespace Acme.Vault;

internal class SecretStore
{
    public byte[] Get(string id) { /* ... */ }
}

Use cases

When to use invalid metadata

Invalid metadata is most useful when your .NET application:

  • Must resist the decompilers attackers reach for first.
  • Has already been renamed and obfuscated and needs decompilation broken outright.
  • Contains assemblies sensitive enough to justify breaking reconstruction.

It pairs with invalid code and anti-ILDasm: together they break disassembly and decompilation at the tooling level, while obfuscation handles whatever an attacker still manages to recover.

Platform availability

Invalid metadata and the .NET platform

  • .NET

    Exclusive. Invalid metadata targets the metadata format of .NET assemblies and the decompilers built around it. Other platforms resist decompilation through different Shield protections.

Frequently asked questions

What is invalid metadata?
Invalid metadata is a .NET obfuscation technique that adds malformed metadata to an assembly. The runtime tolerates it, but decompilers cannot process it and fail to rebuild the assembly.
Does invalid metadata affect how my application runs?
No. Every change is verified to be runtime-safe, so the application loads and executes exactly as intended.
Does invalid metadata stop every decompiler?
It breaks the common decompilers attackers use, but tools evolve. It is one layer, strongest combined with invalid code and obfuscation.
How is invalid metadata different from invalid code?
Invalid code targets instruction sequences. Invalid metadata targets the metadata that describes the assembly. They break decompilers at two different stages.
Which platforms support invalid metadata?
Invalid metadata applies only to .NET, because it targets the .NET metadata format.
10,000+ developers and companies protect their applications with ByteHide

Protect your application with
ByteHide Shield

Invalid metadata is one of more than 20 protections in ByteHide Shield. Apply it to your .NET application alongside obfuscation for real depth.

ByteHide runtime dashboard showing live threat monitoring and protection metrics