Skip to content
← All posts
· Delta1 Labs ObfuscationNebula

SuppressIldasmAttribute is not protection: what anti-ILDASM actually buys you

Why the [SuppressIldasm] flag stops exactly one tool — and is ignored outright on modern .NET — plus what real metadata and string hardening does instead, with C#, IL and Nebula config.

Search “protect .NET assembly” and someone will tell you to add one line:

[assembly: System.Runtime.CompilerServices.SuppressIldasm]

The promise is that your DLL can no longer be disassembled. The reality is narrower than almost anyone who pastes that line realises, and on modern .NET it does nothing at all. This is a deep explainer on what SuppressIldasmAttribute actually does, why it stops exactly one program, and what it takes to make an assembly genuinely expensive to read.

What the attribute really is

SuppressIldasmAttribute is not encryption, not a permission, not a lock. It is a marker — a zero-field custom attribute that the compiler writes into your assembly’s metadata. At the IL level it is just another .custom entry in the CustomAttribute table:

.custom instance void [System.Runtime]
    System.Runtime.CompilerServices.SuppressIldasmAttribute::.ctor() = ( 01 00 00 00 )

That ( 01 00 00 00 ) is the attribute blob: a two-byte prolog and a two-byte count, with no arguments. Nothing about your code changes. Every type, every method body, every string literal is written to the file exactly as before. The only new thing in the assembly is a flag that says, in effect, “please don’t disassemble me.”

Whether anyone honours that request is entirely up to the tool reading the file.

Exactly one tool ever listened — and it stopped

Historically, Microsoft’s own ildasm.exe — the IL Disassembler shipped with the .NET Framework SDK — checked for this attribute. If it found one, it printed // This assembly is protected... and refused to dump the IL. That is the entire mechanism. It was a gentleman’s agreement between Microsoft’s authoring tool and Microsoft’s disassembling tool.

Two facts collapse the protection:

  1. No other reader ever checked it. ILSpy, dnSpy, dotPeek, JustDecompile, the Mono monodis utility, and modern decompilers including Glass.NET read the metadata tables directly. None of them consult the SuppressIldasm flag, because nothing in the ECMA-335 format obliges them to. They open the file, walk the TypeDef and MethodDef tables, resolve each method’s IL from its RVA, and reconstruct C#. The attribute is invisible to them.

  2. On .NET 6 and later, even ildasm ignores it. The honour was removed. The attribute still compiles — it is marked obsolete — but the modern disassembler dumps the assembly regardless. So on any current .NET target, [assembly: SuppressIldasm] is a literal no-op: it changes four bytes of metadata and protects nothing, not even against the one tool it was written for.

The net effect, today: you have added an attribute that does nothing, and possibly convinced yourself you are protected when you are not. That second part is the real hazard.

Why it was always weak: the file is still readable

Step back from the attribute and look at what a .NET assembly actually exposes. The managed metadata is not an opaque blob — it is a set of well-defined streams inside the PE file, and decompilers feed on them directly.

What a decompiler reads from the metadata streams — the SuppressIldasm flag guards none of it Assembly metadata a decompiler walks directly #~ (tables) TypeDef, MethodDef, Field, Param rows #Strings every type, method and field name #US every string literal in your code method bodies (IL) resolved from each RVA #Blob signatures, constants SuppressIldasm flag — one row in CustomAttribute The flag sits beside the data; it does not encrypt, remove or guard any of it. A reader that skips the flag still reads every box above.

The #Strings heap holds the plaintext name of every type, method, field and parameter. The #US (user-string) heap holds every string literal your code contains. The #~ stream holds the tables that stitch them together, and each method’s IL is resolved from its relative virtual address. A decompiler opens the file and reads these structures. That is the whole job.

The SuppressIldasm flag sits next to all of this, in one row of the CustomAttribute table. It does not remove a single name, encrypt a single literal, or obscure a single opcode. It asks one reader to look away — and the data it would look away from is still sitting there in full for everyone else. That is why the protection was never meaningful, independent of the .NET 6 change: the thing worth protecting was never touched.

What actually raises the cost

Real protection does not ask a reader to be polite. It removes or scrambles the information the reader depends on, so that a decompiler which ignores every flag still hands its operator very little.

Rename the metadata. The #Strings heap is where meaning leaks. CalculateMonthlyAccrual and _remainingTrialDays tell an attacker exactly where to look. Rename them to unprintable or colliding identifiers and the decompiled output becomes a maze of a.b(c) with no semantic anchors — the names are simply gone from the heap.

Encrypt the literals. The #US heap is the other giveaway: connection string shapes, API routes, error messages and license-check text all read in clear. Replace each literal with an encrypted blob and a lazy decryptor, and the heap carries ciphertext instead of your business logic in prose.

Reshape the flow. Control-flow flattening and opaque predicates attack the shape of the logic that survives in the method bodies, so even reconstructed code resists reading.

In Nebula these are config, not attributes. A minimal nebula.config.json that does the work SuppressIldasm only pretends to:

{
  "renaming": { "mode": "dictionary" },
  "encryptStrings": true,
  "controlFlow": { "enabled": true, "opaquePredicates": true },
  "antiIldasm": true
}

Then protect the built assembly:

nebula protect ./bin/Release/net8.0/Billing.dll \
  --config nebula.config.json \
  --out ./protected/

Note antiIldasm is in that list — Nebula will emit the flag if you ask, because it costs nothing and closes one trivial door on the frameworks where it still has any effect. But it is the last and least line in the file, deliberately. The three lines above it are what change the outcome. Enabling only antiIldasm and shipping is the mistake this whole post exists to prevent.

Prove it to yourself

You do not have to take this on faith. Build an assembly with nothing but the attribute, then open it in any modern decompiler — including a free one like Glass.NET:

# Build with only [assembly: SuppressIldasm] — no other protection
dotnet build -c Release

# Open the output and read the source straight back
glass decompile ./bin/Release/net8.0/Billing.dll --out ./recovered/

Every method name, every string, every line of logic comes back. Now run the same assembly through nebula protect with the config above and decompile that. The names are gone, the strings are ciphertext, and the control flow fights you. That contrast is the entire argument: one approach asks a tool not to look; the other removes what the tool was looking for.

The takeaway

SuppressIldasmAttribute is a historical courtesy between two Microsoft tools, and that courtesy ended in .NET 6. It never protected your code — it asked a single legacy disassembler to decline to show it, while leaving every name, literal and opcode fully intact for every other reader. Ship it if you like; it is free and harmless. Just never mistake it for a defence. The assembly is protected when the information an attacker needs is not in the file to read — and that is a renaming, string-encryption and control-flow problem, not a one-line attribute.

Renaming and string encryption are Pro features in Nebula; aggressive control-flow protection is Enterprise. The attribute is in every tier, because a checkbox that costs nothing is worth exactly what it costs.

Try Nebula.NET

Harden your .NET code in minutes — start with the free edition.