Skip to content
RCE Write-up Advanced

Producing a POC for CVE-2022-42475 (Fortinet RCE)

A heap overflow in Fortinet's SSLVPN service allowed remote code execution. An attacker could send a crafted POST request to trigger the overflow and potentially execute arbitrary code.

Alain Mowat Follow

Published on blog.scrt.ch

Late last year a new remote code execution vulnerability was discovered in Fortinet’s SSLVPN service. Given the relative lack of information surrounding it at the time, and the fact I’d have some uninterrupted research time due to a lengthy flight, I decided to attempt to produce a POC for the vulnerability.

Alain Mowat (@plopz0r), on blog.scrt.ch

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 an integer overflow in the calculation of memory allocation size for HTML-encoded parameters, leading to a too-small buffer and subsequent heap overflow.

Impact

An attacker could potentially execute arbitrary code on the device, but the author's initial attempts only resulted in a crash, and the exploit required specific offsets and was not fully portable.

What the attacker needed

Network access to the SSLVPN service; knowledge of the specific version and offsets

The fix

The vulnerability was fixed in version 6.2.12 by adding a general limit to the size of a request.

How it was found

  1. Send a GET request to /remote/login?lang=en to leak information.
  2. Send a POST request to /remote/error with a large number of special characters in the errmsg parameter to trigger the overflow.

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.

A heap overflow is a type of memory corruption bug where a program writes more data into a memory buffer than it can hold, potentially allowing an attacker to control the program's execution. In this case, the SSLVPN service on Fortinet devices had such a bug, and attackers could exploit it by sending a specially crafted request.

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 Alain Mowat

View all

3 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.