← All posts
Detections in my open-source library

Detecting FortiGate compromise when the firewall is your only log source

2026 has been a hard year for FortiGate: SSO authentication bypasses, rogue admins on patched devices and an implant that switches syslog off. What happened, and seven tested Cortex XDR and Splunk detections that need nothing but the FortiGate's own logs.

Rayen Skhiri16 min read#FortiGate#Detection engineering#Cortex XDR#Splunk

Every SOC analyst in Tunisia knows this situation. A new client signs up, you ask for logs, and you get the FortiGate. Maybe an EDR on some laptops. No domain controller logs, no server logs, no proxy. "We will send the rest later." Later rarely comes.

So this post starts from that reality. 2026 has been a hard year for FortiGate: authentication bypasses through FortiCloud SSO, rogue admin accounts on fully patched devices, and in October an implant that hides inside FortiOS processes and turns syslog off. Most write-ups assume you have every log source. I wanted to know how much a SOC can still catch with the FortiGate's own logs and nothing else, and what changes when the EDR and Active Directory logs do arrive.

The short answer: more than you would expect. The bugs are different, but once attackers are on the box they all do the same handful of things, and FortiOS logs every one of them. All the detections below are in my detection library as DL-0068 to DL-0075, with test events that must and must not fire, and you can paste a raw FortiGate log line into the playground to see which rules fire.

7 rulesthat need only the FortiGate's own syslog
9.8 and 9.4CVSS of the 2026 SSO admin bypasses
In CISA KEVCVE-2025-61624 since 16 October 2026

What happened to FortiGate in 2026

WhenBugWhat it gives the attacker
Dec 2025CVE-2025-59718, CVE-2025-59719 (CVSS 9.8)A crafted SAML message logs in as admin when FortiCloud SSO is enabled
Jan 2026CVE-2026-24858 (CVSS 9.4, FG-IR-26-060)The attacker logs into your FortiGate with their own FortiCloud account. Exploited as a zero-day; Fortinet locked two attacker accounts on 22 January and disabled FortiCloud SSO on its side on 26 January
From 15 Jan 2026Automated campaign reported by Arctic WolfAdmin access within seconds, config downloads, new admin accounts with VPN access, also on devices already running 7.4.9, 7.4.10 and 7.6.x
Jul 2026CVE-2025-68686 (CISA KEV)A bypass of the earlier fix for the symlink persistence trick, so an old compromise can survive patching
Oct 2026CVE-2025-61624 (CISA KEV on 16 October)Path traversal in the FortiOS CLI. Unit 42 saw it used to deploy PEERSTITCH, a memory-resident implant that hooks miglogd and iked, lets tagged VPN sessions skip checks, stops syslog and clears crash logs
Still todayCVE-2020-12812The old 2FA bypass through username case. Fortinet warned of new abuse, and about 9,700 exposed devices were still vulnerable in January 2026

Two incident reports from this year are worth reading in full, because they show the whole path from the firewall to domain admin. In both, the attackers:

  1. got admin on the FortiGate,
  2. exported the full configuration (show full-configuration),
  3. decrypted the LDAP service account stored in it, since FortiOS protects those secrets with reversible encryption,
  4. created a local admin with a boring name (support, ssl-admin),
  5. added permissive "any to any" firewall policies,
  6. used the stolen AD account to join rogue workstations to the domain or log into servers,
  7. installed remote management tools (Pulseway, and MeshAgent hidden with SystemComponent=1),
  8. and in one case copied NTDS.dit from a shadow copy and sent it out.

Steps 1 to 5 happen on the FortiGate. That is the part you can see with firewall logs alone.

Step 1: find what is exposed

Before hunting, check the boxes themselves. On each FortiGate:

