diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b8922e..32ef010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,23 @@ fields, and state from an older version is read by a newer one. There are no git tags. The hash next to a version is the commit that introduced it; the current entry is the commit that adds this section. -## 1.55.0 — 2026-11-23 — this change +## 1.56.0 — 2026-11-23 — this change + +- **Webmin** (`webmin_audit`): `miniserv.conf`: `ssl=0`, an allow list + covering every address, an empty or default password and a world-writable + file. +- **Cockpit** (`cockpit_audit`): `cockpit.conf`: `AllowUnencrypted = true`, a + missing `Origins` allow-list and a world-writable file. +- **phpMyAdmin** (`phpmyadmin_audit`): `config.inc.php`: a short or empty + blowfish secret, `AllowNoPassword = true`, `auth_type = config` and a + world-writable file. +- **MinIO admin** (`minio_admin_probe`): `/minio/health/live` and + `/minio/admin/v3/info` without a signature; a 2xx admin answer is unsigned + admin access, saved as evidence. +- Tests with Webmin/Cockpit/phpMyAdmin trees and two MinIO fixtures (unsigned + admin and 403). 1132 checks. Coverage 83.8%. + +## 1.55.0 — 2026-11-23 — 5611c5f - **GitLab** (`gitlab_audit`): `gitlab.rb`: an HTTP `external_url`, no `redirect_http_to_https`, open signup, disabled Let's Encrypt and a diff --git a/README.md b/README.md index 3c77fd9..f80eb97 100644 --- a/README.md +++ b/README.md @@ -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. -**258 tools · 1120 end-to-end checks · 340 fuzz cases · 83.7% line coverage · ~917 KiB** +**262 tools · 1132 end-to-end checks · 340 fuzz cases · 83.8% line coverage · ~925 KiB** ``` $ ./apex-twin --check -{"version":"1.55.0","tools":258,...,"scope":{"loaded":true,...}} +{"version":"1.56.0","tools":262,...,"scope":{"loaded":true,...}} ``` APEX TWIN was inspired by [ARTEX](https://github.com/Autumn-27/artex) (scope @@ -149,7 +149,7 @@ closes a request whose head or body does not arrive within --- -## Tools (258) +## Tools (262) ### Scope and bookkeeping @@ -214,6 +214,7 @@ uploads and secret-file reads. It does not execute anything. | `prometheus_api_probe` | `/-/ready` and `/api/v1/query` without auth; query answer as evidence | | `rabbitmq_management_probe` | `/api/overview` and `/api/queues` without auth; overview as evidence | | `grafana_api_probe` | `/api/datasources` and `/api/admin/users` without auth; datasources as evidence | +| `minio_admin_probe` | `/minio/admin/v3/info` without a signature; admin answer as evidence | | `cookie_audit` | Secure/HttpOnly/SameSite per cookie, incl. `SameSite=None` without Secure | | `http_options` | `Allow`/`Public`; flags TRACE, PUT, DELETE | | `sqli_probe` | Quote and boolean payloads; differing answers are a **lead**, not proof | @@ -455,6 +456,9 @@ command in the allowlist: a receiver is a scanner, a transmitter is an attack. | `gitlab_audit` | gitlab.rb: HTTP URL, no redirect, open signup | | `vaultwarden_audit` | env: open signups, default admin token, HTTP domain | | `keepalived_audit` | VRRP: `auth_type PASS`, default password, shell notify | +| `webmin_audit` | miniserv.conf: ssl=0, wildcard allow, weak password | +| `cockpit_audit` | cockpit.conf: AllowUnencrypted, missing Origins | +| `phpmyadmin_audit` | config.inc.php: empty blowfish secret, config auth | ### ESP32 @@ -753,6 +757,8 @@ The full threat model, trust boundaries and a hardening checklist are in | RabbitMQ API | two unauthenticated GETs, overview as evidence | | gitlab/vaultwarden/keepalived | config reads only; optional root prefix | | Grafana API | three unauthenticated GETs, datasources as evidence | +| webmin/cockpit/phpmyadmin | config reads only; optional root prefix | +| MinIO admin API | two unauthenticated GETs, admin answer as evidence | | USB audit | 200 devices, sysfs reads only | --- @@ -764,7 +770,7 @@ Flags are fixed: `-std=c99 -Wall -Wextra -Wpedantic -Werror` plus ```sh make # apex-twin -make test # version check + gate audit + 1120 end-to-end checks +make test # version check + gate audit + 1132 end-to-end checks make version-check # the five places that carry a version must agree make gate-audit # static: every target-taking tool calls the gate make asan # apex-twin-asan with ASan + UBSan @@ -891,7 +897,8 @@ src/tools_red.c vuln_check, subdomain_enum, cred_test, vhost_discovery, zookeeper_4lw_probe, etcd_api_probe, docker_registry_probe, consul_api_probe, couchdb_probe, prometheus_api_probe, - rabbitmq_management_probe, grafana_api_probe + rabbitmq_management_probe, grafana_api_probe, + minio_admin_probe src/tools_blue.c hardening_audit, log_audit, ioc_scan, web_log_audit, detect_rules, integrity_baseline, mitre_map, process_snapshot, persistence_audit, net_baseline, @@ -934,7 +941,7 @@ examples/ scope.json ## Status -1.55.0. Built and run: 258 tools, 1120 checks, 340 fuzz cases and 83.7% line +1.56.0. Built and run: 262 tools, 1132 checks, 340 fuzz cases and 83.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 diff --git a/SECURITY.md b/SECURITY.md index b580de3..c25510e 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -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.55.x** (`src/apex.h`, `APEX_VERSION`). Security fixes land on the current +is **1.56.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. @@ -66,6 +66,8 @@ only narrow what the proxy does (the scope gate still runs first). - **Firmware writing needs an explicit confirmation.** `esp_flash` refuses without `confirm=true`, validates an absolute image path and audits the attempt; it exists to provision the operator's own board. +- **Webmin, Cockpit and phpMyAdmin audits read local files.** The MinIO + probe sends two unauthenticated GETs and saves the admin answer. - **GitLab, Vaultwarden and keepalived audits read local files.** The Grafana probe sends three unauthenticated GETs and saves the datasource list. - **Zabbix, NRPE and unattended-upgrades audits read local files.** The diff --git a/docs/apex-twin.1 b/docs/apex-twin.1 index 2c2202a..8ccc529 100644 --- a/docs/apex-twin.1 +++ b/docs/apex-twin.1 @@ -1,5 +1,5 @@ .\" apex-twin.1 - manual page for APEX TWIN -.TH APEX-TWIN 1 "2026-11-21" "apex-twin 1.55.0" "User Commands" +.TH APEX-TWIN 1 "2026-11-21" "apex-twin 1.56.0" "User Commands" .SH NAME apex-twin \- scope\-gated offensive\-security MCP server .SH SYNOPSIS @@ -46,7 +46,7 @@ sip_probe, telnet_probe, http_methods, websocket_probe, ike_probe, snmp_walk, ldap_search, openapi_discovery, csrf_audit, rpc_probe, ntp_probe, dnssec_check, smtp_starttls_probe, tls_ocsp_probe, alpn_probe, webdav_probe, dns_wildcard_check, dns_caa_check, sni_vhost_check, tls_client_auth_probe, kubernetes_api_probe, dns_ns_consistency, dns_dangling_cname, http_redirect_audit, websocket_origin_check, dns_fcrdns_check, dns_soa_mname_check, http_redirect_audit, -websocket_origin_check, hsts_audit, tls_hostname_check, ftp_tls_probe, zookeeper_4lw_probe, etcd_api_probe, docker_registry_probe, consul_api_probe, couchdb_probe, prometheus_api_probe, rabbitmq_management_probe, grafana_api_probe), +websocket_origin_check, hsts_audit, tls_hostname_check, ftp_tls_probe, zookeeper_4lw_probe, etcd_api_probe, docker_registry_probe, consul_api_probe, couchdb_probe, prometheus_api_probe, rabbitmq_management_probe, grafana_api_probe, minio_admin_probe), defensive audits (hardening_audit, log_audit, ioc_scan, web_log_audit, detect_rules, integrity_baseline, mitre_map, process_snapshot, persistence_audit, @@ -73,7 +73,7 @@ tftpd_hpa_audit, iscsi_audit, rpcbind_audit, kdump_audit, kafka_audit, powerdns_ varnish_audit, freeradius_audit, containerd_audit, nats_audit, caddy_audit, traefik_audit, autofs_audit, gitea_audit, minio_audit, nextcloud_audit, zabbix_audit, nrpe_audit, unattended_upgrades_audit, gitlab_audit, vaultwarden_audit, -keepalived_audit) +keepalived_audit, webmin_audit, cockpit_audit, phpmyadmin_audit) and ESP32 board tools (esp_info, esp_monitor, esp_read_flash, esp_flash, esp_partition_table, esp_nvs_parse, firmware_scan, esp_app_info, esp_image_verify). diff --git a/src/apex.h b/src/apex.h index ae585b2..80a4046 100644 --- a/src/apex.h +++ b/src/apex.h @@ -15,7 +15,7 @@ #include "mcp.h" -#define APEX_VERSION "1.55.0" +#define APEX_VERSION "1.56.0" #define APEX_MAX_OUT (1u << 20) #define APEX_PATH_MAX 512 #define APEX_PATH_FULL 1024 diff --git a/src/tools_blue.c b/src/tools_blue.c index 2e00ea7..041c72e 100644 --- a/src/tools_blue.c +++ b/src/tools_blue.c @@ -16746,6 +16746,274 @@ static void t_keepalived_audit(mcp_conn *c, const mcp_json *args, mcp_buf_free(&findings); } +/* --------------------------------------------------------------- webmin_audit */ + +static int webmin_allow_all(const char *list) +{ + char copy[512]; + char *save = NULL; + char *tok; + + snprintf(copy, sizeof(copy), "%.500s", list); + tok = strtok_r(copy, ", ", &save); + while (tok != NULL) { + if (strcmp(tok, "0.0.0.0") == 0 || + strcmp(tok, "0.0.0.0/0") == 0 || + strcmp(tok, "::/0") == 0 || strcmp(tok, "*") == 0) + return 1; + tok = strtok_r(NULL, ", ", &save); + } + return 0; +} + +static int webmin_weak_pass(const char *value) +{ + static const char *weak[] = { "admin", "password", "changeme", "webmin", + "secret", "123456", NULL }; + int i; + + for (i = 0; weak[i] != NULL; i++) + if (strcasecmp(value, weak[i]) == 0) + return 1; + return 0; +} + +static void t_webmin_audit(mcp_conn *c, const mcp_json *args, void *user) +{ + const char *root = mcp_arg_string(args, "root"); + char path[1024]; + static char text[65536]; + char ssl[64]; + char allow[256]; + char pass[256]; + struct stat st; + mcp_buf b; + mcp_buf findings; + int first = 1; + int count = 0; + int no_tls = 0; + int allow_any = 0; + int weak_pass = 0; + + (void)user; + if (root == NULL) + root = ""; + if (strlen(root) > 400) { + mcp_reply_error(c, "root path too long"); + return; + } + snprintf(path, sizeof(path), "%s/etc/webmin/miniserv.conf", root); + if (read_text(path, text, sizeof(text)) <= 0) { + mcp_reply_error(c, "cannot read miniserv.conf"); + return; + } + ssl[0] = allow[0] = pass[0] = '\0'; + mcp_buf_init(&findings); + if (stat(path, &st) == 0 && (st.st_mode & 0002) != 0) { + add_finding(&findings, &first, "world-writable", "high", + "miniserv.conf is writable by anyone"); + count++; + } + line_value(text, "ssl", ssl, sizeof(ssl)); + line_value(text, "allow", allow, sizeof(allow)); + line_value(text, "pass", pass, sizeof(pass)); + if (strcmp(ssl, "0") == 0) { + no_tls = 1; + add_finding(&findings, &first, "no-tls", "high", + "Webmin serves over plain HTTP"); + count++; + } + if (webmin_allow_all(allow)) { + allow_any = 1; + add_finding(&findings, &first, "allow-any", "high", + "Webmin accepts connections from every address"); + count++; + } + if (pass[0] == '\0' || webmin_weak_pass(pass)) { + weak_pass = 1; + add_finding(&findings, &first, "weak-password", "high", + "the Webmin password is empty or a known default"); + count++; + } + mcp_buf_init(&b); + mcp_buf_puts(&b, "{\"root\":"); + apex_json_str(&b, root); + mcp_buf_printf(&b, ",\"tls\":%s,\"allow\":", no_tls ? "false" : "true"); + apex_json_str(&b, allow); + mcp_buf_printf(&b, ",\"allow_any\":%s,\"weak_password\":%s," + "\"findings_count\":%d,\"findings\":[", + allow_any ? "true" : "false", + weak_pass ? "true" : "false", count); + if (findings.p != NULL) + mcp_buf_add(&b, findings.p, findings.len); + mcp_buf_puts(&b, "]}"); + mcp_reply_json(c, b.p); + mcp_buf_free(&b); + mcp_buf_free(&findings); +} + +/* -------------------------------------------------------------- cockpit_audit */ + +static void t_cockpit_audit(mcp_conn *c, const mcp_json *args, void *user) +{ + const char *root = mcp_arg_string(args, "root"); + char path[1024]; + static char text[65536]; + char value[64]; + char origins[512]; + struct stat st; + mcp_buf b; + mcp_buf findings; + int first = 1; + int count = 0; + int unencrypted = 0; + int no_origins = 0; + + (void)user; + if (root == NULL) + root = ""; + if (strlen(root) > 400) { + mcp_reply_error(c, "root path too long"); + return; + } + snprintf(path, sizeof(path), "%s/etc/cockpit/cockpit.conf", root); + if (read_text(path, text, sizeof(text)) <= 0) { + mcp_reply_error(c, "cannot read cockpit.conf"); + return; + } + origins[0] = '\0'; + mcp_buf_init(&findings); + if (stat(path, &st) == 0 && (st.st_mode & 0002) != 0) { + add_finding(&findings, &first, "world-writable", "high", + "cockpit.conf is writable by anyone"); + count++; + } + if (ini_value(text, "WebService", "AllowUnencrypted", value, + sizeof(value)) && + strcasecmp(value, "true") == 0) { + unencrypted = 1; + add_finding(&findings, &first, "allow-unencrypted", "high", + "Cockpit accepts unencrypted HTTP connections"); + count++; + } + if (!ini_value(text, "WebService", "Origins", origins, + sizeof(origins)) || + origins[0] == '\0') { + no_origins = 1; + add_finding(&findings, &first, "no-origins", "medium", + "no Origins allow-list is configured"); + count++; + } + mcp_buf_init(&b); + mcp_buf_puts(&b, "{\"root\":"); + apex_json_str(&b, root); + mcp_buf_printf(&b, ",\"unencrypted\":%s,\"origins\":", + unencrypted ? "true" : "false"); + apex_json_str(&b, origins); + mcp_buf_printf(&b, ",\"findings_count\":%d,\"findings\":[", count); + if (findings.p != NULL) + mcp_buf_add(&b, findings.p, findings.len); + mcp_buf_puts(&b, "]}"); + mcp_reply_json(c, b.p); + mcp_buf_free(&b); + mcp_buf_free(&findings); + (void)no_origins; +} + +/* ----------------------------------------------------------- phpmyadmin_audit */ + +static void t_phpmyadmin_audit(mcp_conn *c, const mcp_json *args, void *user) +{ + static const char *files[] = { "/etc/phpmyadmin/config.inc.php", + "/var/www/phpmyadmin/config.inc.php", + "/var/www/html/phpmyadmin/config.inc.php", + NULL }; + const char *root = mcp_arg_string(args, "root"); + char path[1024]; + static char text[131072]; + char secret[256]; + char value[64]; + struct stat st; + mcp_buf b; + mcp_buf findings; + int first = 1; + int count = 0; + int files_read = 0; + int weak_blowfish = 0; + int no_password = 0; + int config_auth = 0; + int i; + + (void)user; + if (root == NULL) + root = ""; + if (strlen(root) > 400) { + mcp_reply_error(c, "root path too long"); + return; + } + mcp_buf_init(&findings); + for (i = 0; files[i] != NULL; i++) { + snprintf(path, sizeof(path), "%.400s%s", root, files[i]); + if (read_text(path, text, sizeof(text)) <= 0) + continue; + files_read++; + if (stat(path, &st) == 0 && (st.st_mode & 0002) != 0) { + add_finding(&findings, &first, "world-writable", "high", + "%s is writable by anyone", path); + count++; + } + secret[0] = '\0'; + line_value(text, "$cfg['blowfish_secret']", secret, + sizeof(secret)); + if (strlen(secret) < 32) + weak_blowfish = 1; + if (line_value(text, "$cfg['Servers'][$i]['AllowNoPassword']", + value, sizeof(value)) && + strcasecmp(value, "true") == 0) + no_password = 1; + if (line_value(text, "$cfg['Servers'][$i]['auth_type']", value, + sizeof(value)) && + strcasecmp(value, "config") == 0) + config_auth = 1; + break; + } + if (files_read == 0) { + mcp_buf_free(&findings); + mcp_reply_error(c, "cannot read a phpMyAdmin config.inc.php"); + return; + } + if (weak_blowfish) { + add_finding(&findings, &first, "weak-blowfish", "high", + "the blowfish secret is empty or shorter than 32"); + count++; + } + if (no_password) { + add_finding(&findings, &first, "allow-no-password", "high", + "accounts without a password may log in"); + count++; + } + if (config_auth) { + add_finding(&findings, &first, "config-auth", "high", + "credentials are stored in the config file"); + count++; + } + mcp_buf_init(&b); + mcp_buf_puts(&b, "{\"root\":"); + apex_json_str(&b, root); + mcp_buf_printf(&b, ",\"blowfish_secret\":%s," + "\"allow_no_password\":%s,\"config_auth\":%s," + "\"findings_count\":%d,\"findings\":[", + weak_blowfish ? "false" : "true", + no_password ? "true" : "false", + config_auth ? "true" : "false", count); + if (findings.p != NULL) + mcp_buf_add(&b, findings.p, findings.len); + mcp_buf_puts(&b, "]}"); + mcp_reply_json(c, b.p); + mcp_buf_free(&b); + mcp_buf_free(&findings); +} + const mcp_tool TOOLS_BLUE[] = { { "hardening_audit", "Read-only posture audit of the local host: sshd_config (root login, " @@ -17675,6 +17943,26 @@ const mcp_tool TOOLS_BLUE[] = { "{\"type\":\"object\",\"properties\":{" "\"root\":{\"type\":\"string\",\"description\":\"prefix, default empty\"}}}", t_keepalived_audit }, + { "webmin_audit", + "Parse miniserv.conf (root prefix): ssl=0, an allow list covering every " + "address, an empty or default password and a world-writable file. " + "Read-only.", + "{\"type\":\"object\",\"properties\":{" + "\"root\":{\"type\":\"string\",\"description\":\"prefix, default empty\"}}}", + t_webmin_audit }, + { "cockpit_audit", + "Parse cockpit.conf (root prefix, [WebService]): AllowUnencrypted=true, " + "a missing Origins allow-list and a world-writable file. Read-only.", + "{\"type\":\"object\",\"properties\":{" + "\"root\":{\"type\":\"string\",\"description\":\"prefix, default empty\"}}}", + t_cockpit_audit }, + { "phpmyadmin_audit", + "Parse config.inc.php (root prefix, three usual paths): a short or empty " + "blowfish secret, AllowNoPassword, auth_type=config and a world-writable " + "file. Read-only.", + "{\"type\":\"object\",\"properties\":{" + "\"root\":{\"type\":\"string\",\"description\":\"prefix, default empty\"}}}", + t_phpmyadmin_audit }, }; const size_t TOOLS_BLUE_N = sizeof(TOOLS_BLUE) / sizeof(TOOLS_BLUE[0]); diff --git a/src/tools_red.c b/src/tools_red.c index a7836a0..44cc72e 100644 --- a/src/tools_red.c +++ b/src/tools_red.c @@ -7088,6 +7088,95 @@ static void t_grafana_api_probe(mcp_conn *c, const mcp_json *args, mcp_buf_free(&b); } +/* --------------------------------------------------------- minio_admin_probe */ + +static void t_minio_admin_probe(mcp_conn *c, const mcp_json *args, + void *user) +{ + static const char *paths[] = { "/minio/health/live", + "/minio/admin/v3/info", NULL }; + const char *target = mcp_arg_string(args, "target"); + int port = mcp_arg_int(args, "port", 9000); + int tls = mcp_arg_bool(args, "tls", apex_looks_tls(port)); + mcp_buf b; + int first = 1; + int tested = 0; + int open_count = 0; + int health_open = 0; + int admin_open = 0; + char *evidence = NULL; + int i; + + (void)user; + if (target == NULL || *target == '\0') { + mcp_reply_error(c, "target is required"); + return; + } + if (port <= 0 || port > 65535) { + mcp_reply_error(c, "port out of range"); + return; + } + if (!gated(c, "minio_admin_probe", target, port)) + return; + mcp_buf_init(&b); + mcp_buf_puts(&b, "{\"target\":"); + apex_json_str(&b, target); + mcp_buf_printf(&b, ",\"port\":%d,\"tls\":%s,\"endpoints\":[", port, + tls ? "true" : "false"); + for (i = 0; paths[i] != NULL; i++) { + char status[256]; + char *resp = NULL; + size_t len = 0; + int code; + int open; + int admin_api = strncmp(paths[i], "/minio/admin", 12) == 0; + + status[0] = '\0'; + if (apex_http_once(target, port, tls, "GET", paths[i], NULL, NULL, + 8000, &resp, &len, status, + sizeof(status)) != 0) + continue; + tested++; + code = apex_status_code(status); + open = code >= 200 && code < 300; + if (open) + open_count++; + if (open && !admin_api) + health_open = 1; + if (open && admin_api) { + admin_open = 1; + if (evidence == NULL) + evidence = apex_evidence_save("minio-admin-info", + resp, len); + } + if (!first) + mcp_buf_puts(&b, ","); + first = 0; + mcp_buf_puts(&b, "{\"path\":"); + apex_json_str(&b, paths[i]); + mcp_buf_printf(&b, ",\"status\":%d,\"bytes\":%lu,\"open\":%s}", + code, (unsigned long)len, + open ? "true" : "false"); + free(resp); + } + mcp_buf_printf(&b, "],\"tested\":%d,\"open_count\":%d," + "\"health_open\":%s,\"admin_open\":%s,\"evidence\":", + tested, open_count, health_open ? "true" : "false", + admin_open ? "true" : "false"); + if (evidence != NULL) + apex_json_str(&b, evidence); + else + mcp_buf_puts(&b, "null"); + mcp_buf_puts(&b, "}"); + apex_audit("minio_admin_probe", target, port, !admin_open, + admin_open + ? "the MinIO admin API answers without a signature" + : "the MinIO admin API requires a signature", "list"); + mcp_reply_json(c, b.p); + free(evidence); + mcp_buf_free(&b); +} + const mcp_tool TOOLS_RED[] = { { "vuln_check", "Non-destructive verification of exposed artifacts on one web target: " @@ -7681,6 +7770,16 @@ const mcp_tool TOOLS_RED[] = { "\"tls\":{\"type\":\"boolean\"}}," "\"required\":[\"target\"]}", t_grafana_api_probe }, + { "minio_admin_probe", + "Query MinIO without a signature: /minio/health/live and " + "/minio/admin/v3/info. A 2xx on the admin API means unsigned admin " + "access; the answer is saved as evidence. Gate: the target.", + "{\"type\":\"object\",\"properties\":{" + "\"target\":{\"type\":\"string\"}," + "\"port\":{\"type\":\"integer\",\"description\":\"default 9000\"}," + "\"tls\":{\"type\":\"boolean\"}}," + "\"required\":[\"target\"]}", + t_minio_admin_probe }, { "dns_ns_consistency", "Fetch NS records for a domain from the parent resolver and from its own " "first nameserver (resolved to an address), then report names present on " diff --git a/tests/gate_audit.py b/tests/gate_audit.py index 9cd1ddd..a0a1ca8 100755 --- a/tests/gate_audit.py +++ b/tests/gate_audit.py @@ -21,7 +21,7 @@ import re import sys HERE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -EXPECTED_TOOLS = 258 +EXPECTED_TOOLS = 262 GATE = ("gated(", "gated_cmd(", "gated_run(", "apex_scope_check(") NET = ("http_once(", "tcp_connect_host(", "tcp_probe(", "apex_run(") # Tools whose "target" argument filters local records; they never touch it. diff --git a/tests/run.py b/tests/run.py index b8a7844..70ab853 100755 --- a/tests/run.py +++ b/tests/run.py @@ -134,7 +134,7 @@ res, _ = run([ ], home=empty) check("tools/list answers", any(r.get("id") == 1 for r in res)) tools = [r for r in res if r.get("id") == 1][0]["result"]["tools"] -check("258 tools registered", len(tools) == 258, len(tools)) +check("262 tools registered", len(tools) == 262, len(tools)) names = {t["name"] for t in tools} for need in ("portscan", "nmap", "http_request", "marauder_scan", "method_playbook", "finding_add", "finding_update", "scope_check", @@ -1560,7 +1560,7 @@ try: check("http initialize", init["result"]["serverInfo"]["name"] == "apex-twin", init) listing = post({"jsonrpc": "2.0", "id": 2, "method": "tools/list"}) - check("http tools/list", len(listing["result"]["tools"]) == 258) + check("http tools/list", len(listing["result"]["tools"]) == 262) shown = post(call(3, "scope_show")) check("http scope_show", '"loaded":true' in shown["result"]["content"][0]["text"]) # the id must be the request's id, not one found inside the arguments @@ -11838,6 +11838,184 @@ shutil.rmtree(kl_root, ignore_errors=True) shutil.rmtree(kl_good_root, ignore_errors=True) shutil.rmtree(cfg27_home, ignore_errors=True) +print("\n== Webmin, Cockpit, phpMyAdmin and MinIO admin ==\n") + +wm_root = tempfile.mkdtemp(prefix="apex-wm-") +os.makedirs(os.path.join(wm_root, "etc", "webmin")) +wm_bad = os.path.join(wm_root, "etc", "webmin", "miniserv.conf") +with open(wm_bad, "w") as f: + f.write("ssl=0\n") + f.write("allow=0.0.0.0\n") + f.write("pass=changeme\n") +os.chmod(wm_bad, 0o666) +wm_good_root = tempfile.mkdtemp(prefix="apex-wmg-") +os.makedirs(os.path.join(wm_good_root, "etc", "webmin")) +with open(os.path.join(wm_good_root, "etc", "webmin", "miniserv.conf"), + "w") as f: + f.write("ssl=1\n") + f.write("allow=10.0.0.0/8\n") + f.write("pass=$1$aVeryLongCryptHashValueHere\n") + +cp_root = tempfile.mkdtemp(prefix="apex-cp-") +os.makedirs(os.path.join(cp_root, "etc", "cockpit")) +cp_bad = os.path.join(cp_root, "etc", "cockpit", "cockpit.conf") +with open(cp_bad, "w") as f: + f.write("[WebService]\n") + f.write("AllowUnencrypted = true\n") +os.chmod(cp_bad, 0o666) +cp_good_root = tempfile.mkdtemp(prefix="apex-cpg-") +os.makedirs(os.path.join(cp_good_root, "etc", "cockpit")) +with open(os.path.join(cp_good_root, "etc", "cockpit", "cockpit.conf"), + "w") as f: + f.write("[WebService]\n") + f.write("AllowUnencrypted = false\n") + f.write("Origins = https://cockpit.example.test\n") + +pa_root = tempfile.mkdtemp(prefix="apex-pa-") +os.makedirs(os.path.join(pa_root, "etc", "phpmyadmin")) +pa_bad = os.path.join(pa_root, "etc", "phpmyadmin", "config.inc.php") +with open(pa_bad, "w") as f: + f.write("