GitHub Enterprise — 1 vulnerability check
noctis ships 1 vulnerability check for GitHub Enterprise, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
GitHub Enterprise 2.8.x < 2.8.7 Management Console shared cookie secret
| CVE | CVE-2017-18365 |
|---|---|
| Severity | critical · CVSS 9.8 |
| Category | rce — Remote code execution |
| Services | http, https |
| Detection | set_var, tcp_connect, script, match · highest QoD 70 |
| Feed | tests/vulnerabilities/github-enterprise/CVE-2017-18365.yaml |
Detects GitHub Enterprise appliances (2.8.0 to 2.8.6) whose Management Console signs its _gh_manage session cookie with a secret shared by every appliance of those releases. The feed requests /setup/unlock, reads the _gh_manage cookie issued by the console and recomputes its HMAC-SHA1 signature with the shared secret. A matching signature means anyone can forge console session cookies, which leads to remote command execution. The feed only reads a cookie the server hands out; it forges no cookie and runs no command. Fixed releases use a per-appliance secret and are not reported.
How noctis detects it
- Raw TCP (TLS on HTTPS), sent verbatim:
GET /setup/unlock HTTP/1.0 - Parses / computes the next value with a Rhai script
- Checks
gh.knownfor^true$→ finding QoD 70: GitHub Enterprise Management Console signs cookies with the shared secret (CVE-2017-18365)
References:
Feed source — tests/vulnerabilities/github-enterprise/CVE-2017-18365.yaml
# GitHub Enterprise 2.8.x < 2.8.7 Management Console hardcoded session secret — CVE-2017-18365
#
# The Management Console (/setup) signs its _gh_manage session cookie with HMAC-SHA1 and a
# secret that is the same on every 2.8.0-2.8.6 appliance. Anyone who knows that secret can
# forge a cookie carrying a serialized Ruby object, which is how the remote code execution
# works (fixed in 2.8.7 by a per-appliance secret).
#
# This feed never forges a cookie and sends nothing but a GET: it requests /setup/unlock,
# takes the _gh_manage cookie the console issues itself and checks whether its signature
# is the HMAC-SHA1 of the cookie data under the published secret. A match proves the
# appliance uses the shared secret and is therefore exposed. Version/secret fingerprint
# only (the code execution is not triggered): QoD 70.
uid: 4e72c447-f7dd-4565-823d-dd8810d46410
name: "GitHub Enterprise 2.8.x < 2.8.7 Management Console shared cookie secret (CVE-2017-18365)"
description: |
Detects GitHub Enterprise appliances (2.8.0 to 2.8.6) whose Management Console signs its
_gh_manage session cookie with a secret shared by every appliance of those releases.
The feed requests /setup/unlock, reads the _gh_manage cookie issued by the console and
recomputes its HMAC-SHA1 signature with the shared secret. A matching signature means
anyone can forge console session cookies, which leads to remote command execution.
The feed only reads a cookie the server hands out; it forges no cookie and runs no command.
Fixed releases use a per-appliance secret and are not reported.
category: rce
cves: [CVE-2017-18365]
cvss: 9.8
severity: critical
confidence_base: 0.30
tags: [github-enterprise, management-console, hardcoded-secret, cookie-signing, version]
services: [http, https]
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2017-18365"
- "https://enterprise.github.com/releases/2.8.7/notes"
steps:
- id: init-probe
action: set_var
var_name: probe
var_value: {connected: false, banner: ""}
- id: probe
action: tcp_connect
port: "{{port}}"
send: "GET /setup/unlock HTTP/1.0\r\nHost: {{target_host}}\r\nConnection: close\r\n\r\n"
timeout_secs: 10
store_as: probe
- id: check-signature
action: script
store_as: gh
code: |
let out = #{ ok: false, known: false };
let b = "";
if probe.connected == true && type_of(probe.banner) == "string" { b = probe.banner; }
let c = eregmatch("(?i)set-cookie:\\s*_gh_manage=([^;\\s]+)", b);
if c.len() > 1 {
let v = c[1];
v = ereg_replace("(?i)%3D", "=", v);
v = ereg_replace("(?i)%2B", "+", v);
v = ereg_replace("(?i)%2F", "/", v);
v = ereg_replace("(?i)%0A", "", v);
v = ereg_replace("(?i)%0D", "", v);
let p = eregmatch("^(.+)--([0-9a-f]{40})$", v);
if p.len() > 2 {
out.ok = true;
let sig = hmac_sha1_hex(hexstr("641dd6454584ddabfed6342cc66281fb"), hexstr(p[1]));
out.known = (sig == p[2]);
}
}
out
- id: shared-secret
action: match
source: gh.known
pattern: "^true$"
condition: "gh.ok == true && gh.known == true"
on_match:
finding:
confidence_delta: 0.40
qod: 70
title: "GitHub Enterprise Management Console signs cookies with the shared secret (CVE-2017-18365)"
description: "The _gh_manage cookie issued by /setup/unlock carries an HMAC-SHA1 signature that matches the secret shared by GitHub Enterprise 2.8.0 to 2.8.6. Session cookies of the Management Console can be forged, which allows remote command execution."
remediation: "Upgrade GitHub Enterprise to 2.8.7 or later."
evidence: "_gh_manage signature verified with the shared secret on port {{port}}"