get system status                              # FortiOS version
show system global | grep -i sso               # admin-forticloud-sso-login should be disable
show system admin | grep edit                  # every admin account, one per line
show system interface | grep -i allowaccess    # https or ssh on a WAN interface is the real problem
show system automation-action                  # anything you did not create?
show system auto-script
  • Version at or above the fixed release for every advisory above. For CVE-2026-24858 that is 7.6.6, 7.4.11, 7.2.13 or 7.0.19. For CVE-2025-61624, GovCERT.HK lists FortiOS 6.4, 7.0 and 7.2 as affected in full, plus 7.4.0 to 7.4.9 and 7.6.0 to 7.6.4.
  • FortiCloud SSO for admins disabled unless someone really uses it. It is off by default, but FortiCare registration can turn it on.
  • No admin access from the internet. Every bug in the table is worse when the admin GUI answers on the WAN. Use trusted hosts or a management network.
  • No admin you cannot put a name on. Compare the list with the account names at the end of this post.

In an MSSP, run this through FortiManager or a small script for every client and keep the output. It becomes the baseline for the detections.

Step 2: detect it with the logs you actually have

I split the detections into two tiers:

  • Minimal tier: FortiGate syslog only (event, VPN and traffic logs). This is what most clients send.
  • Full tier: you also have an EDR on the servers and the domain controller security log.

Getting FortiGate logs into Cortex XDR and Splunk

Point the FortiGate at a Broker VM syslog applet. The logs land in the fortinet_fortigate_raw dataset. Depending on how the source was set up you get parsed fields or only _raw_log, so every query below pulls the fields it needs out of _raw_log with regextract. They work either way. In Splunk, install the Fortinet FortiGate Add-on and define a fortigate macro over your FortiGate sourcetypes.

Two log IDs carry most of the value. 0100044547 ("Object attribute configured") is written whenever an object such as an admin, a policy or an address is added, edited or deleted. 0100044546 ("Attribute configured") covers global settings. Both carry cfgpath (what changed), cfgobj (which object), cfgattr (old and new values), action, user and ui (how and from where the admin was connected).

Minimal tier, layer 1: the way in

A successful admin login where the method is SSO, or where the source address is outside RFC 1918. It will fire on legitimate MSSP management from a public IP. Allow-list those exact addresses and nothing more. If admin logins from the internet are normal for a client, that belongs in the client report as a finding.

DL-0068 Admin login through FortiCloud SSO or from an internet addressrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| filter _raw_log != null
| alter fg_logid = arrayindex(regextract(_raw_log, "\\blogid=\"?([^\"\\s]*)"), 0), fg_subtype = arrayindex(regextract(_raw_log, "\\bsubtype=\"?([^\"\\s]*)"), 0), fg_action = arrayindex(regextract(_raw_log, "\\baction=\"?([^\"\\s]*)"), 0), fg_status = arrayindex(regextract(_raw_log, "\\bstatus=\"?([^\"\\s]*)"), 0), fg_user = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0), fg_srcip = arrayindex(regextract(_raw_log, "\\bsrcip=\"?([^\"\\s]*)"), 0), fg_ui = arrayindex(regextract(_raw_log, "\\bui=\"?([^\"\\s]*)"), 0), fg_method = arrayindex(regextract(_raw_log, "\\bmethod=\"?([^\"\\s]*)"), 0), fg_devname = arrayindex(regextract(_raw_log, "\\bdevname=\"?([^\"\\s]*)"), 0), fg_logdesc = arrayindex(regextract(_raw_log, "\\blogdesc=\"([^\"]*)\""), 0), fg_msg = arrayindex(regextract(_raw_log, "\\bmsg=\"([^\"]*)\""), 0)
| filter (fg_subtype = "system" and fg_action = "login" and fg_status = "success") and ((fg_method = "sso" or fg_ui ~= "(?i)^sso") or not ((fg_srcip != null and (incidr(fg_srcip, "10.0.0.0/8") or incidr(fg_srcip, "172.16.0.0/12") or incidr(fg_srcip, "192.168.0.0/16") or incidr(fg_srcip, "127.0.0.0/8")))))
| fields _time, fg_devname, fg_logid, fg_user, fg_srcip, fg_ui, fg_logdesc, fg_msg
| sort desc _time
| limit 1000

