Public research

DynamicExpresso

GHSA-5jx8-p6q2-455g
`LateBindObject` reflection-restriction bypass

High, 8.8 · Public source snapshot: November 12, 2026

Original portfolio report · Public advisory

Shared credits and the scope of my investigation are documented below.

GHSA-5jx8-p6q2-455g · DynamicExpresso · High

Public security research by Charles Vosburgh (the-vibe-dev).

Field Value
Package DynamicExpresso.Core
Ecosystem NuGet / .NET
Severity High
CVSS 8.8 — CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Public affected version 2.19.3
Fixed 2.19.4 source; 2.19.5 is the first fixed NuGet package independently verified and maps to the same commit
Weakness CWE-470 / CWE-693 — unsafe reflection / protection-mechanism failure
Public PoC Yes — published with the GHSA
Credit Charles Vosburgh (the-vibe-dev) — discoverer and reporter

DynamicExpresso is designed to evaluate C#-style expressions while blocking sensitive reflection APIs unless the host explicitly calls EnableReflection(). In version 2.19.3, enabling the separate LateBindObject option created a path around that restriction.

A value of runtime type System.Type could be cast to static type object. From that point, member access was emitted as dynamic call sites rather than the normal statically typed expression nodes inspected by DisableReflectionVisitor. The late-bound runtime binder then resolved reflection-sensitive members without applying DynamicExpresso's reflection policy.

Under the published prerequisites, an attacker-controlled expression could walk from a default registered type into assembly/type APIs, instantiate System.Diagnostics.Process, and execute a command in the host process context.

This is an expression-evaluator primitive, not a built-in remote endpoint. Remote reachability depends on a consuming application accepting attacker-controlled expression text.

Security invariant: Restricted capabilities must remain restricted when a value crosses from static expression typing into dynamic or late-bound dispatch.

The published path assumes a consuming application that:

  • accepts less-trusted DynamicExpresso expression text;
  • enables InterpreterOptions.LateBindObject;
  • retains the default primitive/type registrations;
  • provides a writable object parameter or an equivalent path into late binding;
  • permits assignment operators; and
  • has not explicitly enabled reflection.

The expected security property is that LateBindObject changes member-resolution convenience, not the evaluator's reflection security policy.

DynamicExpresso 2.19.3 installs DisableReflectionVisitor unless reflection is explicitly enabled. That visitor rejects ordinary expression-tree members involving System.Type or System.Reflection.MemberInfo, subject to narrow documented exceptions.

A direct expression such as:

typeof(string).Assembly

is therefore blocked and serves as a useful negative control.

The behavior changes when the same runtime value is first cast to object:

((object)typeof(string)).Assembly

With LateBindObject enabled, Parser.cs recognizes the statically typed object receiver and emits Expression.Dynamic nodes using late-binding call-site binders. Dynamic member access goes through LateGetMemberCallSiteBinder; dynamic invocation uses LateInvokeMethodCallSiteBinder.

In vulnerable 2.19.3, the implementations in Resolution/LateBinders.cs pass the runtime object to Microsoft's C# runtime binder without applying the same reflection restriction enforced by DisableReflectionVisitor.

The security consequence is subtle but fundamental: casting does not change the runtime object's authority. The value is still a System.Type; only its expression-tree representation changed. The static visitor no longer sees the sensitive member expression, while the dynamic binder resolves it at runtime.

Exploit chain

The public PoC uses the bypass to traverse from a normally available type object through reflection-sensitive members. Once the evaluator can reach assembly/type facilities that should have been gated behind EnableReflection(), the expression can obtain the process assembly, resolve System.Diagnostics.Process, instantiate it, and start a benign marker command.

The important result is not the specific command string. It is that an evaluator configuration intended to have reflection disabled can reach a host capability that the documented policy says should require an explicit reflection opt-in.

DynamicExpresso had two dispatch paths with different security semantics:

  1. statically typed member/method nodes passed through the reflection-denial visitor;
  2. dynamic call-site binders created for LateBindObject did not enforce the same restriction.

The reflection policy therefore depended on the representation of the operation rather than the runtime capability being accessed.

This is a common policy-bypass pattern in interpreters: the main AST path is guarded, but an alternate dynamic dispatch mechanism reaches the same sensitive sink outside the visitor or checker.

