Skip to content
RCE Write-up Advanced

FortiNAC - Just a few more RCEs

The FortiNAC appliance ran several Java services exposed on all network interfaces, and two of them deserialised or parsed attacker-supplied data without authentication. An unauthenticated attacker could send crafted packets to obtain remote code execution, and a second service also exposed an XML parser that could be abused for external entity injection.

Florian Hauser Follow

Published on frycos.github.io

In February, 2023, a new vulnerability hit the mainstream news: CVE-2022-39952 (see FG-IR-22-300). Exploitation allowed an unauthenticated attacker to achieve remote code execution (RCE) on FortiNAC devices prior to version 9.4.1 through a chain targeting TCP port 8443.

Florian Hauser (@frycos), on frycos.github.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the services called Java deserialisation (readObject) and an XML parser on unauthenticated socket input, with a hard-coded passphrase and no authentication on the custom packet protocol.

Impact

An unauthenticated attacker who can reach the appliance's network ports could run commands on it as the nac user; the second service was also shown to pass attacker XML to a parser, which the author suggests could allow external entity injection.

What the attacker needed

Network access to the appliance ports; no credentials needed

How it was found

  1. List the listening ports on the appliance and note the Java services bound to all interfaces.
  2. Decompile the JAR files and trace the entry point class of the service on port 1050.
  3. Follow the socket handler to the point where it deserialises the client's input.
  4. Build a serialised payload with a known gadget library from the class path and send it over TLS to port 1050.
  5. Observe the reverse shell arriving as the nac user.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

FortiNAC is a security appliance that controls which devices may join a company network. Two of its background programs listened on network ports and accepted data from anyone who could reach them, without asking for a password. One program turned that data straight back into live Java objects, which is like letting a stranger hand you a parcel that unpacks itself and runs whatever is inside.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Florian Hauser

View all

12 more disclosed reports, best first.

More from Fortinet

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.