Blue: - gitlab_audit: gitlab.rb: an HTTP external_url, no redirect_http_to_https, open signup, disabled Let's Encrypt. Commented defaults are ignored. - vaultwarden_audit: SIGNUPS_ALLOWED=true, a default ADMIN_TOKEN, an HTTP DOMAIN, missing SMTP. - keepalived_audit: auth_type PASS, a default auth_pass, a notify hook piping a download into a shell. Red: - grafana_api_probe: /api/health, /api/datasources and /api/admin/users without credentials; datasources or admin users 2xx is anonymous access, with the datasource list saved as evidence. The tool table hit its 256-slot cap at 258 tools; g_tools is now 384. A double-escaped '\n' in line_value's continuation tokenizer made the whole file one token; only the first line parsed until both calls used a real newline escape. Tests with GitLab/Vaultwarden/keepalived trees and two Grafana fixtures (open and 401). 1120 checks, ASan suite green, analyze clean, release-check green including distcheck 1.55.0.
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.
258 tools · 1120 end-to-end checks · 340 fuzz cases · 83.7% line coverage · ~917 KiB
$ ./apex-twin --check
{"version":"1.55.0","tools":258,...,"scope":{"loaded":true,...}}
APEX TWIN was inspired by 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.
It is not an exploit framework. There is no shell, no exploit payload, no post-exploitation, no C2, no persistence, no TLS interception, no agent loop. Every tool observes, proves, or (for the credential check) makes a small, rate-limited authentication attempt. Radio transmission is a separate, explicitly armed switch.
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:
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 <= 0means the caller enumerates ports itself (used byportscan, which filters every probe withapex_port_in_scope()). It is not a wildcard for a single-port action.- A name in
allow_domainis trusted for its addresses, but whileallow_privateis false it may not resolve into a private network. - A name outside
allow_domainmust resolve, and every address it returns must be insideallow_ip; an unresolvable name is refused, never waved through. *.example.commatches subdomains only;example.commatches the apex and its subdomains. A trailing FQDN dot and an embeddedhost:portare 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
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:
{"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 (258)
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 |
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 |
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 |
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 |
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 |
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
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:
{"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_assetsis set.
Filters: exact target, min_severity, status. Reports are opened O_EXCL:
a report is never overwritten. save: false renders without writing.
Notifications
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.1and 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.
CONNECTis 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.
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 |
| 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.
make # apex-twin
make test # version check + gate audit + 1120 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
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
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
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_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 — run book: install, state and backup, scope lifecycle, systemd, proxy and rewrite rules, webhook, upgrade, troubleshooting, limits.
- docs/artex-port.md — what was ported from ARTEX and what was deliberately left out.
- SECURITY.md — threat model, trust boundaries, hardening checklist.
- 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.55.0. Built and run: 258 tools, 1120 checks, 340 fuzz cases and 83.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. 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.