Splunk (SPL)

`fortigate`
| where (lower(subtype)="system" AND lower(action)="login" AND lower(status)="success") AND ((lower(method)="sso" OR match(ui, "(?i)^sso")) OR NOT ((isnotnull(srcip) AND (cidrmatch("10.0.0.0/8", srcip) OR cidrmatch("172.16.0.0/12", srcip) OR cidrmatch("192.168.0.0/16", srcip) OR cidrmatch("127.0.0.0/8", srcip)))))
| table _time devname logid user srcip ui logdesc msg
| sort - _time

A cheap companion: brute force on the admin GUI or the SSL VPN. Many users from one address is spraying; then check whether that address ever got a success.

Cortex XDR: failed admin or VPN logins per source, per hour

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| alter fg_action = arrayindex(regextract(_raw_log, "\\baction=\"?([^\"\\s]*)"), 0),
        fg_status = arrayindex(regextract(_raw_log, "\\bstatus=\"?([^\"\\s]*)"), 0),
        fg_srcip  = arrayindex(regextract(_raw_log, "\\b(?:srcip|remip)=\"?([^\"\\s]*)"), 0),
        fg_user   = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0)
| filter (fg_action = "login" and fg_status = "failed") or fg_action = "ssl-login-fail"
| bin _time span = 1h
| comp count() as failures, count_distinct(fg_user) as users by _time, fg_srcip
| filter failures >= 20 or users >= 5
| sort desc failures

Then logins by the account names reported in the intrusions. A name is a lead, not proof. If a client really has a support account, rename it after a person and the rule stays useful.

DL-0074 Admin or SSL VPN login with an account name used in FortiGate intrusionsrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| filter _raw_log != null
| alter fg_logid = arrayindex(regextract(_raw_log, "\\blogid=\"?([^\"\\s]*)"), 0), fg_subtype = arrayindex(regextract(_raw_log, "\\bsubtype=\"?([^\"\\s]*)"), 0), fg_action = arrayindex(regextract(_raw_log, "\\baction=\"?([^\"\\s]*)"), 0), fg_status = arrayindex(regextract(_raw_log, "\\bstatus=\"?([^\"\\s]*)"), 0), fg_user = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0), fg_srcip = arrayindex(regextract(_raw_log, "\\bsrcip=\"?([^\"\\s]*)"), 0), fg_ui = arrayindex(regextract(_raw_log, "\\bui=\"?([^\"\\s]*)"), 0), fg_devname = arrayindex(regextract(_raw_log, "\\bdevname=\"?([^\"\\s]*)"), 0), fg_logdesc = arrayindex(regextract(_raw_log, "\\blogdesc=\"([^\"]*)\""), 0), fg_msg = arrayindex(regextract(_raw_log, "\\bmsg=\"([^\"]*)\""), 0)
| filter ((fg_subtype in ("system", "vpn") and fg_action in ("login", "tunnel-up", "ssl-login")) and fg_user in ("support", "ssl-admin", "backupadmin", "backup", "itadmin", "secadmin", "svcadmin", "remoteadmin", "adccount", "audit", "deploy", "security", "helpdesk")) and not ((fg_status != null and fg_status in ("failed", "failure")))
| fields _time, fg_devname, fg_logid, fg_user, fg_srcip, fg_ui, fg_logdesc, fg_msg
| sort desc _time
| limit 1000

Splunk (SPL)

`fortigate`
| where (((lower(subtype)="system" OR lower(subtype)="vpn") AND (lower(action)="login" OR lower(action)="tunnel-up" OR lower(action)="ssl-login")) AND (lower(user)="support" OR lower(user)="ssl-admin" OR lower(user)="backupadmin" OR lower(user)="backup" OR lower(user)="itadmin" OR lower(user)="secadmin" OR lower(user)="svcadmin" OR lower(user)="remoteadmin" OR lower(user)="adccount" OR lower(user)="audit" OR lower(user)="deploy" OR lower(user)="security" OR lower(user)="helpdesk")) AND NOT ((isnotnull(status) AND (lower(status)="failed" OR lower(status)="failure")))
| table _time devname logid user srcip ui logdesc msg
| sort - _time

