Nov 4, 2026·9 min read·13 visits
Metalama versions prior to 2025.1.18, 2026.0.25, and 2026.1.19 contain an unsafe deserialization flaw in their local Windows named pipe IPC channels. Local processes running in the same user session can connect to predictable named pipes and send crafted Newtonsoft.Json or MessagePack payloads to achieve arbitrary code execution inside the Visual Studio (devenv.exe) process.
CVE-2026-62848 (GHSA-h26j-4vp7-x9w2) is a high-severity unsafe deserialization vulnerability in Metalama, a Roslyn-based meta-programming and code generation framework for C#. The flaw resides in the inter-process communication (IPC) channel used by Metalama within Microsoft Visual Studio. Across versions 2023.0 through 2026.1.18, the framework utilized either Newtonsoft.Json with TypeNameHandling.All or MessagePack with TypelessObjectResolver over local Windows named pipes without enforcing a strict type allow-list. Because the named pipes use predictable identifiers, any local process running under the same Windows user session can connect to the endpoint and transmit crafted serialized payloads, resulting in arbitrary Common Language Runtime (CLR) type instantiation and code execution within the host Visual Studio process.
Metalama is an open-source, Roslyn-based meta-programming, aspect-oriented programming, and architecture validation framework for C#. To provide real-time design-time feedback, interactive code transformations, live diagnostic updates, and CodeLens summaries without blocking the primary user interface thread, Metalama utilizes a multi-process architecture inside Microsoft Visual Studio. This architecture coordinates state across the main Visual Studio process (devenv.exe), the out-of-process Roslyn code-analysis service (ServiceHub.RoslynCodeAnalysisService.exe), and dedicated CodeLens worker processes.
Inter-process communication (IPC) among these components is conducted over local Windows named pipes. The named pipe endpoints follow a deterministic naming convention: Metalama_{role}_{processId}_{hash(PackageVersion)}. Because process identifiers and installed package version hashes can be enumerated or computed by any process executing on the host, the IPC channel endpoints are predictable and discoverable to local processes.
CVE-2026-62848 (tracked as GHSA-h26j-4vp7-x9w2) stems from the deserialization of untrusted data (CWE-502) and improper control of dynamically-managed code resources (CWE-913) across these named pipe channels. Prior to the remediated versions, the RPC endpoints deserialized incoming polymorphic messages without restricting the instantiated Common Language Runtime (CLR) types against an explicit allow-list.
Any local process operating within the same logged-in Windows user session can open a client handle to the active named pipe and write arbitrary serialized objects to the wire. Because type resolution and object instantiation occur during deserialization—prior to application-level message validation—an attacker can trigger standard .NET deserialization gadget chains to execute arbitrary code inside the Visual Studio host process.
The underlying vulnerability manifests through two distinct serialization mechanisms depending on the Metalama release branch. Both mechanisms share the same architectural flaw: enabling dynamic polymorphic type resolution from wire metadata across an untrusted local IPC boundary without per-type validation.
In Metalama versions 2023.0 through 2026.0.x, the design-time RPC pipeline relied on Newtonsoft.Json configured with TypeNameHandling = TypeNameHandling.All. This setting instructs the JSON deserializer to read the $type metadata property from incoming JSON objects and resolve the specified CLR type dynamically. Although Metalama implemented a custom JsonSerializationBinder inheriting from DefaultSerializationBinder, the binder only performed coarse assembly-level mapping and validation rather than enforcing a per-type allow-list. Crucially, the binder permitted core runtime assemblies, including System.Private.CoreLib and mscorlib. In JsonSerializationBinder.BindToType(string? assemblyName, string typeName), the code called assembly.GetType(modifiedTypeName) and returned the resulting Type directly, allowing attackers to instantiate any type residing in preloaded system assemblies.
In the 2026.1.0 through 2026.1.18 release branch, Metalama migrated its IPC transport to StreamJsonRpc backed by MessagePack serialization to improve throughput. To handle polymorphic payloads within the RpcEventEnvelope.Data property (typed as the abstract base class RpcEventData), BaseEndpoint configured MessagePackSerializerOptions with TypelessObjectResolver.Instance:
internal static MessagePackSerializerOptions MessagePackOptions { get; } =
MessagePackSerializerOptions.Standard.WithResolver(
CompositeResolver.Create(
TypelessObjectResolver.Instance,
StandardResolver.Instance ) );TypelessObjectResolver embeds the fully-qualified CLR type name directly into the binary MessagePack stream and invokes MessagePackSerializerOptions.LoadType(string typeName) during deserialization. Similar to .NET's deprecated BinaryFormatter and Newtonsoft's TypeNameHandling.All, TypelessObjectResolver without a custom LoadType filter permits the caller to specify and instantiate arbitrary CLR types from any loaded assembly.
> [!NOTE]
> Standalone command-line builds (dotnet build or msbuild) and standalone PostSharp versions prior to Metalama unification do not initialize the design-time named-pipe server and are unaffected by this vulnerability.
The remediation was implemented in Pull Request #1651 across two primary commits: d97f52e1b53ffe4176b2b05c56ffdf1ccd2f53a9 for the 2026.1 MessagePack implementation, and 5b4ced29f2b25631cc2e44d05b0fd5fe838b6cbe as a backport for the 2025.1 and 2026.0 Newtonsoft.Json branches.
d97f52e1b53ffe4176b2b05c56ffdf1ccd2f53a9)To secure the MessagePack pipeline in 2026.1, the patch wraps the standard serializer options in a custom RpcContractMessagePackOptions class within BaseEndpoint.cs:
internal static MessagePackSerializerOptions MessagePackOptions { get; } =
new RpcContractMessagePackOptions(
MessagePackSerializerOptions.Standard.WithResolver(
CompositeResolver.Create(
TypelessObjectResolver.Instance,
StandardResolver.Instance ) ) );RpcContractMessagePackOptions overrides the LoadType method and inspects the target Type for an explicit [RpcContract] attribute before allowing deserialization to proceed:
internal sealed class RpcContractMessagePackOptions : MessagePackSerializerOptions
{
private readonly ConcurrentDictionary<Type, bool> _isAllowedCache = new();
public RpcContractMessagePackOptions( MessagePackSerializerOptions copyFrom ) : base( copyFrom ) { }
protected override MessagePackSerializerOptions Clone() => new RpcContractMessagePackOptions( this );
public override Type LoadType( string typeName )
{
var type = base.LoadType( typeName );
// Verify the resolved type is explicitly marked with [RpcContractAttribute]
if ( type != null && !this.IsAllowed( type ) )
{
throw new MessagePackSerializationException(
$"For security reasons, the type '{type.FullName}' cannot be deserialized over the design-time RPC channel "
+ $"because it is not marked with [{nameof(RpcContractAttribute)}]." );
}
return type;
}
private bool IsAllowed( Type type )
=> this._isAllowedCache.GetOrAdd( type, static t => t.GetCustomAttribute<RpcContractAttribute>( inherit: false ) != null );
}5b4ced29f2b25631cc2e44d05b0fd5fe838b6cbe)For the branches using Newtonsoft.Json, the patch introduced JsonSerializationAllowList and modified JsonSerializationBinder.BindToType to enforce strict per-type validation at the deserialization boundary:
public override Type BindToType( string? assemblyName, string typeName )
{
var type = assembly.GetType( modifiedTypeName );
// SECURITY (#1651 / GHSA-h26j-4vp7-x9w2): Enforce per-type allow-list here at the untrusted boundary
if ( type != null && !this._allowList.IsAllowed( type ) )
{
throw new InvalidOperationException(
$"For security reasons, the type '{type.FullName}' from assembly '{assemblyName}' cannot be deserialized "
+ "over the design-time RPC channel because it is not on the RPC type allow-list. See issue #1651." );
}
return type;
}The JsonSerializationAllowList restricts instantiation exclusively to primitive scalars (int, bool, long, double, string), enumerations, validated generic collections (ImmutableArray<>, ImmutableDictionary<,> with recursive checks on generic type arguments), and a static registry of known RPC data transfer objects (ProjectKey, RpcEventEnvelope, RpcEventData, CompilationResultChangedEventData, EndpointChangedEventData, AspectDatabaseAspectInstance, CodeLensSummary, DiagnosticData, and SerializableSyntaxTree).
Both patches intercept type resolution prior to object allocation and constructor invocation. By requiring inherit: false on RpcContractAttribute in the MessagePack implementation and enforcing recursive generic type argument validation in JsonSerializationAllowList, the fixes prevent attackers from leveraging derived classes or wrapping gadget types inside generic collection containers.
Exploiting CVE-2026-62848 requires local code execution within the same Windows user session as a running Visual Studio instance that has a vulnerable version of Metalama loaded. Default Windows named pipe Access Control Lists (ACLs) permit read/write operations from any process sharing the creator's security token. Consequently, a low-integrity or sandboxed background script, malicious npm/NuGet post-install hook, or compromised utility process can target devenv.exe.
To execute the attack, the local process enumerates active named pipes matching \\.\pipe\Metalama_* (or calculates the pipe name directly from the target PID and package version hash) and connects as a client.
In the Newtonsoft.Json attack path (2023.0 – 2026.0.x), the attacker sends a JSON-RPC message containing a $type directive pointing to a known .NET deserialization gadget, such as System.Configuration.Install.AssemblyInstaller or System.Windows.Data.ObjectDataProvider:
{
"$type": "System.Configuration.Install.AssemblyInstaller, System.Configuration.Install",
"Path": "C:\\Users\\Public\\payload.dll"
}In the MessagePack attack path (2026.1.0 – 2026.1.18), the attacker constructs a StreamJsonRpc frame containing an RpcEventEnvelope whose polymorphic Data field uses the MessagePack ext type code reserved by TypelessObjectResolver to specify the assembly-qualified name of the gadget class. When the endpoint deserializes the frame, LoadType resolves the target class and populates its properties or invokes its deserialization constructors.
The patch commits include regression tests in RpcSerializationTests.cs and JsonRpcSerializationTests.cs that model this exact exploitation primitive by serializing an off-contract class (OffContractGadget) through an untyped object reference to force polymorphic type metadata emission:
[Fact]
public void OffContractType_RejectedOnDeserialize()
{
// Models an attacker-chosen gadget: a type NOT on the allow-list,
// serialized through the object path so its $type is written.
var json = JsonConvert.SerializeObject( new OffContractGadget(), typeof(object), _settings );
AssertRejectedByAllowList( () => JsonConvert.DeserializeObject<object>( json, _settings ) );
}CVE-2026-62848 is assigned a CVSS v3.1 base score of 7.3 (High) with the vector CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H. The Attack Vector (AV:L) and Privileges Required (PR:L) reflect that the attacker must already possess local execution capabilities under the user's account. User Interaction (UI:R) is required because the victim user must actively run Visual Studio with a Metalama-enabled project or extension loaded for the named pipe listener to be instantiated.
Although the Scope is Unchanged (S:U) because Windows named pipe ACLs restrict access to the current user session, compromising the Visual Studio process (devenv.exe) or its Roslyn analysis worker carries significant operational impact:
devenv.exe and ServiceHub.RoslynCodeAnalysisService.exe are trusted developer binaries that routinely compile code, spawn child processes, read source repositories, and make outbound network requests. Executing arbitrary code inside devenv.exe allows an attacker to bypass application allow-listing rules or Endpoint Detection and Response (EDR) behavioral heuristics.devenv.exe memory space can extract these credentials directly.At the time of writing, the EPSS score for CVE-2026-62848 is 0.00186 (0.19%), placing it in the 8.31st percentile, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.
Addressing CVE-2026-62848 requires updating both project-level NuGet dependencies and installed Visual Studio IDE extensions to ensure all local IPC endpoints enforce strict type allow-listing.
Update all Metalama.* NuGet packages in affected repositories to the patched release corresponding to your active release branch:
2025.1.18 or later.2026.0.25 or later.2026.1.19 or later.2025.2.0-preview through 2025.2.5-rc range are unsupported and must be migrated to a patched 2026.0 or 2026.1 release.Because the Visual Studio extension hosts the design-time RPC endpoints inside devenv.exe, updating NuGet packages alone is insufficient if an outdated IDE extension remains installed:
2026.1.5 or later via the Visual Studio Extension Manager or Marketplace.> [!WARNING]
> Developer workstations that have opened legacy projects using vulnerable versions of Metalama may have cached design-time worker binaries. After updating packages and extensions, restart all devenv.exe and ServiceHub.RoslynCodeAnalysisService.exe processes to ensure unpatched named pipe listeners are terminated.
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
Metalama Framework PostSharp Technologies / Metalama | >= 2023.0.101-rc, < 2025.1.18 | 2025.1.18 |
Metalama Framework PostSharp Technologies / Metalama | >= 2025.2.0-preview, <= 2025.2.5-rc | 2026.0.25 |
Metalama Framework PostSharp Technologies / Metalama | >= 2026.0.0-preview, < 2026.0.25 | 2026.0.25 |
Metalama Framework PostSharp Technologies / Metalama | >= 2026.1.0-preview, < 2026.1.19 | 2026.1.19 |
Metalama + PostSharp Visual Studio Extension PostSharp Technologies / Metalama | >= 2024.1, <= 2026.1.4 | 2026.1.5 |
| Attribute | Detail |
|---|---|
| Vulnerability Type | Deserialization of Untrusted Data (CWE-502 / CWE-913) |
| Attack Vector | Local Windows Named Pipe IPC (AV:L) |
| CVSS v3.1 Score | 7.3 High (CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H) |
| EPSS Score | 0.19% (8.31st Percentile) |
| Security Impact | Arbitrary Code Execution within Visual Studio (devenv.exe) |
| Vulnerable Components | JsonSerializationBinder (Newtonsoft.Json) & BaseEndpoint (MessagePack) |
| CISA KEV Status | Not Listed |
The application deserializes untrusted input without sufficiently verifying that the resulting data will be valid or safe, allowing an adversary to manipulate serialized objects and pass arbitrary classes into the execution environment.
CVE-2026-28385 (GHSA-3gq2-x4qg-p4g6) is a Server-Side Request Forgery (SSRF) vulnerability in Canonical LXD versions 4.12 through 6.9. An authenticated user possessing the can_create_images entitlement can force the LXD daemon to execute arbitrary outbound HTTP and HTTPS requests via the /1.0/images API endpoint. Due to the absence of egress destination validation, an attacker can probe host loopback services, RFC 1918 private network segments, and cloud Instance Metadata Services (IMDS) from the network position of the privileged LXD daemon.
Canonical LXD and LXC Incus contain an arbitrary file write vulnerability (CWE-73 / CWE-59) in the `/1.0/instances/<name>/exec` REST API endpoint. When an instance is unpacked from an image archive, top-level symbolic links are extracted directly onto the host filesystem within the instance storage directory. If a crafted image includes a symbolic link named `exec-output` pointing to an arbitrary host path, invoking the execution endpoint with `record-output: true` causes the privileged host daemon to follow the symlink and write command output files directly to the target host directory. An authenticated attacker with permissions to import images and execute commands can exploit this flaw to write controlled content to sensitive host directories such as `/etc/cron.d`, resulting in arbitrary code execution on the host as `root`.
CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.
GHSA-fmc8-p6q7-75cc (associated with CVE-2026-48755) is a critical argument injection vulnerability in Canonical LXD (github.com/canonical/lxd). The vulnerability occurs during instance and storage volume backup operations when processing the user-supplied compression_algorithm configuration parameter. While LXD validates the primary executable token against an allowlist of supported compression binaries, it fails to sanitize or restrict subsequent tokens parsed via shellquote.Split. These additional arguments are passed directly to exec.Command. An authenticated attacker with privileges to trigger backups can inject command-line flags for utilities like zstd to read staged files from a container filesystem and write them to arbitrary paths on the underlying host filesystem, such as /etc/cron.d/, achieving root-level arbitrary code execution on the host.
A critical path traversal vulnerability caused by improper input validation (CWE-20) exists in the direct image download handler of Canonical LXD and Linux Containers Incus. When an authenticated user requests an image import using the URL source type, the daemon reads the image fingerprint from an untrusted HTTP response header (`Incus-Image-Hash` or `LXD-Image-Hash`) without validating that it conforms to a SHA-256 format. This unvalidated string is concatenated directly into a filesystem path via `filepath.Join` prior to file creation and cryptographic verification, allowing directory traversal sequences to write arbitrary files on the host filesystem as root.
CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.