Files
lotherk 59b71ab3a1 apex-twin 1.100.0: auth_test over six protocols, SIGPIPE fix
Authentication testing in src/tools_auth.c (new file, 16th table): auth_test
speaks http Basic, ftp, smtp AUTH LOGIN, imap, pop3 and mysql
(mysql_native_password) against one in-scope service. The operator supplies
the wordlists (inline or file) and every limit - delay_ms, max_attempts,
stop_on_hit, lockout_limit, timeout_ms; the program adds none of its own.
auth_plan counts a run without connecting, auth_protocols lists the
protocols, auth_hits returns the credential findings with evidence paths.
A hit is the protocol's own accept answer; each accepted pair becomes a
critical finding with the pair and the answer in evidence, while the audit
log keeps the account and service and never the password.

Two real bugs found by the tests they came with:

- An HTTP answer below 400 counted as a hit, so a 404 or a 500 would have
  been reported as valid credentials. Only 2xx/3xx prove authentication
  now; two checks pin it and fail against the old logic.
- SIGPIPE killed the whole server when a target hung up mid-write: one
  dead target, one dead MCP server. Ignored once at startup, so the write
  returns EPIPE and the tool reports a failed connection. Five checks, one
  per protocol.

SHA1 for the MySQL scramble is written out in the file and checked against
the published vectors for "", "abc", "password" and a 1000-byte multi-block
input. The MySQL seed is read by counting handshake fields; a fixed offset
picked up the capability flags and made every login fail against a healthy
server, which the suite proves by neutralising the offset.

427 tools, 1637 end-to-end checks, 84.7% line coverage.
release-check exit 0, distcheck 1.100.0 passes 1637/1637 from the tarball.
2026-11-24 06:45:02 +00:00