Minimal tier, layer 2: what they do on the box

A new admin. Admin accounts are created a few times a year, so every hit deserves a look. Read user and ui to see who created it and how they were logged in. PEERSTITCH deleted its admin after use, so an Add and a Delete of the same cfgobj minutes apart is worse than an Add alone.

DL-0069 New administrator account created on a FortiGaterule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| filter _raw_log != null
| alter fg_logid = arrayindex(regextract(_raw_log, "\\blogid=\"?([^\"\\s]*)"), 0), fg_action = arrayindex(regextract(_raw_log, "\\baction=\"?([^\"\\s]*)"), 0), fg_user = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0), fg_srcip = arrayindex(regextract(_raw_log, "\\bsrcip=\"?([^\"\\s]*)"), 0), fg_ui = arrayindex(regextract(_raw_log, "\\bui=\"?([^\"\\s]*)"), 0), fg_cfgpath = arrayindex(regextract(_raw_log, "\\bcfgpath=\"?([^\"\\s]*)"), 0), fg_devname = arrayindex(regextract(_raw_log, "\\bdevname=\"?([^\"\\s]*)"), 0), fg_logdesc = arrayindex(regextract(_raw_log, "\\blogdesc=\"([^\"]*)\""), 0), fg_msg = arrayindex(regextract(_raw_log, "\\bmsg=\"([^\"]*)\""), 0)
| filter fg_cfgpath = "system.admin" and fg_action = "add"
| fields _time, fg_devname, fg_logid, fg_user, fg_srcip, fg_ui, fg_logdesc, fg_msg
| sort desc _time
| limit 1000

Splunk (SPL)

`fortigate`
| where lower(cfgpath)="system.admin" AND lower(action)="add"
| table _time devname logid user srcip ui logdesc msg
| sort - _time

The configuration leaves the box. The config file is the prize: the LDAP bind account, VPN keys, local passwords and the whole network map. The wording of the backup event changes a little between FortiOS versions, so the rule matches backup or download together with config in logdesc or msg. One gap to know: show full-configuration typed in the GUI console does not always log a backup event, so also review ui=jsconsole sessions from unusual addresses.

DL-0070 FortiGate configuration backed up or downloadedrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| filter _raw_log != null
| alter fg_logid = arrayindex(regextract(_raw_log, "\\blogid=\"?([^\"\\s]*)"), 0), fg_subtype = arrayindex(regextract(_raw_log, "\\bsubtype=\"?([^\"\\s]*)"), 0), fg_user = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0), fg_srcip = arrayindex(regextract(_raw_log, "\\bsrcip=\"?([^\"\\s]*)"), 0), fg_ui = arrayindex(regextract(_raw_log, "\\bui=\"?([^\"\\s]*)"), 0), fg_devname = arrayindex(regextract(_raw_log, "\\bdevname=\"?([^\"\\s]*)"), 0), fg_logdesc = arrayindex(regextract(_raw_log, "\\blogdesc=\"([^\"]*)\""), 0), fg_msg = arrayindex(regextract(_raw_log, "\\bmsg=\"([^\"]*)\""), 0)
| filter fg_subtype = "system" and (fg_logdesc ~= "(?i)(backup|back up|backed up|download).*(conf|configuration)|(conf|configuration).*(backup|backed up|download)" or fg_msg ~= "(?i)(backup|back up|backed up|download).*(conf|configuration)|(conf|configuration).*(backup|backed up|download)")
| fields _time, fg_devname, fg_logid, fg_user, fg_srcip, fg_ui, fg_logdesc, fg_msg
| sort desc _time
| limit 1000

Splunk (SPL)

`fortigate`
| where lower(subtype)="system" AND (match(logdesc, "(?i)(backup|back up|backed up|download).*(conf|configuration)|(conf|configuration).*(backup|backed up|download)") OR match(msg, "(?i)(backup|back up|backed up|download).*(conf|configuration)|(conf|configuration).*(backup|backed up|download)"))
| table _time devname logid user srcip ui logdesc msg
| sort - _time

