CVE-2025-61624: Fortinet Auto-Script Path Traversal Added to CISA KEV Following PEERSTITCH Memory-Resident Malware Attacks

CVE-2025-61624 Fortinet Auto-Script Path Traversal PEERSTITCH Memory Resident Malware
📌
Security Roundup Series: Weekend of October 19, 2026 • 6 min read deep dive
🚨
Vulnerability Intelligence: CVE ID: CVE-2025-61624 (CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)) Severity: HIGH / CRITICAL IN CHAIN (CVSS 5.4 (Chained for Root RCE)) Threat Actor: CL-STA-0954 / UNC5820 (Deploying PEERSTITCH ARM64 Implant) Status: Actively Exploited in Targeted Espionage; Added to CISA KEV Oct 16, 2026 Affected Systems: FortiOS, FortiProxy, FortiPAM, and FortiSwitchManager (CLI / Auto-Script Engine) Fixed In: FortiOS 7.6.2+, 7.4.6+, 7.2.11+, FortiProxy 7.4.7+ (Advisory FG-IR-25-084)

A CVSS score of 5.4 rarely triggers an emergency federal mandate from CISA—unless that vulnerability serves as the linchpin in a state-sponsored memory-injection kill chain. On October 16, 2026, CISA added CVE-2025-61624 to its Known Exploited Vulnerabilities (KEV) catalog following threat intelligence disclosures from Palo Alto Networks Unit 42 and Fortinet PSIRT. The reports detail how advanced threat cluster CL-STA-0954 (UNC5820) weaponized a path traversal flaw in the Fortinet command-line interpreter (auto-script engine) to escape restricted administrative sandboxes on FortiGate appliances and inject PEERSTITCH—an ultra-stealthy ARM64 memory-resident implant that lives entirely inside running system daemons.

Exploit Mechanics: Breaking Out of the FortiOS CLI Sandbox via CVE-2025-61624

In enterprise Fortinet deployments, administrators interact with FortiOS via a tightly restricted CLI shell (/bin/cli or /bin/newcli) rather than a raw Linux bash prompt. Even with administrative privileges (for example, harvested via earlier FortiManager compromises like FortiJump / CVE-2024-47575), Fortinet’s Secure Boot and firmware integrity verification prevent operators from simply dropping arbitrary binaries onto the filesystem.

CVE-2025-61624 bypasses this boundary through the config system auto-script subsystem. When configuring or executing an automated CLI script and specifying an output capture path or script filename, the CLI parser fails to sanitize relative directory traversal sequences (../../):

# Conceptual CLI sandbox escape via CVE-2025-61624 path traversal
config system auto-script
    edit "diag_update"
        set interval 60
        set repeat 1
        set start auto
        # Path traversal breaks out of /data/auto_script/ restricted directory
        # to overwrite sensitive system runtime files or dynamic linker preloads
        set script "diagnose debug info"
        set output-path "../../../../tmp/init_hook/ld.so.preload"
    next
end

By traversing out of the designated auto-script output directory, UNC5820 achieved arbitrary file write and overwrite primitives in the underlying Linux root filesystem, enabling code execution in the context of the root kernel user space.

Inside PEERSTITCH: Diskless ARM64 Daemon Injection

Once root execution was achieved via CVE-2025-61624, UNC5820 immediately cleaned up all disk artifacts from the exploit and loaded PEERSTITCH directly into volatile memory. Built specifically for ARM64-based FortiGate hardware platforms, PEERSTITCH exhibits advanced anti-forensic engineering:

  • Dual-Daemon Process Injection: PEERSTITCH injects position-independent shellcode and shared object payloads directly into the memory space of two critical FortiOS daemons: iked (the Internet Key Exchange / IPsec VPN daemon) and miglogd (the central logging and telemetry daemon).
  • Zero Network Footprint (Socket Hijacking): PEERSTITCH opens no new listening TCP/UDP ports and initiates no outbound C2 beacons. Instead, by hooking packet-handling routines inside iked, it inspects incoming IPsec/IKE negotiation packets for a cryptographic magic header. When triggered, it executes commands and returns output piggybacked inside legitimate VPN handshake responses.
  • Real-Time Log Scrubbing in miglogd: By residing inside miglogd, the implant intercepts log events in memory before they are written to local flash storage or forwarded via Syslog to an enterprise SIEM—selectively dropping any log entries matching the attacker’s source IPs or CLI session activity.
/* Conceptual representation of PEERSTITCH hook inside miglogd log dispatch */
int hooked_miglog_send(struct log_entry *entry) {
    // Check if log entry contains attacker C2 trigger IP or auto-script artifact
    if (strstr(entry->msg, "198.51.100.") != NULL || 
        strstr(entry->msg, "../../") != NULL) {
        return 0; // Silently drop log in RAM before Syslog transmission!
    }
    return orig_miglog_send(entry);
}

Detection & Memory Forensics on FortiGate Appliances

🔍
Hunting PEERSTITCH & CVE-2025-61624 Exploitation via CLI & SIEM Telemetry # 1. Inspect FortiGate configuration for unauthorized auto-script entries show full-configuration system auto-script # 2. Check crashlogs and daemon restart anomalies in iked and miglogd diagnose debug crashlog read | grep -E "iked|miglogd|signal 11|segfault" # 3. Verify process memory maps and CPU anomalies on iked/miglogd diagnose sys top 2 20

Remediation & Eradication Steps

  1. Upgrade Firmware & Reboot: Upgrade affected FortiOS, FortiProxy, FortiPAM, and FortiSwitchManager appliances to patched releases (FortiOS 7.6.2+, 7.4.6+, 7.2.11+). Because PEERSTITCH is strictly memory-resident, the firmware upgrade and reboot will purge the implant from RAM.
  2. Rotate All Firewall & VPN Secrets Post-Upgrade: Because PEERSTITCH hooked iked in memory, any IPsec pre-shared keys (PSKs), SSL-VPN certificates, and administrative passwords present in memory prior to patching must be considered compromised and rotated immediately.
  3. Disable Unused Auto-Script Capabilities: Monitor SIEM logs for any execution of config system auto-script across your firewall fleet—legitimate environments rarely modify auto-scripts outside scheduled maintenance windows.

Read more