
Containerised proof-of-concept for CVE-2026-121529, a FortiClient local API origin validation error (CWE-346) enabling drive-by RCE, with a real-browser differential across four remediation models.
| CVE | CVE-2026-121529 |
| Component | FortiClient / FortiClient Windows PAM / FortiClient Mac — local API endpoint (127.0.0.1:9191) |
| Affected | Windows & Windows PAM 7.4.0–7.4.7, 7.2.0–7.2.14; Mac 7.4.0–7.4.7 |
| Fixed in | 7.4.8 (7.4 branch), 7.2.15 (7.2 branch) |
| CWE | CWE-346 (Origin Validation Error) |
| Impact | Unauthenticated remote code execution as the FortiClient service account (SYSTEM on Windows) |
| Vector | A web page the victim visits; the victim's own browser drives the privileged local API |
| Trigger | The Origin header of a cross-origin request — or its absence |
Fortinet's advisory (FG-IR-26-194, published 2026-11-10) describes the flaw as an origin validation error in the local API of FortiClient, FortiClient Windows PAM and FortiClient Mac that "may allow an unauthorized remote attacker to execute unauthorized code or commands" and requires interaction with the victim.
The local API is the loopback interface used by the FortiPAM privileged-access components
on the same endpoint. It listens on 127.0.0.1:9191 and offers a privileged-session
operation that runs a command with the privileges of the service. Because the service
never validates the origin of the caller, a page on any web site can make the
victim's own browser drive that API: the browser sends the request, the API executes it,
and the browser hands the answer back to the attacker's script. The victim only has to
visit a page.
This repository contains a containerised laboratory that reproduces the flaw with a real
browser, the differential against three remediation shapes, and the results of a
0-day sweep against the patched model. The sweep produces three findings that matter
for any product of this shape: a CORS-header-only remediation does not stop the attack
at all, because a browser applies no CORS policy to a WebSocket handshake; an
origin-validated remediation that accepts a request without an Origin header is
bypassed by a cross-origin ``; and a blind execution can be confirmed through an
image side channel.
FortiClient is proprietary software. None of its code, binaries or configuration are redistributed here, and the vendor does not publish the local API's endpoint list or its origin-validation code. What is reproducible here is therefore:
127.0.0.1:9191, a privileged-session operation that executes a command with the
service's privileges, a WebSocket variant of that operation, and an
origin-validation layer;Everything the laboratory asserts about the vendor product is sourced from the advisory; everything it asserts about the model is labelled as such. The model is the only thing that runs in the lab, and it is deliberately built so that the vulnerable and the patched behaviour differ in the origin-validation layer alone.
The model lives in lab/forticlient_api.py and is selected with FCT_MODE:
FCT_MODE | behaviour | version reported |
|---|---|---|
vuln | no origin validation at all — the request Origin is reflected into Access-Control-Allow-Origin together with Access-Control-Allow-Credentials: true | 7.4.7 |
fixed-cors | remediation that only tightens the CORS headers; the request is still processed, and the WebSocket surface is not covered by CORS at all | 7.4.8 |
fixed-origin-only | remediation that validates the origin server-side but still accepts a request that carries no Origin header | 7.4.8 |
fixed-strict | remediation that validates the origin server-side and requires a shared secret header that a cross-origin request cannot set without a preflight | 7.4.8 |
The browser — not the server — decides whether a page may read the answer of a
cross-origin request. The server expresses that decision in the CORS response headers:
Access-Control-Allow-Origin names the single origin that is allowed to read the
response, and Access-Control-Allow-Credentials: true additionally allows the request
to carry cookies and other credentials.
A local API that reflects the request's own Origin back into that header, and pairs it
with Access-Control-Allow-Credentials: true, hands every page on the internet a valid
cross-origin channel into a privileged local service. The origin is never validated, and
CWE-346 is exactly that: the server trusts the value it is supposed to check.
The vulnerable model does this in _send():
origin = cors_origin if cors_origin is not None else self.headers.get("Origin")
if cors_allowed(origin) and origin:
# The vulnerable build echoes ANY origin and allows credentials.
self.send_header("Access-Control-Allow-Origin", origin) # <-- any origin
self.send_header("Access-Control-Allow-Credentials", "true")
and cors_allowed() in the vuln mode returns True for every input:
def cors_allowed(origin):
if MODE == "vuln":
# 7.4.7 model: the service trusts whatever origin asks.
return True
The preflight is equally permissive, and it reflects the requested headers as well:
def do_OPTIONS(self):
...
extra = {
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers": self.headers.get(
"Access-Control-Request-Headers", "Content-Type, Authorization"),
"Access-Control-Max-Age": "86400",
}
The privileged operation itself performs no authorization at all — in the vuln mode
action_allowed() returns True unconditionally — so the request that arrives with a
forged or absent origin is executed with the privileges of the service:
def action_allowed(headers):
if MODE in ("vuln", "fixed-cors"):
return True
A remediation has to decide on the server whether the caller is a trusted local
component. The fixed-strict model does that before the action is performed:
def action_allowed(headers):
...
origin = headers.get("Origin")
token = headers.get(TOKEN_HEADER)
if token != TOKEN:
return False
if origin is None:
return True # the native local agent sends no Origin
return origin in ALLOWED_ORIGINS
The order matters: the check happens before the command runs, so an untrusted request never reaches the sink.