An any to any accept policy. One of this year's intrusions added four of them to open every zone to every other zone. Real admins almost never write one.

DL-0071 Firewall policy set to accept any source to any destinationrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| filter _raw_log != null
| alter fg_logid = arrayindex(regextract(_raw_log, "\\blogid=\"?([^\"\\s]*)"), 0), fg_action = arrayindex(regextract(_raw_log, "\\baction=\"?([^\"\\s]*)"), 0), fg_user = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0), fg_srcip = arrayindex(regextract(_raw_log, "\\bsrcip=\"?([^\"\\s]*)"), 0), fg_ui = arrayindex(regextract(_raw_log, "\\bui=\"?([^\"\\s]*)"), 0), fg_cfgpath = arrayindex(regextract(_raw_log, "\\bcfgpath=\"?([^\"\\s]*)"), 0), fg_devname = arrayindex(regextract(_raw_log, "\\bdevname=\"?([^\"\\s]*)"), 0), fg_logdesc = arrayindex(regextract(_raw_log, "\\blogdesc=\"([^\"]*)\""), 0), fg_msg = arrayindex(regextract(_raw_log, "\\bmsg=\"([^\"]*)\""), 0), fg_cfgattr = arrayindex(regextract(_raw_log, "\\bcfgattr=\"([^\"]*)\""), 0)
| filter (fg_cfgpath = "firewall.policy" and fg_action in ("add", "edit")) and (fg_cfgattr ~= "(?i)srcaddr\\[([^\\]]*->)?all\\]" and fg_cfgattr ~= "(?i)dstaddr\\[([^\\]]*->)?all\\]")
| fields _time, fg_devname, fg_logid, fg_user, fg_srcip, fg_ui, fg_logdesc, fg_msg
| sort desc _time
| limit 1000

Splunk (SPL)

`fortigate`
| where (lower(cfgpath)="firewall.policy" AND (lower(action)="add" OR lower(action)="edit")) AND (match(cfgattr, "(?i)srcaddr\\[([^\\]]*->)?all\\]") AND match(cfgattr, "(?i)dstaddr\\[([^\\]]*->)?all\\]"))
| table _time devname logid user srcip ui logdesc msg
| sort - _time

Automation that runs commands. Stitches, actions and auto-scripts run CLI commands on a schedule or a trigger. PEERSTITCH used an auto-script to download and start its parts, then removed it.

DL-0073 Automation stitch, action or auto-script createdrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| filter _raw_log != null
| alter fg_logid = arrayindex(regextract(_raw_log, "\\blogid=\"?([^\"\\s]*)"), 0), fg_action = arrayindex(regextract(_raw_log, "\\baction=\"?([^\"\\s]*)"), 0), fg_user = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0), fg_srcip = arrayindex(regextract(_raw_log, "\\bsrcip=\"?([^\"\\s]*)"), 0), fg_ui = arrayindex(regextract(_raw_log, "\\bui=\"?([^\"\\s]*)"), 0), fg_cfgpath = arrayindex(regextract(_raw_log, "\\bcfgpath=\"?([^\"\\s]*)"), 0), fg_devname = arrayindex(regextract(_raw_log, "\\bdevname=\"?([^\"\\s]*)"), 0), fg_logdesc = arrayindex(regextract(_raw_log, "\\blogdesc=\"([^\"]*)\""), 0), fg_msg = arrayindex(regextract(_raw_log, "\\bmsg=\"([^\"]*)\""), 0)
| filter fg_cfgpath in ("system.automation-stitch", "system.automation-action", "system.automation-trigger", "system.auto-script") and fg_action in ("add", "edit")
| fields _time, fg_devname, fg_logid, fg_user, fg_srcip, fg_ui, fg_logdesc, fg_msg
| sort desc _time
| limit 1000

Splunk (SPL)

