diff --git a/CHANGELOG.md b/CHANGELOG.md
index d92e44d..545cb42 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,22 @@
# Changelog
+## 1.85.0 - 2026-11-24 - this change
+
+- **Jetty** (`jetty_audit`): `jetty.xml`, `jetty-ssl.xml` and the `start.d`
+ ini files. A `` block that sets the host to
+ `0.0.0.0` or `::` without an `sslContextFactory` inside the same block is
+ a clear-text connector on every interface; a `start.d` file that sets
+ `jetty.http.host` or `jetty.ssl.host` to `0.0.0.0` overrides the XML and
+ counts the same way. Also flags a LoginService password as literal text,
+ MD5 as the login hash and a writable configuration file. Read-only.
+- **Zabbix** (`zabbix_probe`): `apiinfo.version` proves the JSON-RPC
+ endpoint answers but is allowed before login, so only `user.login` with
+ the default `Admin`/`zabbix` pair counts as exposure. The response is
+ saved as evidence and the session token is never printed.
+- **Datasette** (`datasette_probe`): `/-/databases.json` without a token
+ names every attached SQLite file; the list becomes the evidence.
+- 374 tools, 1429 end-to-end checks.
+
## 1.84.0 - 2026-11-24 - this change
- **External scanners** (`src/tools_ext.c`): `nuclei_scan`, `nikto_scan`,
diff --git a/README.md b/README.md
index d749a6d..a6c7685 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.
-**371 tools · 1422 end-to-end checks · 240 fuzz cases · 85.0% line coverage · ~1041 KiB**
+**374 tools · 1429 end-to-end checks · 240 fuzz cases · 85.0% line coverage · ~1041 KiB**
```
$ ./apex-twin --check
-{"version":"1.84.0","tools":371,...,"scope":{"loaded":true,...}}
+{"version":"1.85.0","tools":374,...,"scope":{"loaded":true,...}}
```
APEX TWIN was inspired by [ARTEX](https://github.com/Autumn-27/artex) (scope
@@ -233,6 +233,8 @@ uploads and secret-file reads. It does not execute anything.
| `sonarqube_probe` | `/api/projects/search` on 9000 without auth; project list as evidence |
| `keycloak_probe` | `/realms/master` on 8080: open self-registration; realm JSON as evidence |
| `rundeck_probe` | `/api/14/projects` without a token; project list as evidence |
+| `zabbix_probe` | `user.login` with the default Admin/zabbix pair; response as evidence |
+| `datasette_probe` | `/-/databases.json` without a token; database list as evidence |
| `airflow_probe` | `/api/v1/dags` without auth; DAG inventory as evidence |
| `jupyter_probe` | `/api/kernels` on 8888 without a token; sessions as evidence |
| `jira_probe` | `/rest/api/2/project` on 8080 without auth; project list as evidence |
@@ -568,6 +570,7 @@ does.
| `php_fpm_audit` | PHP-FPM pools: user root, `listen.mode` 0666/777, display_errors, allow_url_include |
| `uwsgi_audit` | uWSGI ini: uid/gid 0, `chmod-socket` 666/777, `chdir = /`, master off |
| `lighttpd_audit` | lighttpd.conf: document-root `/`, ssl.engine off, dir-listing, runs as root |
+| `jetty_audit` | jetty.xml + start.d: connector on 0.0.0.0 without TLS, literal password, MD5 |
| `networkd_audit` | systemd-networkd: [Match] without Name/MAC/Type, DHCP DNS without UseDNS=no, public resolver |
| `namespace_audit` | namespace.conf: no /tmp entry, empty/unknown method, `~` user list |
| `ssh_client_audit` | ssh_config: StrictHostKeyChecking no, known_hosts /dev/null, ssh-rsa |
@@ -1051,7 +1054,8 @@ src/tools_red.c vuln_check, subdomain_enum, cred_test, vhost_discovery,
keycloak_probe, rundeck_probe, airflow_probe,
gitlab_probe, jupyter_probe, jira_probe,
ollama_probe, cadvisor_probe, teamcity_probe,
- superset_probe, argocd_probe, kafka_connect_probe
+ superset_probe, argocd_probe, kafka_connect_probe,
+ zabbix_probe, datasette_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,
@@ -1072,7 +1076,8 @@ src/tools_blue.c hardening_audit, log_audit, ioc_scan, web_log_audit,
modules_load_audit, depmod_audit, adduser_conf_audit,
nfs_conf_audit, idmapd_audit, netplan_audit,
apt_auth_audit, aliases_audit, netgroup_audit,
- php_fpm_audit, uwsgi_audit, lighttpd_audit)
+ php_fpm_audit, uwsgi_audit, lighttpd_audit,
+ jetty_audit)
src/tools_esp.c esp_info, esp_monitor, esp_read_flash, esp_flash,
esp_partition_table, esp_nvs_parse, firmware_scan,
esp_app_info, esp_image_verify
@@ -1111,7 +1116,7 @@ examples/ scope.json
## Status
-1.84.0. Built and run: 371 tools, 1422 checks, 240 fuzz cases and 85.0% line
+1.85.0. Built and run: 374 tools, 1429 checks, 240 fuzz cases and 85.0% 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 6ef03f6..6623e37 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.84.x** (`src/apex.h`, `APEX_VERSION`). Security fixes land on the current
+is **1.85.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.
diff --git a/docs/apex-twin.1 b/docs/apex-twin.1
index ed7371f..42136b3 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-24" "apex-twin 1.84.0" "User Commands"
+.TH APEX-TWIN 1 "2026-11-24" "apex-twin 1.85.0" "User Commands"
.SH NAME
apex-twin \- scope\-gated offensive\-security MCP server
.SH SYNOPSIS
@@ -45,7 +45,7 @@ graphql_probe, docker_api_probe, elasticsearch_probe, imap_probe, pop3_probe,
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, 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, nats_monitoring_probe, influxdb_probe, clickhouse_probe, kibana_api_probe, logstash_api_probe, amqp_probe, tls_chain_probe, smtp_auth_probe, jenkins_api_probe, nexus_probe, gitea_api_probe, harbor_probe, portainer_probe, argocd_probe, kafka_connect_probe, sonarqube_probe, keycloak_probe, rundeck_probe, airflow_probe, gitlab_probe, jupyter_probe, jira_probe, ollama_probe, cadvisor_probe, teamcity_probe, superset_probe,
+websocket_origin_check, dns_fcrdns_check, dns_soa_mname_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, nats_monitoring_probe, influxdb_probe, clickhouse_probe, kibana_api_probe, logstash_api_probe, amqp_probe, tls_chain_probe, smtp_auth_probe, jenkins_api_probe, nexus_probe, gitea_api_probe, harbor_probe, portainer_probe, argocd_probe, kafka_connect_probe, sonarqube_probe, keycloak_probe, rundeck_probe, zabbix_probe, datasette_probe, airflow_probe, gitlab_probe, jupyter_probe, jira_probe, ollama_probe, cadvisor_probe, teamcity_probe, superset_probe,
nuclei_scan, nikto_scan, ffuf_scan, gobuster_scan, sqlmap_scan),
defensive
audits (hardening_audit, log_audit, ioc_scan, web_log_audit, detect_rules,
@@ -93,7 +93,7 @@ aide_audit, nscd_audit, faillock_audit,
networkd_audit, namespace_audit, ssh_client_audit, ufw_audit, monit_audit, clamav_audit,
modules_load_audit, depmod_audit, adduser_conf_audit,
nfs_conf_audit, idmapd_audit, netplan_audit,
-apt_auth_audit, aliases_audit, netgroup_audit,
+apt_auth_audit, aliases_audit, netgroup_audit, jetty_audit,
php_fpm_audit, uwsgi_audit, lighttpd_audit)
and ESP32 board tools (esp_info, esp_monitor,
esp_read_flash, esp_flash, esp_partition_table, esp_nvs_parse, firmware_scan,
diff --git a/src/apex.h b/src/apex.h
index fd011a6..1085508 100644
--- a/src/apex.h
+++ b/src/apex.h
@@ -15,7 +15,7 @@
#include "mcp.h"
-#define APEX_VERSION "1.84.0"
+#define APEX_VERSION "1.85.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 2149eda..8a26858 100644
--- a/src/tools_blue.c
+++ b/src/tools_blue.c
@@ -27786,6 +27786,188 @@ static void t_lighttpd_audit(mcp_conn *c, const mcp_json *args, void *user)
mcp_buf_free(&findings);
}
+/* -------------------------------------------------------------- jetty_audit */
+
+/* Jetty is configured twice: jetty.xml (the server, one connector per ) and the start.d ini files (which override it). The
+ * interesting questions are whether a connector binds beyond localhost, and
+ * whether that connector carries an sslContextFactory at all. A plain
+ * connector on 0.0.0.0 sends credentials in the clear. The LoginService
+ * password belongs in a hash file, not as literal text in the XML. */
+typedef struct {
+ int files;
+ int connectors;
+ int open_connectors;
+ int plain_connectors;
+ int literal_password;
+ int weak_hash;
+ int world_writable;
+} jetty_state;
+
+/* Does the connector block carry an sslContextFactory? Only the text between
+ * the addConnector call and its closing counts, so a TLS connector
+ * elsewhere in the file does not cover a plain one. */
+static int jetty_block_has_ssl(const char *start, const char *end)
+{
+ const char *hit;
+
+ if (start == NULL || end == NULL || end <= start)
+ return 0;
+ hit = strstr(start, "sslContextFactory");
+ return hit != NULL && hit < end;
+}
+
+static void jetty_scan_xml(jetty_state *st, const char *path, mcp_buf *findings,
+ int *first, int *count)
+{
+ static char text[131072];
+ struct stat sb;
+ const char *p;
+
+ if (read_text(path, text, sizeof(text)) <= 0)
+ return;
+ st->files++;
+ if (stat(path, &sb) == 0 && (sb.st_mode & 0002) != 0) {
+ st->world_writable++;
+ add_finding(findings, first, "world-writable", "high",
+ "%s is writable by any local user; it decides which "
+ "interface Jetty binds", path);
+ (*count)++;
+ }
+ /* Every addConnector call is one listening connector. */
+ p = text;
+ while ((p = strstr(p, "addConnector")) != NULL) {
+ const char *close = strstr(p, "");
+ const char *host = strstr(p, "");
+ int has_ssl;
+
+ st->connectors++;
+ has_ssl = jetty_block_has_ssl(p, close != NULL ? close : p + 4096);
+ if (host != NULL && close != NULL && host < close) {
+ if (strstr(host, "0.0.0.0") != NULL ||
+ strstr(host, "::") != NULL) {
+ st->open_connectors++;
+ if (!has_ssl) {
+ st->plain_connectors++;
+ add_finding(findings, first,
+ "plain-open-connector", "high",
+ "%s: a connector on all interfaces "
+ "without an sslContextFactory sends "
+ "traffic in the clear", path);
+ (*count)++;
+ }
+ }
+ }
+ p += 11;
+ }
+ /* ... as literal text is a plaintext secret. */
+ if (strstr(text, "") != NULL &&
+ strstr(text, "OBF:") == NULL) {
+ st->literal_password++;
+ add_finding(findings, first, "literal-password", "medium",
+ "%s carries a LoginService password as literal text; "
+ "use a hash login service", path);
+ (*count)++;
+ }
+ if (strstr(text, "MD5") != NULL || strstr(text, "md5") != NULL) {
+ st->weak_hash++;
+ add_finding(findings, first, "weak-hash", "medium",
+ "%s names MD5 for the login service; use bcrypt or "
+ "PBKDF2", path);
+ (*count)++;
+ }
+}
+
+static void t_jetty_audit(mcp_conn *c, const mcp_json *args, void *user)
+{
+ const char *root = mcp_arg_string(args, "root");
+ char path[1024];
+ mcp_buf b;
+ mcp_buf findings;
+ jetty_state st;
+ int first = 1;
+ int count = 0;
+ int ini_files = 0;
+ int ini_open = 0;
+ int i;
+ static const char *xml_files[] = { "/etc/jetty/jetty.xml",
+ "/etc/jetty/jetty-ssl.xml",
+ "/opt/jetty/etc/jetty.xml", NULL };
+
+ (void)user;
+ if (root == NULL)
+ root = "";
+ if (strlen(root) > 400) {
+ mcp_reply_error(c, "root path too long");
+ return;
+ }
+ memset(&st, 0, sizeof(st));
+ mcp_buf_init(&findings);
+ for (i = 0; xml_files[i] != NULL; i++) {
+ snprintf(path, sizeof(path), "%.400s%s", root, xml_files[i]);
+ jetty_scan_xml(&st, path, &findings, &first, &count);
+ }
+ /* The start.d ini files override the XML; the host key there wins. */
+ snprintf(path, sizeof(path), "%.400s/etc/jetty/start.d", root);
+ {
+ DIR *d = opendir(path);
+ struct dirent *ent;
+
+ if (d != NULL) {
+ while ((ent = readdir(d)) != NULL) {
+ char file[1400];
+ static char text[16384];
+
+ if (ent->d_name[0] == '.')
+ continue;
+ if (strstr(ent->d_name, ".ini") == NULL)
+ continue;
+ snprintf(file, sizeof(file), "%.1024s/%.255s",
+ path, ent->d_name);
+ if (read_text(file, text, sizeof(text)) <= 0)
+ continue;
+ ini_files++;
+ if (strstr(text, "jetty.http.host=0.0.0.0") != NULL ||
+ strstr(text, "jetty.ssl.host=0.0.0.0") != NULL) {
+ ini_open++;
+ add_finding(&findings, &first,
+ "open-connector-ini", "high",
+ "%s binds a connector to all "
+ "interfaces", file);
+ count++;
+ }
+ }
+ closedir(d);
+ }
+ }
+ if (st.files == 0 && ini_files == 0) {
+ mcp_buf_free(&findings);
+ mcp_reply_error(c, "cannot read a Jetty configuration");
+ return;
+ }
+ if (count == 0) {
+ add_finding(&findings, &first, "no-findings", "info",
+ "no open connector, no literal password and no weak "
+ "hash in the Jetty configuration");
+ }
+ mcp_buf_init(&b);
+ mcp_buf_puts(&b, "{\"root\":");
+ apex_json_str(&b, root);
+ mcp_buf_printf(&b, ",\"files\":%d,\"ini_files\":%d,\"connectors\":%d,"
+ "\"open_connectors\":%d,\"plain_open_connectors\":%d,"
+ "\"ini_open\":%d,\"literal_password\":%d,\"weak_hash\":%d,"
+ "\"findings_count\":%d,\"findings\":[",
+ st.files, ini_files, st.connectors, st.open_connectors,
+ st.plain_connectors, ini_open, st.literal_password,
+ st.weak_hash, 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, "
@@ -29327,6 +29509,16 @@ const mcp_tool TOOLS_BLUE[] = {
"\"root\":{\"type\":\"string\",\"description\":\"prefix, default "
"empty\"}}}",
t_lighttpd_audit },
+ { "jetty_audit",
+ "Parse Jetty configuration (root prefix): jetty.xml, jetty-ssl.xml and "
+ "start.d/*.ini. Flags an addConnector block on 0.0.0.0 without an "
+ "sslContextFactory, a start.d ini that sets jetty.http.host or "
+ "jetty.ssl.host to 0.0.0.0, a LoginService password as literal text, "
+ "MD5 as the login hash and a writable configuration file. Read-only.",
+ "{\"type\":\"object\",\"properties\":{"
+ "\"root\":{\"type\":\"string\",\"description\":\"prefix, default "
+ "empty\"}}}",
+ t_jetty_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 f94c89b..99fe2a5 100644
--- a/src/tools_red.c
+++ b/src/tools_red.c
@@ -8819,6 +8819,212 @@ static void t_keycloak_probe(mcp_conn *c, const mcp_json *args, void *user)
mcp_buf_free(&b);
}
+/* --------------------------------------------------------------- zabbix_probe */
+
+/* Zabbix answers JSON-RPC on /api_jsonrpc.php. "apiinfo.version" is allowed
+ * before login, so a 2xx with a version string is not exposure by itself; it
+ * only proves the API is reachable. Exposure is "user.login" with the classic
+ * default pair, which returns a session token. The token is never printed:
+ * only whether the login succeeded is reported, and the response is saved as
+ * evidence. */
+static void t_zabbix_probe(mcp_conn *c, const mcp_json *args, void *user)
+{
+ const char *target = mcp_arg_string(args, "target");
+ int port = mcp_arg_int(args, "port", 80);
+ int tls = mcp_arg_bool(args, "tls", apex_looks_tls(port));
+ const char *user_name = mcp_arg_string(args, "username");
+ const char *pass = mcp_arg_string(args, "password");
+ mcp_buf b;
+ int first = 1;
+ int tested = 0;
+ int open_count = 0;
+ int version_open = 0;
+ int login_open = 0;
+ char *evidence = NULL;
+ static const char *version_req =
+ "{\"jsonrpc\":\"2.0\",\"method\":\"apiinfo.version\","
+ "\"params\":{},\"id\":1}";
+ char login_req[512];
+ char status[256];
+ char *resp = NULL;
+ size_t len = 0;
+ int code;
+
+ (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, "zabbix_probe", target, port))
+ return;
+ if (user_name == NULL)
+ user_name = "Admin";
+ if (pass == NULL)
+ pass = "zabbix";
+ 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");
+ /* 1. apiinfo.version — reachability, not exposure. */
+ status[0] = '\0';
+ if (apex_http_once(target, port, tls, "POST", "/api_jsonrpc.php",
+ version_req, "Content-Type: application/json\r\n",
+ 8000, &resp, &len, status, sizeof(status)) == 0) {
+ tested++;
+ code = apex_status_code(status);
+ if (code >= 200 && code < 300 && resp != NULL &&
+ strstr(resp, "result") != NULL)
+ version_open = 1;
+ mcp_buf_puts(&b, "{\"path\":");
+ apex_json_str(&b, "/api_jsonrpc.php");
+ mcp_buf_printf(&b, ",\"method\":\"apiinfo.version\",\"status\":%d,"
+ "\"bytes\":%lu,\"open\":%s}", code,
+ (unsigned long)len,
+ version_open ? "true" : "false");
+ first = 0;
+ free(resp);
+ resp = NULL;
+ }
+ /* 2. user.login with the default pair — that is the exposure. */
+ snprintf(login_req, sizeof(login_req),
+ "{\"jsonrpc\":\"2.0\",\"method\":\"user.login\","
+ "\"params\":{\"username\":\"%.120s\",\"password\":\"%.120s\"},"
+ "\"id\":2}", user_name, pass);
+ status[0] = '\0';
+ if (apex_http_once(target, port, tls, "POST", "/api_jsonrpc.php",
+ login_req, "Content-Type: application/json\r\n",
+ 8000, &resp, &len, status, sizeof(status)) == 0) {
+ tested++;
+ code = apex_status_code(status);
+ open_count = 0;
+ if (code >= 200 && code < 300 && resp != NULL &&
+ strstr(resp, "\"result\"") != NULL &&
+ strstr(resp, "error") == NULL) {
+ login_open = 1;
+ open_count = 1;
+ evidence = apex_evidence_save("zabbix-login", resp, len);
+ }
+ if (!first)
+ mcp_buf_puts(&b, ",");
+ mcp_buf_puts(&b, "{\"path\":");
+ apex_json_str(&b, "/api_jsonrpc.php");
+ mcp_buf_printf(&b, ",\"method\":\"user.login\",\"status\":%d,"
+ "\"bytes\":%lu,\"open\":%s}", code,
+ (unsigned long)len, login_open ? "true" : "false");
+ first = 0;
+ free(resp);
+ resp = NULL;
+ }
+ mcp_buf_printf(&b, "],\"tested\":%d,\"open_count\":%d,"
+ "\"version_open\":%s,\"login_open\":%s,\"evidence\":",
+ tested, open_count, version_open ? "true" : "false",
+ login_open ? "true" : "false");
+ if (evidence != NULL)
+ apex_json_str(&b, evidence);
+ else
+ mcp_buf_puts(&b, "null");
+ mcp_buf_puts(&b, "}");
+ apex_audit("zabbix_probe", target, port, !login_open,
+ login_open
+ ? "the Zabbix API accepted the default credentials"
+ : "the Zabbix API refused the default credentials", "login");
+ mcp_reply_json(c, b.p);
+ free(evidence);
+ mcp_buf_free(&b);
+}
+
+/* ------------------------------------------------------------ datasette_probe */
+
+/* Datasette on 8001. /-/versions.json answers unauthenticated on every
+ * install, so it is the reachability check. Exposure is /-/databases.json
+ * coming back 2xx with a database list: it names every attached file. The
+ * list is saved as evidence. */
+static void t_datasette_probe(mcp_conn *c, const mcp_json *args, void *user)
+{
+ static const char *paths[] = { "/-/versions.json",
+ "/-/databases.json", NULL };
+ const char *target = mcp_arg_string(args, "target");
+ int port = mcp_arg_int(args, "port", 8001);
+ 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 databases_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, "datasette_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 is_db = strstr(paths[i], "databases") != NULL;
+
+ 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 && is_db) {
+ databases_open = 1;
+ if (evidence == NULL && len > 2)
+ evidence = apex_evidence_save("datasette-databases",
+ 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,"
+ "\"databases_open\":%s,\"evidence\":",
+ tested, open_count, databases_open ? "true" : "false");
+ if (evidence != NULL)
+ apex_json_str(&b, evidence);
+ else
+ mcp_buf_puts(&b, "null");
+ mcp_buf_puts(&b, "}");
+ apex_audit("datasette_probe", target, port, !databases_open,
+ databases_open
+ ? "the Datasette database list answers without a token"
+ : "the Datasette database list requires a token", "list");
+ mcp_reply_json(c, b.p);
+ free(evidence);
+ mcp_buf_free(&b);
+}
+
/* -------------------------------------------------------------- rundeck_probe */
/* Rundeck on 4440. /api/1/system/info answers on many installs and is not
@@ -10244,6 +10450,29 @@ const mcp_tool TOOLS_RED[] = {
"\"port\":{\"type\":\"integer\",\"description\":\"default 4440\"}},"
"\"required\":[\"target\"]}",
t_rundeck_probe },
+ { "zabbix_probe",
+ "Get /api_jsonrpc.php with apiinfo.version (reachability only) and "
+ "user.login using the default Admin/zabbix pair. A successful login is "
+ "an unauthenticated-by-default Zabbix API; the response is saved as "
+ "evidence and the session token is never printed.",
+ "{\"type\":\"object\",\"properties\":{"
+ "\"target\":{\"type\":\"string\"},"
+ "\"port\":{\"type\":\"integer\",\"description\":\"default 80\"},"
+ "\"tls\":{\"type\":\"boolean\"},"
+ "\"username\":{\"type\":\"string\",\"description\":\"default Admin\"},"
+ "\"password\":{\"type\":\"string\",\"description\":\"default zabbix\"}},"
+ "\"required\":[\"target\"]}",
+ t_zabbix_probe },
+ { "datasette_probe",
+ "Get /-/versions.json and /-/databases.json without a token. A 2xx on "
+ "the database list names every attached SQLite file and is saved as "
+ "evidence.",
+ "{\"type\":\"object\",\"properties\":{"
+ "\"target\":{\"type\":\"string\"},"
+ "\"port\":{\"type\":\"integer\",\"description\":\"default 8001\"},"
+ "\"tls\":{\"type\":\"boolean\"}},"
+ "\"required\":[\"target\"]}",
+ t_datasette_probe },
{ "airflow_probe",
"Query Airflow on 8080 without credentials: /api/v1/version and "
"/api/v1/dags. A 2xx on the DAG list means the whole DAG inventory is "
diff --git a/tests/gate_audit.py b/tests/gate_audit.py
index 71ad51e..cae36b5 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 = 371
+EXPECTED_TOOLS = 374
GATE = ("gated(", "gated_cmd(", "gated_run(", "apex_scope_check(")
# Handlers may hand argv to a shared runner instead of calling the gate
# themselves. That runner has to call the gate; both halves are checked
diff --git a/tests/run.py b/tests/run.py
index 2196687..dbda7e3 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("371 tools registered", len(tools) == 371, len(tools))
+check("374 tools registered", len(tools) == 374, 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"]) == 371)
+ check("http tools/list", len(listing["result"]["tools"]) == 374)
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
@@ -16693,6 +16693,143 @@ for d in (fpm_root, fpm_good_root, uw_root, uw_good_root, lt_root,
shutil.rmtree(d, ignore_errors=True)
+# --- 1.85.0: jetty audit plus Zabbix and Datasette probes ---
+print("\n== Jetty, Zabbix and Datasette ==")
+
+jt_root = tempfile.mkdtemp(prefix="apex-jt-")
+os.makedirs(os.path.join(jt_root, "etc", "jetty", "start.d"))
+with open(os.path.join(jt_root, "etc", "jetty", "jetty.xml"), "w") as f:
+ f.write('\n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' 0.0.0.0\n')
+ f.write(' 8080\n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' hunter2\n')
+ f.write(' MD5\n')
+ f.write('\n')
+os.chmod(os.path.join(jt_root, "etc", "jetty", "jetty.xml"), 0o666)
+with open(os.path.join(jt_root, "etc", "jetty", "start.d", "http.ini"),
+ "w") as f:
+ f.write("jetty.http.port=8080\n")
+ f.write("jetty.http.host=0.0.0.0\n")
+
+jt_good_root = tempfile.mkdtemp(prefix="apex-jtg-")
+os.makedirs(os.path.join(jt_good_root, "etc", "jetty"))
+with open(os.path.join(jt_good_root, "etc", "jetty", "jetty.xml"), "w") as f:
+ f.write('\n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' 127.0.0.1\n')
+ f.write(' '
+ '\n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write(' \n')
+ f.write('\n')
+
+
+class _ZabbixHandler(http.server.BaseHTTPRequestHandler):
+ def do_POST(self):
+ n = int(self.headers.get("Content-Length") or 0)
+ body = self.rfile.read(n).decode("utf-8", "replace")
+ if "apiinfo.version" in body:
+ out = b'{"jsonrpc":"2.0","result":"6.4.4","id":1}'
+ self.send_response(200)
+ elif '"Admin"' in body and '"zabbix"' in body:
+ out = b'{"jsonrpc":"2.0","result":"tok-abc123","id":2}'
+ self.send_response(200)
+ else:
+ out = b'{"jsonrpc":"2.0","error":{"code":-32602,"message":"bad"},' \
+ b'"id":2}'
+ self.send_response(200)
+ self.send_header("Content-Type", "application/json")
+ self.send_header("Content-Length", str(len(out)))
+ self.end_headers()
+ self.wfile.write(out)
+
+ def log_message(self, *args):
+ pass
+
+
+class _DatasetteHandler(http.server.BaseHTTPRequestHandler):
+ def do_GET(self):
+ path = urllib.parse.urlsplit(self.path).path
+ if path == "/-/versions.json":
+ out = b'{"python":{"version":"3.11.2"},"datasette":{"version":"0.64"}}'
+ self.send_response(200)
+ elif path == "/-/databases.json":
+ out = b'{"databases":[{"name":"feeds","path":"/srv/feeds.db"}]}'
+ self.send_response(200)
+ else:
+ out = b'{"error":"not found"}'
+ self.send_response(404)
+ self.send_header("Content-Type", "application/json")
+ self.send_header("Content-Length", str(len(out)))
+ self.end_headers()
+ self.wfile.write(out)
+
+ def log_message(self, *args):
+ pass
+
+
+zb_srv = http.server.HTTPServer(("127.0.0.1", 0), _ZabbixHandler)
+zb_port = zb_srv.server_address[1]
+threading.Thread(target=zb_srv.serve_forever, daemon=True).start()
+ds_srv = http.server.HTTPServer(("127.0.0.1", 0), _DatasetteHandler)
+ds_port = ds_srv.server_address[1]
+threading.Thread(target=ds_srv.serve_forever, daemon=True).start()
+
+cfg56_home = tempfile.mkdtemp(prefix="apex-cfg56-home-")
+write_scope(cfg56_home,
+ {"label": "cfg56", "expires": "2099-01-01T00:00:00Z",
+ "allow_private": True, "allow_ip": ["127.0.0.1"],
+ "allow_port": ["1-65535"]})
+
+res, _ = run([
+ call(1, "jetty_audit", root=jt_root),
+ call(2, "jetty_audit", root=jt_good_root),
+ call(3, "zabbix_probe", target="127.0.0.1", port=zb_port),
+ call(4, "datasette_probe", target="127.0.0.1", port=ds_port),
+], home=cfg56_home)
+by_id = {r["id"]: r for r in res if "id" in r}
+jt = json.loads(text(by_id[1]))
+check("jetty_audit flags a plain connector on all interfaces",
+ "plain-open-connector" in {f["id"] for f in jt["findings"]} and
+ jt["connectors"] == 1 and jt["open_connectors"] == 1, jt)
+check("jetty_audit flags the ini host, a literal password and MD5",
+ jt["ini_open"] == 1 and jt["literal_password"] == 1 and
+ jt["weak_hash"] == 1 and jt["ini_files"] == 1, jt)
+check("jetty_audit flags the world-writable configuration",
+ "world-writable" in {f["id"] for f in jt["findings"]}, jt)
+jt_good = json.loads(text(by_id[2]))
+check("jetty_audit accepts a TLS connector bound to localhost",
+ jt_good["findings_count"] == 0 and jt_good["open_connectors"] == 0 and
+ jt_good["plain_open_connectors"] == 0, jt_good)
+zb = json.loads(text(by_id[3]))
+check("zabbix_probe reports the version endpoint as reachable",
+ zb["version_open"] is True and zb["tested"] == 2, zb)
+check("zabbix_probe finds the default credentials and saves evidence",
+ zb["login_open"] is True and
+ os.path.isfile(zb["evidence"]), zb)
+ds = json.loads(text(by_id[4]))
+check("datasette_probe finds an open database list and saves evidence",
+ ds["databases_open"] is True and ds["open_count"] == 2 and
+ os.path.isfile(ds["evidence"]), ds)
+
+zb_srv.shutdown()
+ds_srv.shutdown()
+
+for d in (jt_root, jt_good_root, cfg56_home):
+ shutil.rmtree(d, ignore_errors=True)
+
+
# --- 1.84.0: gated wrappers for external scanners (mock binaries) ---
print("\n== external scanner wrappers ==\n")