CVE-2021-46703: Code injection in RazorEngine
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.79253%
CWE
-
Published
3/7/2022
Updated
2/3/2023
KEV Status
No
Technology
C#
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| RazorEngine | nuget | <= 4.5.1-alpha001 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from two key factors: 1) The IsolatedRazorEngineService's reliance on deprecated CAS mechanisms for sandboxing, which Microsoft explicitly states should not be considered secure. 2) The RazorDynamicObject.Create method's ability to compile and execute arbitrary expressions through dynamic object manipulation. The provided PoC in GitHub issue #585 demonstrates how combining these features allows writing files to disk via malicious templates. While the exact file paths are inferred from standard RazorEngine structure, the functional relationships are clearly established through the vulnerability description and test case.