`fortigate`
| where (lower(cfgpath)="system.automation-stitch" OR lower(cfgpath)="system.automation-action" OR lower(cfgpath)="system.automation-trigger" OR lower(cfgpath)="system.auto-script") AND (lower(action)="add" OR lower(action)="edit")
| table _time devname logid user srcip ui logdesc msg
| sort - _time

Minimal tier, layer 3: when they try to blind you

Any change under log.* that switches a target from enable to disable, moves a syslog or FortiAnalyzer server, or turns logtraffic off on a policy. This is often the last event you will get from that device.

DL-0072 Log forwarding turned off or pointed somewhere elserule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| filter _raw_log != null
| alter fg_logid = arrayindex(regextract(_raw_log, "\\blogid=\"?([^\"\\s]*)"), 0), fg_user = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0), fg_srcip = arrayindex(regextract(_raw_log, "\\bsrcip=\"?([^\"\\s]*)"), 0), fg_ui = arrayindex(regextract(_raw_log, "\\bui=\"?([^\"\\s]*)"), 0), fg_cfgpath = arrayindex(regextract(_raw_log, "\\bcfgpath=\"?([^\"\\s]*)"), 0), fg_devname = arrayindex(regextract(_raw_log, "\\bdevname=\"?([^\"\\s]*)"), 0), fg_logdesc = arrayindex(regextract(_raw_log, "\\blogdesc=\"([^\"]*)\""), 0), fg_msg = arrayindex(regextract(_raw_log, "\\bmsg=\"([^\"]*)\""), 0), fg_cfgattr = arrayindex(regextract(_raw_log, "\\bcfgattr=\"([^\"]*)\""), 0)
| filter (fg_cfgpath ~= "(?i)^log\\." and fg_cfgattr ~= "(?i)status\\[enable->disable\\]|server\\[[^\\]]*->|logtraffic\\[[^\\]]*->disable\\]|upload-option\\[[^\\]]*->") or (fg_cfgpath = "firewall.policy" and fg_cfgattr ~= "(?i)logtraffic\\[[^\\]]*->disable\\]")
| fields _time, fg_devname, fg_logid, fg_user, fg_srcip, fg_ui, fg_logdesc, fg_msg
| sort desc _time
| limit 1000

Splunk (SPL)

`fortigate`
| where (match(cfgpath, "(?i)^log\\.") AND match(cfgattr, "(?i)status\\[enable->disable\\]|server\\[[^\\]]*->|logtraffic\\[[^\\]]*->disable\\]|upload-option\\[[^\\]]*->")) OR (lower(cfgpath)="firewall.policy" AND match(cfgattr, "(?i)logtraffic\\[[^\\]]*->disable\\]"))
| table _time devname logid user srcip ui logdesc msg
| sort - _time

Which is why the most important minimal-tier check is not a rule at all. It is a heartbeat. A FortiGate that stops talking is either down, misconfigured or hiding something, and all three need a call to the client. In an MSSP, silent log sources are the most common blind spot I see, and this is the cheapest fix.

Cortex XDR: FortiGates silent for more than 30 minutes (run every 15 minutes over 24 hours)

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| alter fg_devname = arrayindex(regextract(_raw_log, "\\bdevname=\"?([^\"\\s]*)"), 0)
| comp max(_time) as last_log, count() as events by fg_devname
| alter minutes_silent = timestamp_diff(current_time(), last_log, "MINUTE")
| filter minutes_silent > 30
| sort desc minutes_silent

Minimal tier, layer 4: where they go next

The traffic log still shows the first moves inside the network, as long as the policies log traffic. An SSL VPN session that suddenly reaches dozens of internal hosts on SMB, RDP, LDAP or WinRM is scanning or spraying.

Cortex XDR: SSL VPN users reaching 20 or more internal hosts in an hour

