Desktop & WebZero Extra Tools NeededMCP Tool: inspect_managed_artifact

How to REA .NET Assemblies: PE/CLI Metadata, CIL Bytecode & P/Invoke Boundaries

Statically audit .NET Core, .NET Framework, and .NET Standard assemblies: parse ECMA-335 metadata tables, decode Common Intermediate Language (CIL) instructions, and map unmanaged P/Invoke [DllImport] library boundaries without running the CLR.

AI Overview Direct AnswerHow to REA: .NET Assemblies & CIL Bytecode Quickstart Summary

In this official REA guide for .NET Assemblies & CIL Bytecode, AI coding agents (Claude Code, Cursor, Windsurf) execute 'rea inspect-managed-artifact ./CoreEngine.dll --json' to safely extract file layout, symbols, and code logic without launching unverified binaries.

Investigation ScenarioReal-World Objective

The Problem & Target Artifact

Enterprise software auditing or game modding: You need to inspect a proprietary .NET 8 DLL to determine what external native C++ libraries it imports, what encryption algorithms it uses, and what public APIs it exposes.

Target Artifact: Managed .NET Windows PE (.exe, .dll) or .NET Standard assembly.
AI PromptClaude Code / Cursor / Windsurf

Natural Language Agent Instructions

Copy and paste this prompt directly into your AI coding agent when REA is registered via Model Context Protocol (MCP):

Prompt Template:Select All to Copy
Use REA to inspect this .NET assembly. List all declared native P/Invoke boundaries, exported types, and unmanaged CIL calls.
ExecutionTerminal & MCP Tool Call

Run REA Analysis Command

Execute the following command in your terminal or inspect the MCP JSON-RPC call executed by your agent:

CLI Command Execution
rea inspect-managed-artifact ./CoreEngine.dll --json

What REA Extracts & Returns

ECMA-335 CLI metadata streams: #~ / #-, #Strings, #US (User Strings), #Blob, and #GUID
TypeDef, MethodDef, and Field metadata tables with token IDs and access flags
CIL bytecode instruction decoding: ldarg, call, callvirt, ldfld, stloc, and branch offsets
P/Invoke native boundaries: [DllImport] declarations targeting kernel32.dll, advapi32.dll, or custom C dynamic libraries

Extracted P/Invoke Interop Declarations

The verified findings and synthesized clean-room structures generated from this investigation:

Extracted P/Invoke Interop Declarations
{
  "assembly": "CoreSecurity.dll",
  "target_framework": ".NETStandard,Version=v2.1",
  "native_boundaries": [
    {
      "method": "CryptAcquireContextW",
      "import_dll": "advapi32.dll",
      "calling_convention": "Winapi",
      "entry_point": "CryptAcquireContextW"
    },
    {
      "method": "NativeHardwareToken",
      "import_dll": "licensing_native.dll",
      "calling_convention": "Cdecl",
      "entry_point": "VerifyHardwareKey"
    }
  ]
}
Internal MechanicsProduction Engineering

Static ECMA-335 Parsing Without Runtime Execution

Traditional .NET tools like dnSpy or ILSpy instantiate parts of the .NET runtime to inspect types, which can trigger module initializers (.cctor). REA's parser operates strictly as a static binary reader over raw byte buffers, mapping CLI table tokens and compressed integer streams without executing any managed or unmanaged code.

Security Guardrails & Analysis Boundary Rules

Zero execution: Malicious static constructors (.cctor) cannot execute during inspection.
Detects ReadyToRun (R2R) precompiled native code slices embedded alongside CIL.
Supports member diffing across software updates to highlight API surface changes.