flowchart TD
    A[Application evaluates attacker-controlled expression]
    B[LateBindObject is enabled while reflection remains disabled]
    C[Runtime System.Type value is cast to object]
    D[Member access becomes Expression.Dynamic]
    E[Late binder resolves reflection-sensitive members without reflection guard]
    F[Expression reaches process-execution capability]
    G[Marker command runs with host-process authority]
    A --> B --> C --> D --> E --> F --> G

The PoC is public in GHSA-5jx8-p6q2-455g and is not duplicated as a separate artifact in this repository.

The publication-safe reproduction uses a benign command marker. It verifies both sides of the boundary:

  • a direct reflection-sensitive expression is blocked when reflection is disabled;
  • the equivalent runtime value accessed through the 2.19.3 late-bound path reaches the marker;
  • benign late binding remains functional in the fixed version;
  • explicit reflection still works when the host intentionally opts into it.

The public PoC was executed against the exact DynamicExpresso.Core 2.19.3 package. The fixed behavior was independently checked using DynamicExpresso.Core 2.19.5, whose repository metadata maps to the same code commit as the 2.19.4 and 2.19.5 tags.

GitHub's public advisory deliberately scopes the affected package range to:

2.19.3

and identifies:

2.19.4

as patched.

The LateBindObject feature itself is older. Public history traces its introduction to:

4aabda0330d7f003c4e893008b560abaf7c305ea

in v2.8.0. That history is implementation lineage, not an expanded affected-version claim. Earlier packages were not independently runtime-assessed for this published advisory.

The fixing commit is:

23f7c3ee9e348a46c969190379597092033a8bd5

The v2.19.4 and v2.19.5 Git tags resolve to the same commit. The project states that 2.19.5 republishes the same code because of a NuGet issue. A 2.19.4 NuGet artifact was not available during verification, so the first fixed package independently executed here was 2.19.5, while 2.19.4 remains the verified fixed source release and the publisher's patched version.

When the prerequisites are present, attacker-controlled expression text can escape DynamicExpresso's reflection restriction and reach command execution with the privileges of the hosting .NET process.

That can expose files, credentials, environment data, network access, and other application resources available to that process. The actual remote attack surface is determined by the integrating application; DynamicExpresso itself does not expose a network listener.

The public advisory rates the issue High, CVSS 8.8.

Upgrade to DynamicExpresso 2.19.4 or later. For NuGet consumers, use a currently available fixed package such as 2.19.5 or newer.

The essential fix is to enforce reflection policy inside late-binding resolution itself rather than assuming the static expression visitor sees every sensitive access. Any future alternate dispatch mechanism should apply the same capability checks.

Regression coverage should combine:

  • reflection disabled + direct System.Type access — must fail;
  • reflection disabled + object cast + late binding — must also fail;
  • ordinary non-sensitive late binding — should continue to work;
  • reflection explicitly enabled — documented reflection behavior should continue to work;
  • dynamic method calls as well as dynamic property/member reads.
Date Event
2026-08-20 GHSA-5jx8-p6q2-455g and the public PoC published.
2026-08 2.19.4 source fix published; 2.19.5 republished the same code for NuGet availability.
2026-08-26 Public source, package metadata, vulnerable PoC, and fixed controls reviewed.

GHSA-5jx8-p6q2-455g is a policy-consistency failure in DynamicExpresso's expression evaluation. Reflection restrictions applied to normal statically typed expression nodes but could be bypassed when LateBindObject changed the same runtime access into a dynamic call site.

The key issue was not that System.Type suddenly became safe after a cast to object; it was that the security policy stopped following the value when dispatch moved to a different implementation path.

Broader lesson: Interpreter security controls must be capability-based and representation-independent. Static, dynamic, late-bound, reflective, and proxy dispatch paths should not disagree about whether the same operation is permitted.

  • https://github.com/dynamicexpresso/DynamicExpresso/security/advisories/GHSA-5jx8-p6q2-455g

Charles Vosburgh (the-vibe-dev) — discoverer and publicly credited reporter.

Research was AI-assisted for source mapping, hypothesis generation, release comparison, and evidence organization. I performed the final validation, disclosure coordination, severity calibration, and publication review.

This write-up documents a publicly disclosed vulnerability for defensive research, remediation, regression testing, and authorized assessment. Do not use the public PoC against systems without explicit permission.