config case_sensitive = false
| dataset = fortinet_fortigate_raw
| alter fg_type    = arrayindex(regextract(_raw_log, "\\btype=\"?([^\"\\s]*)"), 0),
        fg_srcintf = arrayindex(regextract(_raw_log, "\\bsrcintf=\"?([^\"\\s]*)"), 0),
        fg_srcip   = arrayindex(regextract(_raw_log, "\\bsrcip=\"?([^\"\\s]*)"), 0),
        fg_dstip   = arrayindex(regextract(_raw_log, "\\bdstip=\"?([^\"\\s]*)"), 0),
        fg_dstport = to_integer(arrayindex(regextract(_raw_log, "\\bdstport=\"?([0-9]+)"), 0)),
        fg_user    = arrayindex(regextract(_raw_log, "\\buser=\"?([^\"\\s]*)"), 0)
| filter fg_type = "traffic" and fg_srcintf ~= "(?i)^ssl\."
| filter fg_dstport in (22, 135, 139, 389, 445, 636, 3389, 5985, 5986)
| bin _time span = 1h
| comp count_distinct(fg_dstip) as hosts, values(fg_dstport) as ports by _time, fg_user, fg_srcip
| filter hosts >= 20
| sort desc hosts

Full tier: what you add with EDR and Active Directory logs

When the client does send more, the same story gets much clearer:

StageMinimal tier (FortiGate only)Full tier adds
Way inDL-0068, DL-0074, brute forceNothing new: the firewall is the only witness
On the boxDL-0069, DL-0070, DL-0071, DL-0073Nothing new
BlindingDL-0072, heartbeatThe log gap lined up against EDR activity in the same hours
Stolen AD account usedVPN fan-out, new traffic from the bind account's usual source4624 logons by the FortiGate bind account from anywhere but the FortiGate; 4741 computer accounts created by a non-admin
Foothold on serversOutbound traffic to new cloud hostsDL-0075, plus SystemComponent=1 on uninstall keys
Domain takeoverA large outbound transferDL-0017 (NTDS.dit or SAM hives copied), DL-0057 (privileged group change)

Remote management agents the IT team did not deploy, or any program started from C:\ProgramData\USOShared, a Windows Update folder that holds logs, not programs:

DL-0075 MeshAgent or Pulseway started, or a program run from ProgramData\USOSharedrule page and tests

Cortex XDR (XQL)

config case_sensitive = false
| dataset = xdr_data
| filter event_type = ENUM.PROCESS and event_sub_type = ENUM.PROCESS_START
| filter action_process_image_name in ("meshagent.exe", "meshagent64.exe", "pcmonitorsrv.exe", "pcmonitormanager.exe", "pulseway.exe") or action_process_image_path ~= "(?i)^c:\\\\programdata\\\\usoshared\\\\"
| fields _time, agent_hostname, actor_effective_username, actor_process_image_name, action_process_image_name, action_process_image_command_line
| sort desc _time
| limit 1000

Splunk (SPL)

`sysmon` EventCode=1
| eval process_name=lower(mvindex(split(Image,"\\"),-1)), parent_name=lower(mvindex(split(ParentImage,"\\"),-1))
| where (lower(process_name)="meshagent.exe" OR lower(process_name)="meshagent64.exe" OR lower(process_name)="pcmonitorsrv.exe" OR lower(process_name)="pcmonitormanager.exe" OR lower(process_name)="pulseway.exe") OR match(Image, "(?i)^c:\\\\programdata\\\\usoshared\\\\")
| table _time host User ParentImage Image CommandLine
| sort - _time

The stolen bind account used from somewhere other than the FortiGate, with the DC security log in Cortex XDR:

Cortex XDR: logons by the FortiGate bind account from another address

config case_sensitive = false
| dataset = xdr_data
| filter event_type = ENUM.EVENT_LOG and action_evtlog_event_id = 4624
| alter target_user = json_extract_scalar(action_evtlog_data_fields, "$.TargetUserName"),
        source_ip   = json_extract_scalar(action_evtlog_data_fields, "$.IpAddress")
