CVE-2021-46703
C# vulnerability analysis and mitigation

Overview

In the IsolatedRazorEngine component of Antaris RazorEngine through version 4.5.1-alpha001, an attacker can execute arbitrary .NET code in a sandboxed environment when users can externally control template contents. This vulnerability was discovered in March 2022 and affects products that are no longer supported by the maintainer (NVD, MITRE).

Technical details

The vulnerability exists in the IsolatedRazorEngineService component which uses Code Access Security (CAS) internally. The security issue arises because CAS has been obsoleted and is no longer supported on latest platform updates (.NET 5/6 / .Net Core). Additionally, Microsoft will no longer provide patches for security issues related to CAS. The vulnerability can be exploited through template manipulation using dynamic code execution and RazorDynamicObject (GitHub Issue). The CVSS v3.1 base score is 9.8 CRITICAL (Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) (NVD).

Impact

When successfully exploited, this vulnerability allows attackers to execute arbitrary .NET code within the sandboxed environment. This could potentially lead to unauthorized code execution and compromise of the affected system's security boundaries (NVD).

Mitigation and workarounds

Users depending on IsolatedRazorEngineService for security are urged to redesign their security approach. A temporary fix involves applying a patch that disables 'dynamic' functionality, but this is not a long-term solution. The maintainers recommend against using string concatenation with untrusted user inputs in templates and suggest using @ Syntax-Elements instead (GitHub Issue).

Additional resources


SourceThis report was generated using AI

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management