1310 lines
80 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# APEX TWIN
An offensive-security MCP server in C99 + POSIX. One static binary, libc only,
no Python in the serving path. It gives an agent real reconnaissance and real web
testing behind a scope gate that refuses everything until a rules-of-engagement
file says otherwise.
**427 tools · 1637 end-to-end checks · 240 fuzz cases · 84.7% line coverage · ~1402 KiB**
```
$ ./apex-twin --check
{"version":"1.100.0","tools":427,...,"scope":{"loaded":true,...}}
```
APEX TWIN was inspired by [ARTEX](https://github.com/Autumn-27/artex) (scope
gates, findings with evidence, budgets). The C implementation is written from
nothing; it takes the ideas, not the code.
---
## What it is, and what it is not
**It is** a tool server for one operator, covering both sides of an engagement:
- **red**: a real TCP connect scan, nmap/dig/openssl through gated child
processes, HTTP requests and header audits, CORS and cookie checks, path
discovery, SQLi/XSS lead probes, exposed-artifact verification, subdomain
enumeration, default-credential checks;
- **blue**: a read-only host posture audit, auth-log brute-force summary and an
indicator scan for persistence and remote-execution strings;
- **hardware**: the ESP32 Marauder CLI and ESP32 board tools (chip identity,
serial monitor, flash dump).
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`): 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,
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.
The MCP client is the agent. This process is the gate, the tools and the records.
---
## The gate is the product
A tool never decides for itself whether a target is fair game. Every tool that
can touch a network calls one of two helpers from `src/tools.h`:
```c
gated(c, "nmap", target, port); /* scope check, no action */
gated_cmd(c, "nmap", target, port, argv, timeout, NULL); /* scope check + spawn */
```
Both consult `apex_scope_check()`, write the audit line **before** the action,
and refuse with `mcp_reply_error` naming the reason. `scope_check` is the same
decision without an action, for planning.
`tests/gate_audit.py` enforces the invariant statically: it parses every
`TOOLS_*[]` table and handler body and fails if a tool whose schema names a
`target` does not call the gate (four record filters excepted), or if a handler
opens a socket or spawns a process without it. `make test` runs that audit before
the suite.
### Rules, in the order they are applied
| # | Rule | Result |
|---|---|---|
| 1 | no scope file loaded | deny everything |
| 2 | scope expired | deny everything |
| 3 | target in `deny_ip` | deny (**deny beats allow**) |
| 4 | `port > 0` and not in `allow_port` | deny |
| 5 | target in neither `allow_ip` nor `allow_domain` | deny |
| 6 | private/loopback/link-local and `allow_private` is false | deny |
| 7 | a name outside `allow_domain` that does not resolve entirely inside `allow_ip` | deny |
Notes that matter:
- `port <= 0` means **the caller enumerates ports itself** (used by `portscan`,
which filters every probe with `apex_port_in_scope()`). It is not a wildcard
for a single-port action.
- A name in `allow_domain` is trusted for its addresses, but while
`allow_private` is false it may not resolve into a private network.
- A name outside `allow_domain` must resolve, and every address it returns must
be inside `allow_ip`; an unresolvable name is refused, never waved through.
- `*.example.com` matches subdomains only; `example.com` matches the apex and its
subdomains. A trailing FQDN dot and an embedded `host:port` are normalised
before the check.
No scope file means no engagement. That is deliberate: a default that scans
something is a liability, not a convenience.
---
## Quick start
```sh
make # build (zero warnings under -Werror)
mkdir -p ~/.local/state/apex-twin
cat > ~/.local/state/apex-twin/scope.json <<'EOF'
{
"label": "lab",
"expires": "2099-12-31T23:59:59Z",
"allow_private": false,
"serial_tx": false,
"allow_ip": ["192.0.2.0/24"],
"deny_ip": ["192.0.2.66"],
"allow_domain": ["example.com"],
"allow_port": ["80", "443", "8000-8100"]
}
EOF
apex-twin --check # is the scope loaded, what is the tool count?
apex-twin # MCP over stdin/stdout
```
An MCP client then calls `scope_show`, `portscan`, `http_headers`,
`finding_add`, `report_markdown`, and so on. A minimal stdio exchange:
```json
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"scope_check","arguments":{"target":"192.0.2.5","port":80}}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"http_headers","arguments":{"target":"example.com","port":80,"path":"/"}}}
```
---
## Transports and modes
| Mode | Command | Listener |
|---|---|---|
| MCP over stdio | `apex-twin` | none |
| MCP over HTTP | `apex-twin --http 8797` | `127.0.0.1:8797`, `POST /mcp` |
| Forward proxy | `apex-twin --proxy 8798` | `127.0.0.1:8798` |
| Diagnostics | `apex-twin --check` | none; prints JSON and exits |
| Version | `apex-twin --version` | none |
Both listeners bind **loopback only** and do not authenticate. Reach them
through an SSH tunnel or a VPN; never put them on a LAN interface. The HTTP face
serves at most `APEX_HTTP_MAX_CHILDREN` connections at once (503 beyond) and
closes a request whose head or body does not arrive within
`APEX_HTTP_HEAD_TIMEOUT_MS`.
`--check` reports the operational state without starting a server:
`rewrite_rules`, `webhook_configured` (a boolean; the URL is never printed),
`proxy_max_children`, `audit_max_bytes`, `http_max_children`,
`http_head_timeout_ms`, `evidence_max_bytes` and the loaded scope.
---
## Tools (427)
### Scope and bookkeeping
| Tool | What it does |
|---|---|
| `scope_show` | The loaded rules of engagement as JSON |
| `scope_check` | Ask the gate about one target/port without touching it |
| `scope_reload` | Reload the scope file, optionally from another path |
| `capabilities` | State dir, programs present, limits, dry-run flag |
| `audit_log` | The newest audit lines (one JSON object per decision) |
| `evidence_save` | Store a raw proof blob (`APEX_EVIDENCE_MAX_BYTES` cap) |
| `notify_test` | Fire the configured webhook once and report the result |
### Command guard
| Tool | What it does |
|---|---|
| `guard_check` | May this shell line run? Deny rules first, then the scope of every URL/IP/host in it |
`guard_check` exists for the half of the work that happens in the operator's own
shell. It tokenises the command, applies the deny rules, and only then checks
targets. Order is the contract: `rm -rf / <out-of-scope-url>` is refused for the
delete, not for the URL.
Deny rules: recursive `rm`/`chmod` on a system path, `rm -rf *` after `cd` into
one, `find -delete`, `dd`/`mkfs`/`wipefs`/`mkswap`/`shred` on a device,
`shutdown`/`reboot`/`halt`/`init 0|6`/`kill 1`, `systemctl stop|disable|mask`,
firewall flushes (`iptables -F/-X`, `nft flush`, `ufw disable`, `pfctl -F`), a
pipe into an interpreter that reads stdin, `nc -e`/`socat EXEC:`, and writes or
`mv` into `/etc`. It also notes (but allows) `sudo`, world-writable `chmod 777`,
uploads and secret-file reads. It does not execute anything.
### Network reconnaissance
| Tool | What it does |
|---|---|
| `portscan` | TCP connect scan in-process; no nmap needed; per-probe scope filter |
| `nmap` | Profiles: `quick`, `default` (top-100 + `-sV`), `full` (`-p-`), `udp`, `vuln`, `http` |
| `dns` | `dig` for A/AAAA/MX/TXT/NS/SOA/CNAME/SRV/CAA/PTR |
| `whois` | Registration and netblock record; speaks to port 43, so allow it |
| `tls_cert` | `openssl s_client` chain and verification for `host:port` |
| `banner` | Read the first bytes a service sends |
| `http_head` | Request the head of a URL and return it verbatim |
### Web
| Tool | What it does |
|---|---|
| `http_request` | Any method, headers and body; response verbatim |
| `http_headers` | Audit HSTS/CSP/frame/nosniff/referrer/permissions with reasons |
| `http_paths` | Built-in wordlist: `.git`, `.env`, admin, actuator, swagger, backups |
| `cors_check` | Marker `Origin`; grades reflection with credentials as high risk |
| `http_redirect_audit` | Follows redirects per hop inside the scope; flags HTTPS-to-HTTP downgrades |
| `hsts_audit` | HSTS max-age, includeSubDomains and preload, or a missing header |
| `tls_hostname_check` | SAN/CN wildcard match for the requested SNI name |
| `ftp_tls_probe` | `AUTH TLS` -> 234 means explicit FTPS; otherwise cleartext |
| `zookeeper_4lw_probe` | `stat`/`mntr` answered without auth leaks version and state |
| `etcd_api_probe` | `/version`, `/health`, `/v2/keys` without a token; 2xx is open access |
| `docker_registry_probe` | `/v2/` and `/v2/_catalog` without auth; catalog saved as evidence |
| `consul_api_probe` | `/v1/agent/self` and `/v1/catalog/services` without a token |
| `couchdb_probe` | `/` welcome and `/_all_dbs` without auth; database list as evidence |
| `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 |
| `nats_monitoring_probe` | `/varz` and `/connz` without auth; varz answer as evidence |
| `influxdb_probe` | `/ping` and `/query?q=SHOW DATABASES` without auth; answer as evidence |
| `clickhouse_probe` | `/ping` and `SELECT version()` without auth; version as evidence |
| `kibana_api_probe` | `/api/saved_objects/_find` without auth; answer as evidence |
| `logstash_api_probe` | `/_node/info` and `/_node/stats` without auth; stats as evidence |
| `amqp_probe` | AMQP 0-9-1 Connection.Start: product, version, mechanisms, no login |
| `tls_chain_probe` | Counts presented certs; a lone non-self-signed leaf means a missing intermediate |
| `smtp_auth_probe` | EHLO AUTH mechanisms; PLAIN/LOGIN without STARTTLS is a clear-text risk |
| `jenkins_api_probe` | `/api/json` and `/whoAmI` without auth; job list as evidence |
| `nexus_probe` | `/service/rest/v1/repositories` without auth; list as evidence |
| `gitea_api_probe` | `/api/v1/admin/users` without auth; admin list as evidence |
| `harbor_probe` | `/api/v2.0/projects` without auth; project list as evidence |
| `portainer_probe` | `/api/status` and `/api/users/admin/check`; setup-open or unauth admin check |
| `argocd_probe` | `/api/v1/applications` without a token; deployed apps as evidence |
| `kafka_connect_probe` | `/connectors` on 8083 without auth; connector list as evidence |
| `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 |
| `vault_probe` | `/v1/sys/mounts` on 8200 without a token; mount list as evidence |
| `nomad_probe` | `/v1/jobs` on 4646 without a token; job inventory as evidence |
| `coredns_probe` | plugin API `/config/` on 2019 without a token; server blocks as evidence |
| `openbmc_probe` | xyz.openbmc_project control tree on 443 without a session; power policy as evidence |
| `schema_registry_probe` | `/subjects` on 8081 without auth; subject list as evidence |
| `airflow_probe` | `/api/v1/dags` without auth; DAG inventory as evidence |
| `loki_probe` | `/loki/api/v1/labels` on 3100 without auth; label names as evidence |
| `tempo_probe` | `/api/search/tags` on 3200 without auth; tag names as evidence |
| `jaeger_probe` | `/api/services` on 16686 without auth; service list as evidence |
| `solr_probe` | `/solr/admin/cores` on 8983 without auth; core list as evidence |
| `confluence_probe` | `/rest/api/space` on 8090 without a token; space list as evidence |
| `bitbucket_probe` | `/rest/api/1.0/projects` on 7990 without a token; project list 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 |
| `ollama_probe` | `/api/tags` on 11434 without auth; pulled model list as evidence |
| `cadvisor_probe` | `/api/v1/containers` on 8080 without auth; container list as evidence |
| `teamcity_probe` | `/app/rest/projects` and `/app/rest/users` without auth; project and user list as evidence |
| `superset_probe` | `/api/v1/dashboard/` on 8088 without a session; dashboard list 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 |
| `xss_probe` | Marked payload; returns the reflection context |
| `curl` | `curl` for a gated path when the operator wants its behaviour |
### Traffic and evidence
| Tool | What it does |
|---|---|
| `http_capture` | One request and the raw response stored as a pair |
| `traffic_list` | Captures, newest last, filterable by target |
| `traffic_read` | One pair back as text, or base64 when the bytes are not text |
| `evidence_list` | Saved proof blobs, newest first |
| `evidence_read` | One blob back, text or base64 |
### Inventory and findings
| Tool | What it does |
|---|---|
| `asset_add` | Gated inventory entry; merges by target and unions ports |
| `asset_list` / `asset_read` / `asset_update` | Inventory access, atomic updates |
| `finding_add` | Record a finding; duplicate target+title returns the existing id |
| `finding_list` / `finding_read` | Query findings |
| `finding_update` | Lifecycle `open`/`confirmed`/`false-positive`/`fixed`, severity, note |
| `report_markdown` | Markdown, CSV or JSON report written under `$APEX_HOME/reports` |
### Radio (ESP32 Marauder)
| Tool | What it does |
|---|---|
| `marauder_info` | Ask `info` and `help`; refuses a device that looks like a console |
| `marauder_commands` | The allowlist and which commands transmit |
| `marauder_cmd` | One allowlisted command, output returned |
| `marauder_scan` | A receive-only scan for N seconds, always ending in `stopscan` |
The serial guard sends a bare CRLF and refuses on console markers (`login:`,
`password:`, `console (`, …). Transmission requires `serial_tx: true` **and** a
command in the allowlist: a receiver is a scanner, a transmitter is an attack.
### Red team
| Tool | What it does |
|---|---|
| `vuln_check` | Non-destructive verification of `/.git/HEAD`, `/.env` (keys only, values redacted), directory listing and `phpinfo`; raw response saved as evidence |
| `subdomain_enum` | Built-in wordlist (or your names) under one in-scope domain; every name is gate-checked before it is resolved |
| `cred_test` | HTTP Basic default credentials, max 20 attempts, 200 ms apart, stops on 429, refuses an endpoint that answers without auth |
| `auth_test` | Real login attempts against one in-scope service: http, ftp, smtp, imap, pop3, mysql. Your wordlists, your delay, your attempt ceiling, your stop conditions; a hit is the protocol's own accept code, saved as evidence and recorded as a finding |
| `auth_plan` | Count a credential run (pairs, delay total) without connecting |
| `auth_protocols` | The protocols `auth_test` speaks and their default ports |
| `auth_hits` | The credential findings so far, with the evidence file that holds the pair |
| `vhost_discovery` | Host-header fuzzing against one in-scope IP; reports names whose status, byte count or title differs from the baseline, with evidence |
| `http_brute` | Built-in, comma or file wordlist for hidden paths; 200/201/204/3xx/401/403 are hits, 100 ms apart, evidence for the first five 200s |
| `ssrf_probe` | Injects a URL parameter pointing at its own loopback listener (or your `callback_base`) and confirms a real fetch; never targets metadata endpoints |
| `jwt_audit` | Offline JWT audit: alg/typ/kid, iss/aud/sub/exp/iat/nbf, alg=none, expired, missing exp, path-like kid; HS256 signature verified with `secret=` |
| `hash_id` | Identify a hash shape: MD5/NTLM, SHA-1/256/512, bcrypt, Argon2, crypt(3) formats, JWT |
| `param_fuzz` | Marker, quote and `{{1337*7}}` per parameter; reports reflection, SQL/stack/template errors and template evaluation |
| `open_redirect` | Sends an external marker URL and a protocol-relative variant; reports Location/meta-refresh redirects with evidence |
| `host_header_injection` | Canary as Host and X-Forwarded-Host; reports reflection in body or Location, with baseline size |
| `ssti_probe` | Five template payloads with expected results; reports evaluation, reflection or template errors and the likely engine |
| `xxe_probe` | XML with an external entity pointing at its own loopback listener; callback proves the parser resolved it |
| `ldap_probe` | LDAPv3 anonymous bind plus rootDSE read (namingContexts, vendorName, supportedLDAPVersion) |
| `rdp_probe` | X.224 connection request; reports the selected protocol (RDP/TLS/CredSSP/RDSTLS) and NLA, or the failure code |
| `smb_probe` | SMB2 NEGOTIATE with five dialects; reports dialect, signing, capabilities, max sizes and server GUID |
| `vnc_probe` | RFB version and offered security types; flags None authentication |
| `mqtt_probe` | MQTT 3.1.1 CONNECT without credentials; CONNACK code, anonymous broker detection |
| `graphql_probe` | Introspection query: schema exposed, type count, query/mutation names, evidence |
| `docker_api_probe` | Unauthenticated `/version` and `/containers/json`: engine version, container/running counts, names, images |
| `elasticsearch_probe` | Unauthenticated `/`, cluster health and index list: cluster, version, status, node and index counts |
| `http_methods` | OPTIONS Allow list and TRACE echo detection; names PUT/DELETE but never sends them |
| `websocket_probe` | Upgrade handshake: 101, Upgrade/Connection and Sec-WebSocket-Accept |
| `websocket_origin_check` | Two unrelated Origins; both 101 means Origin is not enforced (CSWSH) |
| `dns_fcrdns_check` | PTR then A/AAAA; a forward answer without the address fails FCrDNS |
| `dns_soa_mname_check` | SOA MNAME must be one of the zone's NS records |
| `ike_probe` | IKEv2 SA_INIT (AES-CBC-128/HMAC-SHA2-256/DH14); version, exchange, notify, responder SPI |
| `snmp_walk` | GETNEXT over the system group: OID, name and decoded value (string, integer, timeticks, OID) |
| `ldap_search` | Anonymous subtree search (size limit 20) from namingContexts; DNs plus cn/uid/mail |
| `openapi_discovery` | Six usual spec paths: OpenAPI/Swagger version, title and path count, evidence |
| `csrf_audit` | Forms on one page: action, method, input count and missing CSRF token fields |
| `rpc_probe` | ONC RPC portmapper DUMP: program/version/protocol/port mappings with service names |
| `ntp_probe` | NTPv4 client packet: version, mode, leap, stratum, refid, root delay/dispersion, time |
| `api_auth_audit` | Unauthenticated GETs over an endpoint list: status, JSON, open vs 401/403, evidence |
| `cache_audit` | Clean vs parameterized URL: Cache-Control/Age/Vary/X-Cache, parameterized-cacheable finding |
| `tls_cipher_matrix` | Weak cipher list per TLS version; reports which suites negotiate |
| `smb_null_session` | SMB 2.1 negotiate, anonymous session, IPC$ tree connect |
| `smb_shares` | Share-name dictionary over the anonymous session; reports reachable shares and NT status |
| `email_security_audit` | SPF, DMARC, DKIM and MX via gated dig; policy and gaps |
| `smtp_open_relay` | EHLO/MAIL/RCPT for an external recipient; open relay detection, no DATA |
| `dns_open_resolver` | One recursive query against an in-scope resolver; answer means open |
| `crlf_probe` | Encoded CRLF in one parameter; detects an injected response header |
| `dns_version_bind` | CHAOS TXT version.bind/hostname.bind; reports version disclosure |
| `ntp_monlist_probe` | Mode-7 MON_GETLIST; monlist enabled, entry estimate, amplification |
| `oidc_discovery` | OpenID/OAuth metadata: issuer, auth/token/JWKS/userinfo endpoints, evidence |
| `security_txt` | security.txt Contact/Expires/Policy; expired documents flagged |
| `http2_probe` | ALPN h2 over TLS or h2c preface/SETTINGS; reports HTTP/2 support |
| `ssh_hostkey_fingerprint` | ssh-keyscan or saved output: key type, bits, SHA-256 fingerprint |
| `kerberos_discovery` | DNS SRV for _kerberos._tcp/_udp and _kpasswd._tcp: KDC priority/weight/port/target |
| `winrm_probe` | GET /wsman: 401/405 with Negotiate/NTLM/Kerberos identifies WinRM; evidence on hit |
| `dnssec_check` | DNSKEY/DS with +dnssec: signed, algorithm, key bits; flags unsigned/RSASHA1/short keys |
| `smtp_starttls_probe` | EHLO/STARTTLS and a real TLS upgrade via openssl s_client -starttls smtp |
| `tls_ocsp_probe` | `s_client -status`: stapled or not, OCSP response and certificate status |
| `alpn_probe` | Per-protocol `s_client -alpn`: which of h2/http1.1/spdy3.1 the server selects |
| `webdav_probe` | OPTIONS + Depth:0 PROPFIND: 207 Multistatus means WebDAV is enabled |
| `dns_wildcard_check` | Random label under a domain; an answer means wildcard DNS |
| `dns_caa_check` | CAA records: flags, issue/issuewild/iodef tags and values |
| `sni_vhost_check` | Per-name `s_client -servername`: distinct certificate subjects/fingerprints |
| `tls_client_auth_probe` | `s_client -msg`: CertificateRequest means mutual TLS required |
| `kubernetes_api_probe` | Unauthenticated `/version`, `/api`, `/apis`, `/healthz`; 2xx is open access |
| `dns_ns_consistency` | Parent vs authoritative NS sets; reports names missing on either side |
| `dns_dangling_cname` | Follows a CNAME chain; NXDOMAIN at the end means a takeover target |
| `imap_probe` | Banner, CAPABILITY list, STARTTLS and LOGINDISABLED; no LOGIN |
| `pop3_probe` | Banner, CAPA list, STLS flag; no USER/PASS |
| `sip_probe` | One UDP OPTIONS: status line, Server header, Allow methods |
| `telnet_probe` | Banner plus IAC WILL/WONT/DO/DONT decoding; sends nothing |
| `ftp_probe` | One FTP connection: banner, FEAT list, and whether the literal anonymous pair is accepted (audited) |
| `smtp_probe` | One SMTP connection: banner, EHLO extensions, VRFY of up to 8 users classified exists/unknown/cannot-verify |
| `ssh_audit` | Banner plus KEXINIT lists (kex, host key, ciphers, MACs) and deprecated algorithms flagged |
| `tls_audit` | TLS 1.0–1.3 probes, negotiated ciphers, weak-version/cipher flags, certificate subject/issuer/dates/SANs |
| `redis_probe` | PING/INFO/DBSIZE on one connection; reports open access, version, role, clients, dbsize |
| `snmp_probe` | Hand-built SNMPv1/v2c GET sysDescr.0 over UDP for up to four communities; raw answer as evidence |
| `dns_zone_transfer` | `dig AXFR` against one in-scope server and zone; record counts per type, raw records, evidence |
| `mysql_probe` | Initial handshake: server version, thread id, auth plugin, capability flags (TLS, plugin auth) |
| `postgres_probe` | SSL offer plus one StartupMessage; reports trust/cleartext/md5/SCRAM/rejected and the server message |
| `mongo_probe` | Hand-built OP_QUERY `isMaster` on `admin.$cmd`: ok, maxWireVersion, writable primary |
| `memcached_probe` | One `stats`: open access, version, connections, items, memory limit, uptime |
| `cassandra_probe` | CQL native protocol on 9042: OPTIONS/SUPPORTED, then STARTUP; READY means no authentication |
### Exploit framework
| Tool | What it does |
|---|---|
| `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, 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, json) |
Modules: `shellshock` (CVE-2014-6271), `log4shell` (CVE-2021-44228),
`struts2_s2045` (CVE-2017-5638), `tomcat_put` (CVE-2017-12617),
`redis_write` (CVE-2022-0543), `cmd_inject`, `traversal`
(CVE-2021-41773/42013), `jenkins_script`. The gate decides the target; the
operator decides everything else.
### Authentication testing
`auth_test` tries credentials against one in-scope service. Protocols: `http`
(Basic), `ftp`, `smtp` (AUTH LOGIN), `imap`, `pop3` and `mysql`
(`mysql_native_password`, scrambled the way the server expects).
You supply the users and passwords — inline as a comma list or as a file with
one entry per line — and every knob of the run:
| Parameter | Meaning |
|---|---|
| `users` / `userlist` | comma list, or a file with one user per line |
| `passwords` / `passlist` | the same for passwords |
| `delay_ms` | pause between attempts, default 0 |
| `max_attempts` | hard ceiling, default all pairs |
| `stop_on_hit` | stop at the first accepted pair |
| `lockout_limit` | consecutive rate-limit answers that end the run; 0 disables |
| `timeout_ms` | per connection, default 10000 |
A hit is the protocol saying so: 235, `+OK`, 230, `a1 OK`, a MySQL OK packet,
or an HTTP 2xx/3xx. Anything else is a miss — including a 404 or a 500, which
say nothing about credentials — and a connection that dies is counted as an
error rather than as a refused password.
An accepted pair becomes a `critical` finding whose evidence file holds the
pair and the answer it got; the audit log records the account and the service
but never the password, so the log can be shared and the evidence cannot.
`auth_plan` counts a run before it happens (pairs, delay total, first users)
without connecting. `auth_protocols` lists the protocols and default ports.
`auth_hits` shows the credential findings so far with their evidence paths.
### External scanners (gated wrappers)
| Tool | What it does |
|---|---|
| `nuclei_scan` | Template scan of one in-scope URL; `-jsonl` output saved as evidence |
| `nikto_scan` | Web server scan of one in-scope host; the report is evidence |
| `ffuf_scan` | Content discovery with a wordlist the operator already has |
| `gobuster_scan` | Directory, DNS or vhost brute force with an existing wordlist |
| `sqlmap_scan` | SQL injection verification in `--batch`; no shell, no file read |
| `hydra_scan` | Login testing against one in-scope service; a hit is a finding with the tool's own output as evidence |
| `medusa_scan` | Same for medusa; `[SUCCESS]` or exit 1/2 is the hit, the raw output is the evidence |
| `msfvenom_build` | Renders the operator's payload locally (no target); the bytes are saved as evidence |
Every wrapper follows the same three rules: the target goes through
`gated_run()` so the scope gate and the audit line happen **before** anything
executes; each argument is checked against a per-tool allowlist and a flag that
is not on it is refused rather than passed through; and there is no shell —
argv is built in C and handed to `exec`, so no string is ever parsed by
`/bin/sh`. A missing binary is a plain sentence from `apex_have()`, not exit
127 in the middle of a scan.
Three flags are refused on purpose, and not for taste: hydra `-M`, medusa
`-H`/`-C` and hydra/medusa host files read their targets out of a file the
gate never sees, so the gate would be checking one host while the tool walks
another. Those stay out until the file is parsed and each entry checked. The
msfvenom mode switches (`-l`, `--list`, `--help`, `--refresh-cache`) are out
for a different reason: they print and exit without building anything, and the
tool would then report a payload it never rendered.
### Blue team
| Tool | What it does |
|---|---|
| `hardening_audit` | Read-only local posture: sshd_config, sysctl, `/etc/shadow` mode, world-writable `/etc` dirs, listening sockets, firewall files, SUID count; scored findings |
| `log_audit` | Auth-log summary: failures per IP (flagged at 5+), invalid users, accepted logins; paths limited to `/var/log/` and the state dir |
| `ioc_scan` | Walk a directory for `/dev/tcp` shells, `bash -i`, `base64|sh`, `curl|sh`, `nc -e`, `socat EXEC:`, setuid chmod, systemd units under `/tmp` |
| `web_log_audit` | nginx/apache access log: status split, top IPs, scanner UAs, SQLi/traversal/XSS patterns (URL-decoded), 4xx/5xx bursts |
| `detect_rules` | Sigma, Suricata and YARA skeletons per finding under `$APEX_HOME/detections/`; templates that need tuning |
| `integrity_baseline` | SHA-256 manifest of a tree (`create`) and a changed/missing/added report (`verify`), no external tools |
| `mitre_map` | Map findings to ATT&CK techniques by title/tool/tags/CWE, with finding ids per technique |
| `process_snapshot` | Read `/proc`: exe/fd count per process, flags /tmp or deleted executables, reverse-shell command lines, >256 fds |
| `persistence_audit` | Cron, systemd units/timers and at jobs: flags /tmp paths, curl/wget piped to a shell, base64-to-shell, nc -e/socat, bash -i, setuid chmod |
| `net_baseline` | Listening TCP ports with owning process names (`create`/`verify`); reports new, gone and process-changed ports |
| `ssh_key_audit` | authorized_keys and private keys: unrestricted entries, ssh-rsa/ssh-dss, duplicates, loose permissions |
| `suid_baseline` | SUID/SGID SHA-256 manifest (`create`/`verify`); reports planted, removed and changed setuid binaries |
| `cap_baseline` | File capability xattr manifest (`create`/`verify`); reports new, gone and changed capability sets |
| `module_audit` | Loaded modules and taint letters, kernel taint bits decoded (proprietary, out-of-tree, unsigned, ...) |
| `package_integrity` | `dpkg -V` / `rpm -V` changed files, optionally one package or a saved verify output |
| `mount_audit` | Mount table hardening: temp/shm mounts missing nosuid/nodev/noexec, home/media/mnt missing nosuid/nodev |
| `firewall_audit` | `nft list ruleset` / `iptables-save` (or saved dump): chain/rule counts and ACCEPT default policies |
| `systemd_audit` | Units: ExecStart in /tmp, missing User= (root), world-writable files, .wants links |
| `kernel_hardening` | Sysctl hardening set (ASLR, kptr, dmesg, perf, BPF, ptrace, symlinks, core_pattern) with score |
| `sudoers_audit` | NOPASSWD, !authenticate, broad ALL, direct user rules, world-writable sudoers |
| `auditd_audit` | auditd type counts, AVC denials, failed auth, top exe paths and keys |
| `ssh_config_audit` | sshd_config scoring: root login, passwords, tunnels, forwardings, legacy ciphers/MACs/kex |
| `pam_audit` | pam.d: pam_permit, pam_unix nullok, pam_exec and missing faillock/tally lockout |
| `log_timeline` | Merge auth and access logs into one sorted chronology with source tags |
| `docker_audit` | docker.sock mode, docker group members, daemon.json TCP/TLS/insecure registries |
| `www_audit` | Web roots: world-writable content, .env/config/keys, backups, .git, missing index |
| `apparmor_audit` | Profile list: enforce/complain counts, complain profiles named |
| `selinux_audit` | enforce, SELINUX=/SELINUXTYPE=, boolean count; disabled/permissive findings |
| `audit_rules` | audit.rules/rules.d: rule count, -e 2, execve, watches on passwd/shadow/sudoers/group |
| `usb_audit` | sysfs USB devices: IDs, strings, serial, mass-storage interface flagged |
| `ssh_known_hosts_audit` | known_hosts: hashed vs plain, ssh-rsa/ssh-dss, duplicates |
| `logrotate_audit` | logrotate configs: world-writable, low rotate, no compress, unsafe postrotate |
| `nfs_exports_audit` | exports/`: *`, writable (no ro), no_root_squash |
| `samba_audit` | smb.conf shares: root path, guest access, writable, no valid users |
| `snmpd_audit` | snmpd.conf communities: ro/rw/com2sec, public/private, default source |
| `rsyslog_audit` | rsyslog remote targets, world-writable configs, missing auth logging |
| `postfix_audit` | main.cf: mynetworks all-addresses, relay without reject_unauth_destination, optional TLS, writable config |
| `nginx_audit` | nginx.conf/conf.d/sites-enabled: server_tokens, autoindex, TLSv1/1.1, legacy ciphers, writable files |
| `redis_config_audit` | redis.conf: no requirepass, protected-mode no, bind-all, debug command, /tmp data dir |
| `mysql_config_audit` | my.cnf: bind-all, skip-grant-tables, local-infile, empty secure-file-priv, writable files |
| `apache_audit` | Apache: ServerTokens Full/OS, Options Indexes, AllowOverride All, SSLv3/TLSv1, signature |
| `haproxy_audit` | haproxy.cfg: stats socket mode, stats auth, bind 443 without ssl, writable config |
| `php_config_audit` | php.ini: expose_php, display_errors, URL include/fopen, disable_functions, cookie_secure |
| `dovecot_audit` | dovecot.conf: ssl = no, plaintext auth, PLAIN mechanism, writable drop-ins |
| `openvpn_audit` | server.conf: no tls-auth/tls-crypt, BF-CBC/DES, SHA1/MD5 HMAC, duplicate-cn |
| `postgresql_config_audit` | postgresql.conf/pg_hba.conf: listen-all, ssl off, trust, md5/password |
| `exim_audit` | exim.conf: relay_from_hosts all, accept-any, no TLS advertisement, writable config |
| `elasticsearch_config_audit` | elasticsearch.yml: network.host all, security disabled, single-node |
| `squid_audit` | squid.conf: http_access allow all, open http_port, cache in /tmp, writable config |
| `unbound_audit` | unbound.conf: interface all, access-control allow all, missing DNSSEC anchor |
| `cups_audit` | cupsd.conf: Listen all, Browsing On, Location Allow All, writable config |
| `rsync_audit` | rsyncd.conf: wildcard hosts allow, uid/gid 0, no chroot, readable secrets |
| `dhcpd_audit` | dhcpd.conf: authoritative, weak ddns, missing DNS option, range outside subnet |
| `krb5_conf_audit` | krb5.conf: DNS lookup off, rdns on, legacy enctypes, writable config |
| `mongodb_config_audit` | mongod.conf: bindIp all, authorization off, TLS disabled |
| `memcached_config_audit` | memcached.conf: listen all, UDP enabled (no -U 0), 8 GiB+ memory |
| `ntpd_config_audit` | ntp.conf: weak/missing restrict, no disable monitor, drift in /tmp |
| `bind9_config_audit` | named.conf: allow-query any, open recursion, transfer any, visible version |
| `tomcat_audit` | server.xml/tomcat-users.xml: shutdown port, 0.0.0.0 connector, manager roles |
| `proftpd_audit` | proftpd.conf: AllowAll, anonymous without AnonReadOnly, RootLogin, TLS off |
| `kubelet_config_audit` | kubelet config.yaml: anonymous auth, AlwaysAllow, readOnlyPort |
| `etcd_config_audit` | etcd config: 0.0.0.0/http URLs, client/peer cert auth off, auto-tls |
| `rabbitmq_audit` | rabbitmq.conf: loopback removed, guest/guest, management without TLS |
| `consul_config_audit` | consul.hcl: ACL allow, bind 0.0.0.0, verify flags off, no gossip encryption |
| `vault_config_audit` | vault.hcl: tls_disable, UI on, mlock off, Shamir without auto-unseal |
| `zookeeper_audit` | zoo.cfg: open 4lw whitelist, clientPortAddress all, missing authProvider |
| `grafana_audit` | grafana.ini: anonymous access, default admin password, plain HTTP, default secret |
| `prometheus_audit` | prometheus.yml/web.yml: no basic auth, no external labels, HTTP targets |
| `wireguard_config_audit` | wg conf: readable private key, 0.0.0.0/0 route, no ListenPort, curl pipe hooks |
| `ipsec_config_audit` | ipsec.conf/secrets: 0.0.0.0/0 subnet, PSK auth, no leftid, readable secrets |
| `openldap_config_audit` | slapd.conf: cleartext rootpw, anonymous bind, default read access |
| `cron_audit` | crontabs and cron.d: writable files/dirs, `curl \| sh` jobs |
| `fail2ban_audit` | jail.local/conf: disabled sshd jail, ignore-all, maxretry 0, no banaction |
| `chrony_config_audit` | chrony.conf: allow all, open command port, world-writable |
| `apt_config_audit` | apt.conf.d/sources: unsigned, insecure, trusted=yes, plain HTTP |
| `login_defs_audit` | login.defs: aging, PASS_MIN_DAYS 0, loose UMASK, DES/MD5 |
| `pg_hba_audit` | pg_hba.conf: `trust`, `0.0.0.0/0`, world-writable |
| `polkit_audit` | rules.d/pkla: `polkit.Result.YES`, `ResultAny=yes` |
| `ldap_client_audit` | ldap.conf: plaintext `ldap://` URI, `TLS_REQCERT never` |
| `ssl_cert_audit` | /etc/ssl/certs: expired, SHA-1, weak key, non-critical CA |
| `timesyncd_audit` | timesyncd.conf: no servers, public fallback, lax polling |
| `resolv_conf_audit` | resolv.conf: no/single/public nameserver, no search domain |
| `journald_audit` | journald.conf: volatile storage, forwarding, size, sealing |
| `coredump_audit` | coredump.conf: disk storage keeps cores, no compression |
| `nftables_audit` | nftables: accept policy, no conntrack, exposed admin ports |
| `dnsmasq_audit` | dnsmasq.conf: wildcard listener, missing bogus-priv/domain-needed |
| `nsswitch_audit` | nsswitch.conf: NIS compat, direct LDAP, hosts without files |
| `jenkins_audit` | config.xml: security off, AnyoneCanDoAnything, no CSRF, fixed agent port |
| `pgbouncer_audit` | pgbouncer.ini: trust auth, wildcard listen, readable auth file |
| `xinetd_audit` | xinetd: telnet/ftp/rsh enabled, no only_from, service as root |
| `sssd_audit` | sssd.conf: enumerate, cache_credentials, StartTLS off, reqcert never |
| `avahi_audit` | avahi-daemon.conf: workstation/address publication, no interface limit |
| `logind_audit` | logind.conf: idle ignore, lid ignore, IdleActionSec=0 |
| `tftpd_hpa_audit` | tftpd-hpa: `--create`, missing `--secure`, root directory |
| `iscsi_audit` | iscsid.conf: auto startup, no session/discovery CHAP |
| `rpcbind_audit` | rpcbind: `-w`, `-i`, no `-l` bind address |
| `kdump_audit` | kdump: remote target, no `-c`, shell/dump_to_rootfs action |
| `kafka_audit` | server.properties: PLAINTEXT listener, no authorizer, auto topics |
| `powerdns_audit` | pdns/recursor: open recursor, webserver, API key in the file |
| `varnish_audit` | VCL: open `acl purge`, management on 0.0.0.0 |
| `freeradius_audit` | clients.conf/users: default secret, no message authenticator |
| `containerd_audit` | config.toml: TCP gRPC without TLS, unpinned sandbox image |
| `nats_audit` | nats-server.conf: no authorization/TLS, open monitoring port |
| `caddy_audit` | Caddyfile: `:80`, auto_https off, tls internal, exposed admin |
| `traefik_audit` | traefik.yml: api insecure, no redirect, no TLS |
| `autofs_audit` | auto.master: wildcard maps, writable maps, timeout=0 |
| `gitea_audit` | app.ini: HTTP, open installer, empty SECRET_KEY |
| `minio_audit` | minio defaults: default root credentials, browser, HTTP |
| `nextcloud_audit` | config.php: debug, wildcard domain, HTTP, writable data |
| `zabbix_audit` | agent: any Server, remote commands, no TLS, unsafe UserParameter |
| `nrpe_audit` | nrpe.cfg: any allowed host, dont_blame_nrpe, shell commands |
| `unattended_upgrades_audit` | security-only origins, no auto reboot, no mail |
| `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 |
| `kibana_audit` | kibana.yml: 0.0.0.0, xpack off, credentials in file |
| `nagios_audit` | nagios.cfg/cgi.cfg: external commands, no SSL, CGI wildcard |
| `synapse_audit` | homeserver.yaml: open registration, no TLS |
| `logstash_audit` | logstash.yml: API on 0.0.0.0, monitoring off, no path.data |
| `filebeat_audit` | filebeat.yml: HTTP output, verification none, credentials |
| `fluentd_audit` | forward without shared key, HTTP output without TLS |
| `telegraf_audit` | HTTP output, insecure_skip_verify, credentials in file |
| `graylog_audit` | REST on 0.0.0.0, short password_secret, empty root hash |
| `netdata_audit` | bind 0.0.0.0, allow list `*`, missing allow list |
| `sshd_config_audit` | sshd_config(.d): root login, password auth, empty passwords |
| `hosts_access_audit` | hosts.allow/deny: `ALL: ALL`, missing deny rules |
| `profile_audit` | profile scripts: world-writable, loose umask, `.` in PATH |
| `atd_audit` | at.allow/deny: empty deny list, world-writable lists |
| `securetty_audit` | securetty: serial/console entries allow root login |
| `tmpfiles_audit` | tmpfiles.d: 0777/0666 modes, z/Z rules on /tmp |
| `compose_audit` | compose: privileged, host namespaces, docker socket, secrets |
| `k8s_manifest_audit` | manifest: privileged, host namespaces, root, hostPath / |
| `dockerfile_audit` | Dockerfile: root USER, :latest base, remote ADD, curl pipe |
| `openssl_cnf_audit` | openssl.cnf: MinProtocol TLSv1, SECLEVEL 0/1 |
| `curlrc_audit` | /etc/curlrc: `insecure`, plain-HTTP proxy |
| `wgetrc_audit` | /etc/wgetrc: `check_certificate=off`, plain proxy |
| `resolved_audit` | resolved.conf: public DNS, DNSSEC/DoT off, LLMNR/mDNS on |
| `udev_audit` | udev rules: MODE 0666, `RUN+=` downloads piped to a shell |
| `issue_audit` | /etc/issue: `\r`/`\v` version disclosure |
| `usbguard_audit` | allow without with-interface, implicit allow policy |
| `certbot_audit` | renewal: manual authenticator, curl-pipe hook |
| `wpa_supplicant_audit` | key_mgmt=NONE, WEP, readable PSK |
| `bluetooth_audit` | main.conf: auto enable, privacy off, JustWorks always |
| `networkmanager_audit` | connections: WEP, readable PSK, 802.1X without CA |
| `dbus_audit` | policy: `own="*"` and `send_destination="*"` |
| `passwd_audit` | duplicate UID 0, empty shadow hash, system login shells |
| `authorized_keys_audit` | writable keys/dirs, `command=` download pipes |
| `ld_preload_audit` | non-empty preload list, writable library |
| `gitconfig_audit` | gitconfig: sslVerify off, HTTP rewrite, store helper |
| `npmrc_audit` | npmrc: strict-ssl off, HTTP registry, cleartext token |
| `pip_conf_audit` | pip.conf: HTTP index, trusted-host override |
| `pam_env_audit` | environment/pam_env.conf: global LD_PRELOAD, writable PATH |
| `hosts_audit` | hosts: private pin, conflicting addresses, writable file |
| `dnf_repo_audit` | dnf/yum repos: gpgcheck off, sslverify off, plain http |
| `anacrontab_audit` | anacrontab and cron.d: root job out of /tmp, download piped to a shell |
| `motd_audit` | update-motd.d: writable script, missing shebang, URL fetch at login |
| `syslog_ng_audit` | syslog-ng: network source on all addresses, plaintext |
| `ntpd_audit` | ntp.conf: no default restrict, open restricts, monitor on |
| `inetd_audit` | inetd.conf: shell services, legacy cleartext daemons, writable file |
| `ld_so_conf_audit` | ld.so.conf: user-writable library path, world-writable dir |
| `rc_local_audit` | rc.local: remote pipe, /tmp reference, missing exit |
| `opendkim_audit` | opendkim.conf: inet socket, RequireSafeKeys off, Mode without `s` |
| `rspamd_audit` | rspamd UCL: wildcard bind_socket, clear-text password, secure_ip 0.0.0.0/0 |
| `spamassassin_audit` | local.cf: `required_score 0`, `report_safe 0`, RBL skipped, dead rule |
| `opendmarc_audit` | opendmarc.conf: `RejectFailures` off, reports off, auth clients skipped |
| `amavis_audit` | amavisd.conf: virus/spam `D_PASS`, bypass flags, no virus admin |
| `crypttab_audit` | crypttab: readable key file, `none` key, discard |
| `useradd_audit` | useradd defaults: empty INACTIVE, bad SHELL, writable skel |
| `aide_audit` | AIDE: `!` on /etc or /bin, md5-only rules, db in /tmp |
| `ufw_audit` | ufw: disabled, default ACCEPT, an open ACCEPT on a service port, writable rules |
| `monit_audit` | monitrc: public httpd, plain `allow user:pw`, writable config |
| `clamav_audit` | clamd/freshclam: public TCPSocket, exec hooks, LogRotate off |
| `modules_load_audit` | module lists: CIS-disabled modules, invalid names, duplicates |
| `depmod_audit` | depmod.d: absolute path first in `search`, `override` lines |
| `adduser_conf_audit` | adduser.conf: loose `DIR_MODE`, `USERGROUPS=no`, unlisted shell |
| `nfs_conf_audit` | nfs.conf: `vers2`/`vers3`, mountd `insecure`, `Sec=sys` only |
| `idmapd_audit` | idmapd.conf: no `Domain`, Nobody-User is a real account |
| `netplan_audit` | netplan: DNS without `dnssec`, interface without address source |
| `apt_auth_audit` | apt auth.conf: credentials over plain HTTP, world-readable/writable file |
| `aliases_audit` | aliases: mail piped into a command, root mail forwarded to another account |
| `netgroup_audit` | netgroup: member with an empty host field (matches any host) |
| `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 |
| `dhclient_audit` | dhclient.conf + hooks: DHCP resolver, supersede override, writable hook |
| `journal_upload_audit` | journal-upload.conf: plain http URL, missing client key |
| `fwupd_audit` | fwupd daemon.conf: OnlyTrusted off, empty DisabledPlugins |
| `smartd_audit` | smartd.conf: device without `-m`, writable `-M exec` hook, untyped DEVICESCAN |
| `tlog_audit` | tlog: scope without `session`, notice without `wall`, missing log target |
| `abrt_audit` | abrt.conf: autoreporting, public collector URL, no TLS verify |
| `freshclam_audit` | freshclam.conf: UpdateChecks off, http mirror, Checks below 2 |
| `fapolicyd_audit` | fapolicyd: permissive = 1, integrity = none, allow-all before deny |
| `systemd_timer_audit` | timers: every-minute interval, Persistent, service without User= |
| `yara_audit` | YARA: scanning disabled, writable or empty rule file |
| `suricata_audit` | suricata.yaml: empty rule-files, disabled engine, world-writable rules |
| `icinga2_audit` | API bound beyond localhost, accept_config, run_as_root commands, writable config |
| `falco_audit` | no rules_file, debug threshold, http webhook, writable rules |
| `promtail_audit` | positions in /tmp or missing, no tenant_id, http client URL, writable config |
| `otel_collector_audit` | exporters without tls, debug exporter, zpages/pprof, writable config |
| `fluentbit_audit` | remote output without `tls On`, HTTP on any interface, debug level, writable config |
| `vector_audit` | source on `0.0.0.0`, sink without tls, GraphQL API beyond loopback, writable config |
| `seccomp_audit` | empty or only-negating `SystemCallFilter`, root service without `NoNewPrivileges`, `SCMP_ACT_ALLOW` profile |
| `systemd_socket_audit` | `ListenStream` on every interface, world `SocketMode`, `Accept=yes` without `MaxConnections` |
| `tripwire_audit` | twcfg.txt: no site key, loose site key, no MAILTO |
| `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 |
| `podman_audit` | registries.conf: insecure or http registry, unsigned policy |
| `buildkitd_audit` | buildkitd.toml: insecure registry, tcp without CA, no rootless |
| `supervisor_audit` | supervisord.conf: exposed web UI, no username, root programs |
| `fstab_audit` | fstab: /tmp and friends without nosuid/nodev/noexec, user mounts |
| `modprobe_audit` | modprobe.d: `install` hooks that run a command as root |
| `grub_audit` | /etc/default/grub: mitigations=off, nokaslr, no init_on_alloc |
| `limits_audit` | limits.conf: unlimited nofile/nproc/memlock, core dumps |
| `access_conf_audit` | access.conf: `+ : ALL : ALL`, default-allow tail |
| `pwquality_audit` | pwquality.conf: minlen < 8, minclass 0, enforcing=0 |
| `pam_restrict_audit` | group.conf/time.conf: dead rule, unknown group, wildcard, bad time list |
| `pwhistory_audit` | pwhistory.conf: remember missing/0, root not enforced, bare sepermit separator |
| `firewalld_audit` | firewalld: PanicMode, CleanupOnExit=no, trusted default, ACCEPT target, unbound zone |
### ESP32
| Tool | What it does |
|---|---|
| `esp_info` | `esptool chip_id` on the serial port, plus USB VID/PID when sysfs exposes it |
| `esp_monitor` | Read the console for N seconds; sends nothing |
| `esp_read_flash` | Dump up to 4 MiB of flash into `evidence/` with `esptool read_flash` |
| `esp_flash` | `esptool write_flash` with mandatory `confirm=true`, absolute image, audited |
| `esp_partition_table` | Parse a flash dump's partition table at 0x8000 (0xAA50 entries, MD5 entry) |
| `esp_nvs_parse` | Parse an NVS partition dump: namespaces, keys, types, spans |
| `firmware_scan` | Signatures (ESP app, partition table, NVS, filesystems, PEM), 4 KiB entropy, strings |
| `esp_app_info` | App header and esp_app_desc_t: version, project, build date, IDF version, ELF hash |
| `esp_image_verify` | Segment table, XOR checksum and appended SHA-256; valid flag, OTA offset |
### Method
| Tool | What it does |
|---|---|
| `method_techniques` | 11 techniques across recon/enum/web/creds/AD/wifi/report, filterable |
| `method_playbook` | The ordered plan for a phase |
| `method_tool` | When to use a tool and the mistake that wastes the engagement |
---
## The proxy
```sh
apex-twin --proxy 8798
curl -x http://127.0.0.1:8798 http://target.example/
```
Every request passes the scope gate **before** the origin socket is opened, and
the decision is appended to `audit.log`. Plain HTTP is forwarded with the request
line rewritten to origin form, and the exchange is stored through the same
traffic store as `http_capture`. `CONNECT` is tunnelled blind and recorded as
metadata only: this binary links no TLS stack, so it does not pretend to see
inside TLS.
Each accepted connection gets its own child process: a tunnel does not block the
next request, and parallel captures cannot overwrite each other (traffic ids are
reserved with `O_EXCL`). At most `APEX_PROXY_MAX_CHILDREN` (default 64) children
run at once; beyond that the parent answers `503` with `proxy busy` and audits
the refusal.
Bodies: `Content-Length` and `Transfer-Encoding: chunked` are forwarded. A
chunked body is validated against a 1 MiB payload cap and relayed unchanged;
over the cap answers `413`, malformed framing `400`, both decided before the
origin is opened. Captured responses are capped at 1 MiB and marked truncated.
### Rewrite rules
`$APEX_HOME/rewrite.json` (`APEX_REWRITE` overrides) holds ordered rules:
```json
{"rules": [
{"match_host": "app.example.com", "match_path_prefix": "/api",
"set": [{"name": "X-Test", "value": "1"}],
"remove": ["User-Agent"], "note": "mark the request"},
{"match_host": "*", "match_path_prefix": "/admin",
"block": true, "note": "not part of this engagement"}
]}
```
The first matching rule is applied: `block` answers `403` with the note and a
deny line in the audit; `set` replaces a client header and adds missing ones;
`remove` drops one. The applied rule is named in the traffic record and audited.
`kill -HUP <pid>` reloads the file; an invalid file is rejected whole and the
previous rules stay active. The scope gate still runs first: a rule can narrow
what the proxy does, never widen the engagement.
---
## Findings, assets, traffic, reports
A finding starts `open`. `finding_update` moves it to `confirmed`,
`false-positive` or `fixed`, changes severity, confidence, remediation or tags,
and records why. Updates are written beside the old file and renamed, so a reader
sees one version or the other and never half of either. `finding_add` is
idempotent for the same target and title (case-insensitive, whitespace collapsed)
and returns `duplicate: true` with the existing id.
An asset is one record per target: a second observation merges into it, unions
the port list and replaces the service text with the latest reading.
A capture is a proof, not a memory: `tNNNN.http` holds the request bytes and the
raw response, `tNNNN.json` the metadata.
`report_markdown` renders everything into one file:
- **Markdown** — severity and lifecycle tables, one section per finding;
- **CSV** — stable columns, quoted fields;
- **JSON** — filters, counts by severity and status, the records themselves, and
the inventory when `include_assets` is set.
Filters: exact `target`, `min_severity`, `status`. Reports are opened `O_EXCL`:
a report is never overwritten. `save: false` renders without writing.
---
## Notifications
```sh
APEX_WEBHOOK=https://hooks.example/apex \
APEX_WEBHOOK_MIN_SEVERITY=high \
apex-twin
```
A finding at or above the floor is POSTed as JSON after it is on disk, and so is
the transition of a finding into `confirmed`. `notify_test` sends one event so
the path can be proven before anyone relies on it. The webhook is operator
infrastructure, not a target: it is **not** put through the scope gate, it is
called with argv (no shell), and a failing webhook never fails the finding.
---
## State directory
Everything lives under `$APEX_HOME` (default `~/.local/state/apex-twin`), created
0700; files are 0600:
```
scope.json the rules of engagement
audit.log one JSON line per decision, append-only
audit.log.1 previous audit file after size rotation
findings/f0001.json one finding per file
evidence/<ts>-<label>.bin raw proof
reports/report-<ts>.md Markdown / .csv / .json, never overwritten
assets/a0001.json one record per target, merged on the next look
traffic/t0001.json one capture: target, method, status, byte counts
traffic/t0001.http the request and the raw response
rewrite.json proxy rules (optional, reloaded on SIGHUP)
```
The audit line is written **before** the action, so a process that dies mid-scan
still left its intent on disk. When `audit.log` reaches
`APEX_AUDIT_MAX_BYTES` it is rotated to `audit.log.1` under `flock`, one previous
file kept. Audit lines are one `write()` each, so parallel proxy children cannot
interleave them.
Back up `audit.log`, `audit.log.1` and `evidence/` before deleting a state
directory; they may contain credentials, tokens or personal data from an
engagement.
---
## Security model
- **Loopback only.** The HTTP face and the proxy bind `127.0.0.1` and have no
authentication. Any local user who can reach the port can use the server
within the loaded scope. Run it as a dedicated user on a host you control.
- **The scope file is trusted input.** Writing it is equivalent to being the
operator.
- **Audit before action.** A missing audit line for a tool that touched the
network is a bug worth reporting.
- **Target content is data.** Responses are stored as bytes; the program does
not execute target content.
- **No TLS interception.** `CONNECT` is a blind tunnel, by design.
- **Memory safety is tested.** Scope, rewrite, HTTP and proxy parsers run under
ASan/UBSan in the suite and in three fuzzers; a sanitizer report is a test
failure.
The full threat model, trust boundaries and a hardening checklist are in
[SECURITY.md](SECURITY.md).
---
## Limits
| Limit | Value |
|---|---|
| HTTP MCP request body | 8 MiB (`413` over) |
| Proxy chunked request payload | 1 MiB (`413` over, malformed `400`) |
| Proxy response per capture | 1 MiB (marked truncated) |
| Concurrent proxy children | `APEX_PROXY_MAX_CHILDREN`, default 64, `503` beyond |
| Concurrent HTTP MCP connections | `APEX_HTTP_MAX_CHILDREN`, default 64 |
| HTTP request deadline (head + body) | `APEX_HTTP_HEAD_TIMEOUT_MS`, default 20000 |
| Evidence blob | `APEX_EVIDENCE_MAX_BYTES`, default 16 MiB |
| Audit file | `APEX_AUDIT_MAX_BYTES`, default 10 MiB, rotates to `.1` |
| Findings per report | 1024 |
| Tool timeout | default 60 s, hard cap 900 s |
| Radio scan | 3–300 s, always ends with `stopscan` |
| Credential attempts | 20 per call, 200 ms apart, stop on 429 |
| IOC scan | 20 000 files maximum, 100 findings, 1 MiB per file |
| Path brute force | 200 paths per call, 100 ms apart |
| vhost discovery | 100 names per call, 100 ms apart |
| Integrity baseline | 1000 files per call (max 5000), 1 MiB per file |
| SSRF probe | 3 loopback variants, 1.2 s callback wait |
| Service probes | One connection each; SMTP VRFY at most 8 users |
| Persistence audit | 2000 files per call, 1 MiB per file, 100 findings |
| TLS audit | 4 protocol probes + 2 certificate runs per call |
| SNMP | 4 communities, 2 attempts each, 1.8 s wait |
| Zone transfer | one server, one in-scope zone, 30 s |
| Database probes | one or two connections each; no password attempts |
| Param fuzz | 10 parameters × 3 probes per call, 100 ms apart |
| Net baseline | 500 ports; process lookup capped by /proc walk |
| SSTI | 5 payloads per call, 100 ms apart |
| SSRF/XXE callbacks | one loopback listener, 1.2 s wait per probe |
| RDP/SMB | one connection and one negotiation each |
| SUID baseline | 2000 entries; 1 MiB per file hashed |
| VNC/MQTT | one connection and one handshake each |
| Capability baseline | 2000 entries; security.capability xattr only |
| Docker/Elasticsearch | two or three GETs, no credentials |
| Module audit | 500 modules; /proc and /sys reads only |
| POP3/SIP/Telnet | one connection or datagram each; no login |
| Package verify | 300 s cap; one package when requested |
| Flash analysis | reads a local dump, 8/16/32 MiB caps |
| Mount audit | 500 mounts; reads a table, not the filesystem |
| Method/WebSocket | one or two requests, no frames or writes |
| IKEv2 | one SA_INIT, two UDP attempts, no credentials |
| Firewall audit | reads the ruleset or a saved dump, 4 MiB cap |
| SNMP walk | 30 GETNEXT steps, 1.8 s per step |
| LDAP search | 20 entries, 30 messages, anonymous |
| Systemd audit | 500 units; reads unit files only |
| Kernel hardening | 12 sysctls; root prefix for mounted images |
| Sudoers audit | 200 files, 100 findings; read-only |
| auditd | 5000 lines; path limited to /var/log or the state dir |
| RPC/NTP | one UDP query, two attempts, 2 s wait |
| sshd/PAM | read config files only; optional root prefix |
| API/cache | one GET per endpoint, two for cache_audit |
| Log timeline | 200 entries from up to 5000 lines per log |
| Cipher matrix | 12 ciphers, one handshake each, gated once |
| SMB null session | negotiate 2.1, session + IPC$ only |
| Docker audit | reads socket mode, group file, daemon.json |
| SMB shares | 14 share names over the anonymous session |
| E-mail DNS | 4 dig queries per call; domain and resolver gated |
| Web root | 2000 files, depth 4, 100 findings |
| SMTP relay | one MAIL and one RCPT, never DATA |
| DNS resolver | one recursive dig query |
| MAC audits | read /sys and /etc state only |
| ESP verify | local image only, 32 MiB cap |
| CRLF probe | one request, marker header only |
| Audit rules | 100 files, read-only |
| NTP/DNS version | one or two queries, no state |
| OIDC/security.txt | two well-known GETs each |
| Known hosts | 100 files, read-only |
| HTTP/2 | one handshake (ALPN) or one preface (h2c) |
| SSH keys | ssh-keyscan 20 s, or a saved output |
| Logrotate | 100 files, read-only |
| Kerberos | three SRV queries |
| NFS/Samba | config reads only; optional root prefix |
| WinRM | one unauthenticated GET; no auth attempt |
| snmpd/rsyslog | config reads only; optional root prefix |
| postfix/nginx/redis | config reads only; optional root prefix |
| mysql/apache/haproxy | config reads only; optional root prefix |
| DNSSEC | two gated dig queries |
| php/dovecot/openvpn | config reads only; optional root prefix |
| SMTP STARTTLS | one handshake, no auth, no mail |
| postgres/exim/elasticsearch | config reads only; optional root prefix |
| OCSP | one TLS handshake, no responder call |
| squid/unbound/cups | config reads only; optional root prefix |
| ALPN | one handshake per protocol, no data |
| rsync/dhcpd/krb5 | config reads only; optional root prefix |
| WebDAV | one OPTIONS and one Depth:0 PROPFIND |
| mongodb/memcached/ntpd | config reads only; optional root prefix |
| Wildcard DNS | one dig query |
| bind/tomcat/proftpd | config reads only; optional root prefix |
| CAA | one gated dig query |
| kubelet/etcd/rabbitmq | config reads only; optional root prefix |
| SNI | one TLS handshake per name, no data |
| consul/vault/zookeeper | config reads only; optional root prefix |
| mTLS | one handshake, no client certificate presented |
| grafana/prometheus | config reads only; optional root prefix |
| Kubernetes API | four unauthenticated GETs |
| NS consistency | up to three dig queries |
| wireguard/ipsec/openldap | config reads only; optional root prefix |
| dangling CNAME | up to eight dig queries, no data sent |
| cron/fail2ban | config reads only; optional root prefix |
| redirect chain | up to five GETs, every hop re-gated |
| chrony/apt/login.defs | config reads only; optional root prefix |
| WebSocket origin | two upgrade handshakes, no data frames |
| pg_hba/polkit/ldap client | config reads only; optional root prefix |
| FCrDNS | one PTR and up to four forward queries |
| certificate store | local openssl parse only |
| timesyncd/resolv.conf | config reads only; optional root prefix |
| SOA MNAME | two dig queries |
| journald/coredump/nftables | config reads only; optional root prefix |
| HSTS | one TLS GET |
| dnsmasq/nsswitch/jenkins | config reads only; optional root prefix |
| TLS hostname | one handshake with the name as SNI |
| pgbouncer/xinetd/sssd | config reads only; optional root prefix |
| FTP TLS | banner plus one AUTH TLS command, no login |
| avahi/logind/tftpd-hpa | config reads only; optional root prefix |
| ZooKeeper 4lw | two four-byte commands, no auth, no data |
| iscsi/rpcbind/kdump | config reads only; optional root prefix |
| etcd API | three unauthenticated GETs, first answers as evidence |
| kafka/powerdns/varnish | config reads only; optional root prefix |
| registry | two unauthenticated GETs, catalog as evidence |
| freeradius/containerd/nats | config reads only; optional root prefix |
| Consul API | two unauthenticated GETs, first answer as evidence |
| caddy/traefik/autofs | config reads only; optional root prefix |
| CouchDB | two unauthenticated GETs, database list as evidence |
| gitea/minio/nextcloud | config reads only; optional root prefix |
| Prometheus API | two unauthenticated GETs, query answer as evidence |
| zabbix/nrpe/unattended-upgrades | config reads only; optional root prefix |
| 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 |
| kibana/nagios/synapse | config reads only; optional root prefix |
| NATS monitoring | two unauthenticated GETs, varz answer as evidence |
| logstash/filebeat/fluentd | config reads only; optional root prefix |
| InfluxDB | two unauthenticated GETs, query answer as evidence |
| telegraf/graylog/netdata | config reads only; optional root prefix |
| ClickHouse | two unauthenticated GETs, version as evidence |
| sshd_config/hosts_access/profile | config reads only; optional root prefix |
| Kibana API | two unauthenticated GETs, saved objects as evidence |
| atd/securetty/tmpfiles | config reads only; optional root prefix |
| Logstash API | two unauthenticated GETs, stats as evidence |
| compose/k8s/dockerfile | one local file each; no execution |
| AMQP | protocol header + Connection.Start, no login |
| openssl/curl/wget cnf | config reads only; optional root prefix |
| TLS chain | one handshake, no data |
| resolved/udev/issue | config reads only; optional root prefix |
| SMTP AUTH | banner + EHLO, no login |
| usbguard/certbot/wpa | config reads only; optional root prefix |
| Jenkins API | two unauthenticated GETs, job list as evidence |
| bluetooth/networkmanager/dbus | config reads only; optional root prefix |
| Nexus API | two unauthenticated GETs, repository list as evidence |
| passwd/authorized_keys/ld_preload | config reads only; optional root prefix |
| Gitea API | two unauthenticated GETs, admin list as evidence |
| git/npm/pip configs | config reads only; optional root prefix |
| Harbor API | two unauthenticated GETs, project list as evidence |
| USB audit | 200 devices, sysfs reads only |
---
## Build, test, release
Flags are fixed: `-std=c99 -Wall -Wextra -Wpedantic -Werror` plus
`-D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE`.
```sh
make # apex-twin
make test # version check + gate audit + 1278 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
make test-asan # the whole suite against the sanitizer binary
make analyze # gcc -fanalyzer over every translation unit
make coverage # -O0 --coverage build, suite, per-file gcov report
make fuzz # 240 mutated scope/rewrite/MCP inputs against the ASan binary
make fuzz-proxy # 60 mutated raw requests against the ASan proxy
make fuzz-http # 40 mutated raw requests against the ASan MCP HTTP face
make dist # apex-twin-<version>.tar.gz: source, tests, docs, units
make distcheck # build the tarball, unpack it, build and test it there
make release-check # the whole gate, fail-fast (several minutes)
make install # binary, docs, man page and both systemd units
```
The fuzzers have red proofs: `make fuzz-red`, `make fuzz-proxy-red` and
`make fuzz-http-red` build deliberately broken binaries and fail if the harness
reports them green. `make fuzz-selftest` compiles a real out-of-bounds program
and requires the detector to flag it.
`make release-check` runs: version check → gate audit → suite → ASan/UBSan suite
→ `-fanalyzer` → all three fuzzers → `distcheck`. It takes several minutes and
needs the network for the `example.com` checks; `make test` is the fast loop.
Every guarantee in this repository was seen failing before it was trusted:
a report without its closing brace, a disabled status filter, a disabled asset
merge, the old `status_code()` (which read the `1` of `HTTP/1.1`), a bypassed
proxy gate, forced CORS/cookie flags, a disabled notification floor, a disabled
rewrite matcher, a serial proxy, a missing connection cap, a missing HTTP
deadline, a disabled evidence cap, a disabled audit rotation and a stale man
page. `README` claims without a red test are treated as unfinished work.
---
## Install
```sh
make install # /usr/local
make install DESTDIR=/tmp/pkg PREFIX=/usr
```
Installs:
```
$PREFIX/bin/apex-twin
$PREFIX/share/doc/apex-twin/{README,CHANGELOG,SECURITY,LICENSE,operations,artex-port}.md
$PREFIX/share/man/man1/apex-twin.1
$PREFIX/lib/systemd/system/apex-twin.service
$PREFIX/lib/systemd/system/apex-twin-proxy.service
```
The units hardcode `User=lotherk` and a state path under
`/home/lotherk/stack/data/apex-twin`; edit them for another account. Secrets
belong in `~/.config/apex-twin/env` (the units read it when present), not in the
unit file. The proxy unit is separate: an engagement box may want the MCP server
without an open listener. Neither unit gets `CAP_NET_RAW`; connect scans need no
privilege.
---
## Environment
| Variable | Default | Meaning |
|---|---|---|
| `APEX_HOME` | `~/.local/state/apex-twin` | state directory |
| `APEX_SCOPE` | `$APEX_HOME/scope.json` | rules of engagement |
| `APEX_REWRITE` | `$APEX_HOME/rewrite.json` | proxy rewrite rules |
| `APEX_SERIAL` | `/dev/ttyACM0` | Marauder tty |
| `APEX_BAUD` | `115200` | serial baud |
| `APEX_DRY_RUN` | unset | `1` prints commands instead of running them |
| `APEX_DEFAULT_TIMEOUT_MS` | `60000` | per-tool timeout |
| `APEX_MAX_TIMEOUT_MS` | `900000` | hard timeout cap |
| `APEX_WEBHOOK` | unset | URL POSTed on a finding at or above the floor |
| `APEX_WEBHOOK_MIN_SEVERITY` | `critical` | webhook floor |
| `APEX_PROXY_MAX_CHILDREN` | `64` | concurrent proxy connections before 503 |
| `APEX_HTTP_MAX_CHILDREN` | `64` | concurrent MCP HTTP connections before 503 |
| `APEX_HTTP_HEAD_TIMEOUT_MS` | `20000` | HTTP head/body deadline; 0 disables |
| `APEX_AUDIT_MAX_BYTES` | `10485760` | rotate `audit.log` to `.1`; 0 disables |
| `APEX_EVIDENCE_MAX_BYTES` | `16777216` | `evidence_save` cap; 0 unlimited |
---
## Source layout
```
src/apex.h types, version, prototypes
src/config.c $APEX_HOME, paths, environment defaults
src/scope.c the gate: parse, match, expiry, DNS rule, JSON view
src/proc.c fork/exec, timeout via process-group kill, output cap
src/store.c audit log, findings, assets, evidence, traffic, rotation
src/guard.c command guard: tokeniser, deny rules, target extraction
src/proxy.c loopback forward proxy, CONNECT tunnel, chunked bodies
src/rewrite.c rewrite rule file and matching
src/notify.c webhook via curl (argv, no shell)
src/tools_recon.c gated(), gated_cmd(), TCP helpers, recon + findings tools
src/tools_web.c HTTP in-process, header audit, probes, capture
src/tools_radio.c Marauder serial: guard, allowlist, scan-then-stop
src/tools_kb.c technique and tool notes (data, not code)
src/tools_asset.c inventory tools
src/tools_report.c report renderers (Markdown, CSV, JSON)
src/tools_traffic.c traffic_list / traffic_read
src/tools_red.c vuln_check, subdomain_enum, cred_test, vhost_discovery,
http_brute, ssrf_probe, jwt_audit, hash_id, param_fuzz,
open_redirect, host_header_injection, ssti_probe,
xxe_probe, ldap_probe, rdp_probe, smb_probe, vnc_probe,
mqtt_probe, 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, api_auth_audit, cache_audit,
tls_cipher_matrix, smb_null_session, smb_shares,
email_security_audit, smtp_open_relay, dns_open_resolver,
crlf_probe, dns_version_bind, oidc_discovery,
security_txt, http2_probe, ssh_hostkey_fingerprint,
kerberos_discovery, winrm_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, sonarqube_probe,
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,
zabbix_probe, datasette_probe, vault_probe,
nomad_probe, coredns_probe, openbmc_probe,
schema_registry_probe, loki_probe, tempo_probe,
jaeger_probe, solr_probe, confluence_probe,
bitbucket_probe, cassandra_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,
ssh_key_audit, suid_baseline, cap_baseline, module_audit,
package_integrity, mount_audit, firewall_audit,
systemd_audit (and ~160 more service config audits,
newest: podman_audit, buildkitd_audit, supervisor_audit,
fstab_audit, modprobe_audit, grub_audit,
limits_audit, access_conf_audit, pwquality_audit,
pam_env_audit, hosts_audit, dnf_repo_audit,
anacrontab_audit, motd_audit,
syslog_ng_audit, ntpd_audit, inetd_audit,
ld_so_conf_audit, rc_local_audit, opendkim_audit,
rspamd_audit, spamassassin_audit, opendmarc_audit,
amavis_audit, nscd_audit,
crypttab_audit, useradd_audit, aide_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,
php_fpm_audit, uwsgi_audit, lighttpd_audit,
jetty_audit, dhclient_audit,
journal_upload_audit, fwupd_audit,
smartd_audit, tlog_audit, abrt_audit,
freshclam_audit, tripwire_audit, fapolicyd_audit,
systemd_timer_audit, yara_audit,
suricata_audit, icinga2_audit, falco_audit,
promtail_audit, otel_collector_audit,
fluentbit_audit, vector_audit, seccomp_audit,
systemd_socket_audit, pam_restrict_audit,
pwhistory_audit, firewalld_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
src/tools_proto.c ftp_probe, smtp_probe, ssh_audit, tls_audit,
redis_probe, snmp_probe, dns_zone_transfer
src/tools_db.c mysql_probe, postgres_probe, mongo_probe,
memcached_probe
src/sha256.c SHA-256/HMAC for integrity_baseline and jwt_audit
src/tools_ext.c gated wrappers for external scanners: one allowlist per
tool, argv built in C, no shell, output as evidence
src/tools_guard.c guard_check
src/apex-twin.c MCP stdio + HTTP face, --check, --version
vendor/libmcp/ header-only MCP transport (JSON-RPC, tools, HTTP body)
tests/ run.py, gate_audit.py, version_check.py, fuzzers, coverage
docs/ operations.md, artex-port.md, apex-twin.1 (man page)
systemd/ apex-twin.service, apex-twin-proxy.service
examples/ scope.json
```
---
## Documentation
- [docs/operations.md](docs/operations.md) — run book: install, state and backup,
scope lifecycle, systemd, proxy and rewrite rules, webhook, upgrade,
troubleshooting, limits.
- [docs/artex-port.md](docs/artex-port.md) — what was ported from ARTEX and what
was deliberately left out.
- [SECURITY.md](SECURITY.md) — threat model, trust boundaries, hardening
checklist.
- [CHANGELOG.md](CHANGELOG.md) — every release with the commit that introduced it.
- `man apex-twin` (source: `docs/apex-twin.1`) — modes, environment, scope rules,
files and limits in one page.
---
## Status
1.100.0. Built and run: 427 tools, 1637 checks, 240 fuzz cases and 84.7% 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
graded lead, `report_markdown` turns findings and inventory into one Markdown,
CSV or JSON file, and `evidence_read`/`traffic_read` get the proof back.
`--proxy` puts the same gate in front of curl and a browser, serves connections
in parallel, forwards chunked and Content-Length bodies, and takes rewrite rules
that can set or remove a header or block a path; `APEX_WEBHOOK` wakes someone
when the severity floor is crossed. The radio is tested against a PTY Marauder
(firmware info, scans that end in `stopscan`, a login prompt that is refused,
`serial_tx` gating). `make install` ships the binary, this README, the docs, the
man page and both units; `--check` reports the operational state without
starting a server. The whole suite also runs under ASan/UBSan, `make analyze` is
clean, all three fuzzers reject a deliberately broken build, and `make coverage`
keeps the gaps visible.
1.x is the first stable line: the gate invariant and the on-disk JSON formats
(fields may be added, old files stay readable) are the compatibility promise.
1.1 added the red, blue and ESP32 tool groups; 1.2 added vhost discovery,
wordlist path brute-forcing and access-log analysis; 1.3 added SSRF
verification, detection-rule export, integrity baselines and firmware writing
(confirm-gated); 1.4 added offline JWT/hash analysis, ATT&CK mapping and a
/proc snapshot; 1.5 added FTP/SMTP/SSH service probes and a persistence audit;
1.6 added TLS, Redis, SNMP and DNS zone-transfer checks; 1.7 added MySQL,
PostgreSQL, MongoDB and Memcached probes; 1.8 added parameter fuzzing, open
redirect and Host-header checks plus a network baseline; 1.9 added SSTI, XXE
and LDAP probes plus an SSH key audit; 1.10 added RDP and SMB negotiation checks
and a SUID baseline; 1.11 added VNC, MQTT and GraphQL checks plus a file
capability baseline; 1.12 added Docker, Elasticsearch and IMAP checks plus a
kernel module/taint audit; 1.13 added POP3, SIP and Telnet checks plus package
integrity verification; 1.14 added offline ESP32 flash analysis and a mount
audit; 1.15 added HTTP method, WebSocket and IKEv2 checks plus a firewall audit; 1.16
added SNMP walk, LDAP search and OpenAPI discovery plus a systemd audit; 1.17
added CSRF, kernel, sudoers and auditd checks and fixed evidence ordering for
same-second files; 1.18 added RPC and NTP probes plus sshd_config and PAM
audits; 1.19 added ESP app parsing, API auth and cache audits plus a log
timeline; 1.20 added a TLS cipher matrix, SMB null-session check and Docker
audit; 1.21 added SMB share probing, e-mail security checks and a web-root
audit; 1.22 added SMTP relay and DNS resolver checks plus AppArmor/SELinux
audits; 1.23 added ESP image verification, CRLF injection and audit-rule
checks; 1.24 added NTP monlist and DNS version disclosure checks plus a USB
audit; 1.25 added OIDC discovery, security.txt and known-hosts checks; 1.26 added
HTTP/2 probing, SSH host-key fingerprints and a logrotate audit; 1.27 added
Kerberos discovery, NFS export and Samba audits; 1.28 added a WinRM probe and
snmpd/rsyslog config audits; 1.29 added postfix, nginx and redis config audits;
1.30 added MySQL, Apache and HAProxy config audits plus a DNSSEC check; 1.31
added PHP, Dovecot and OpenVPN audits plus an SMTP STARTTLS check, again without
changing an existing file format.
Not yet wired into a fleet router, and there is no TLS interception.
---
## License
**CNCL 1.1 — Could Not Care Less License.**
No rights reserved. No obligations imposed. Use it, copy it, modify it, break it,
fix it, sell it, give it away, keep your changes private, publish them, feed it
to an AI, relicense it. No attribution, no royalties, no source disclosure, no
conditions. The software is provided as is, without warranty.
The full text is in [LICENSE](LICENSE). If you change that text, it is no longer
CNCL.
ARTEX inspired the design; this C implementation is original work and is offered
under CNCL. The vendored `libmcp` transport is part of this tree.