| filter target_user in ("fortidcagent", "svc_fortigate")     // your FortiGate LDAP bind account(s)
| filter source_ip not in ("10.0.0.1", "10.0.0.2")            // the FortiGate interfaces facing the DCs
| fields _time, agent_hostname, target_user, source_ip
| sort desc _time

And computers joined by an account that has no business doing it, the ms-DS-MachineAccountQuota abuse from one of the incidents. The rogue machines there had default-looking names such as WIN-X8WRBOSK0OF, so a burst of WIN- names from one user is another hint.

Cortex XDR: computer accounts created by someone other than your join accounts

config case_sensitive = false
| dataset = xdr_data
| filter event_type = ENUM.EVENT_LOG and action_evtlog_event_id = 4741
| alter creator      = json_extract_scalar(action_evtlog_data_fields, "$.SubjectUserName"),
        new_computer = json_extract_scalar(action_evtlog_data_fields, "$.TargetUserName")
| filter creator !~= "(?i)^(adm-|admin|svc-join)"              // your real join accounts
| fields _time, agent_hostname, creator, new_computer
| sort desc _time
Before you rely on these: the field extraction was built from Fortinet's log documentation and tested against the rules' own events, not on a live tenant. FortiOS versions differ in small ways, so paste two or three real FortiGate lines into the playground and run each query once on your own data first.

Step 3: respond

  1. Save the evidence first. Export at least 90 days of FortiGate logs from FortiAnalyzer or the SIEM before anything rotates, and note the firmware version.
  2. Close the way in. Disable admin-forticloud-sso-login, remove admin access from WAN interfaces, and patch.
  3. Remove what they left. Unknown admins, unknown local VPN users, automation stitches, auto-scripts and any to any policies. A patch removes none of these.
  4. Assume the config is stolen. Rotate the LDAP or AD bind account first, then VPN pre-shared keys, local user passwords and every admin password.
  5. Follow the account into AD. Even on a minimal-log client, ask for the DC security log for the incident window. One export is enough to check the bind account's logons and new computer accounts.
  6. Check below the config. For PEERSTITCH-style activity a config review is not enough. Follow Fortinet's integrity check guidance and consider a clean firmware reinstall.
  7. Fix retention. In one of this year's cases nobody could tell how the attackers got in because the logs were gone. Keep at least 60 days of FortiGate logs; 90 is better.

The detections

RuleWhat it catchesTier
DL-0068Admin login through FortiCloud SSO or from an internet addressMinimal
DL-0069New administrator accountMinimal
DL-0070Configuration backed up or downloadedMinimal
DL-0071Policy set to accept any source to any destinationMinimal
DL-0072Log forwarding turned off or redirectedMinimal
DL-0073Automation stitch, action or auto-script createdMinimal
DL-0074Login with an account name used in the intrusionsMinimal
DL-0075MeshAgent, Pulseway, or a program run from ProgramData\USOSharedFull

Every rule ships with events that must fire and events that must not, and CI runs the compiled XQL and SPL against them on every commit. If one misbehaves on your platform, open an issue on the repo with the error and I will fix it.

Indicators from the public reports

Good for a one-time look back, not for long-term rules: addresses and account names change.

  • Admin account names: support, ssl-admin, audit, backup, itadmin, secadmin, backupadmin, deploy, remoteadmin, security, svcadmin, system, adccount
  • FortiCloud accounts (CVE-2026-24858): cloud-noc@mail.io, cloud-init@mail.io, heltaylor.12@tutamail.com, support@openmail.pro
  • Addresses: 163.61.198.15, 38.54.6.28, 37.1.209.19, 217.119.139.50, 193.24.211.61, 23.240.77.233 (PEERSTITCH staging, port 8085) and the 104.28.x.x range
  • Domains: ndibstersoft[.]com, neremedysoft[.]com
  • Host artifacts: C:\ProgramData\USOShared, rogue hosts WIN-X8WRBOSK0OF and WIN-YRSXLEONJY2

Sources

Thanks for reading. Running a SOC where the FortiGate is all you get? Tell me what fired, what was noise and what I missed. I reply within a day.