Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-126147 — Containerised PoC and lab for CVE-2026-126147, an unauthenticated path traversal in the FortiMail management API that enables arbitrary file write and root code execution. | Kitploit
Tools/GitHubGitHub/googlesky/cve-2026-126147
Container SecurityVulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationLabs & Practice
GitHubgooglesky/cve-2026-126147

CVE-2026-126147

Containerised PoC and lab for CVE-2026-126147, an unauthenticated path traversal in the FortiMail management API that enables arbitrary file write and root code execution.

View Repository
6 days agoNot yet reviewed
Share

CVE-2026-126147 — FortiMail management interface path traversal (arbitrary file write → command execution)

CVECVE-2026-126147
ComponentFortinet FortiMail — web management interface API
AdvisoryFortinet PSIRT FG-IR-26-199, published 2026-11-10
AffectedFortiMail 8.0.0 – 8.0.1, 7.6.0 – 7.6.6, 7.4.0 – 7.4.8, 7.2 all versions
Fixed inFortiMail 8.0.2, 7.6.7, 7.4.9; migrate off 7.2
CWECWE-22 — Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
ImpactUnauthenticated remote code execution as the appliance service account (root on the appliance)
VectorNetwork, unauthenticated — a crafted request to the management interface API
TriggerThe caller-supplied path component of a file write or file read request
CreditFortinet PSIRT

Fortinet's advisory (FG-IR-26-199) describes an improper limitation of a pathname to a restricted directory in FortiMail and states that the flaw "may allow an unauthenticated attacker to execute unauthorized code or commands via crafted requests". The component is the FortiMail API, and the vector is a request that carries a path the appliance is not supposed to leave its restricted data directory.

That is exactly the shape of the defect reproduced here. A management-interface request carries a caller-supplied path. The appliance joins it to a restricted root directory and hands the result to the file system. Nothing constrains the joined path to the root, so ../ leaves it. The file lands wherever the attacker chose, and on FortiMail that includes the directories the appliance reads and executes — which turns a directory traversal into "execute unauthorized code or commands" without any authentication, any prior access and any user interaction.

This repository contains a containerised laboratory that reproduces the flaw end to end, a differential against the patched behaviour, a payload and endpoint sweep against the patched line, and the result of testing the mitigation in the two forms it can take.


1. Scope and fidelity of this laboratory

FortiMail is proprietary software. None of its code, binaries or configuration are redistributed here, and Fortinet does not publish the management interface's endpoint list or its path handling. What is reproducible here is therefore:

  • the vendor's own statement of the defect — CWE-22, API component, unauthenticated, crafted requests, CVSS 9.8, and the affected/fixed version matrix — taken from FG-IR-26-199 and the CVE record;
  • the security-relevant behaviour of the management interface — a set of unauthenticated endpoints that accept a caller-supplied path, a restricted data directory, a linked data directory, and an appliance script directory that the maintenance task runner executes;
  • the file-system semantics that turn a traversal into code execution. These are properties of POSIX path resolution and of the appliance's own layout, not of FortiMail's source code.

Everything this repository 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 laboratory, and it is built so that the vulnerable and the patched behaviour differ in the path handling alone.

The model lives in lab/fortimail_web.py and is selected with FML_MODE:

FML_MODEbehaviourversion reported
vulnthe caller-supplied path is joined to the restricted root with no normalisation and no containment check — the traversal escapes8.0.1
fixedthe joined path is resolved and the resolved path must stay inside the restricted root; every write and read that leaves it is refused8.0.2
fixed-partiala remediation shape that compares the un-normalised joined path against the root with a string prefix test8.0.2

fixed-partial is not a claim about the vendor's patch. It is the shape a hurried fix takes, and it exists here so that the sweep has a target that is neither the vulnerable build nor a correct one.

Three properties of the model are worth stating explicitly, because each of them changes what an attacker can do and each of them is a property of the appliance rather than of the exploit:

  • the management interface decodes the caller-supplied path a second time before using it, so a percent-encoded traversal is decoded twice in total;
  • the path handling truncates at a NUL byte, the way a C implementation of it does;
  • the restricted data directory contains a linked data directory (shared-link) that points at the appliance script directory.

2. Root cause

The whole defect is the path handling. In the model it is three functions, and the vulnerable and the patched build differ in one of them.

The vulnerable build joins the caller-supplied name to the restricted root and returns the result, with no normalisation and no containment check — lab/fortimail_web.py:141:

    if MODE == "vuln":
        # FortiMail 8.0.1 model: the caller-supplied name is appended to the
        # restricted root and handed to the file system as it is.
        try:
            return os.path.join(ROOT, name), None
        except (OSError, ValueError) as exc:
            return None, "invalid path: %s" % exc

os.path.join() is a string operation. It does not resolve .., it does not notice that the second component is absolute, and it does not care that the result leaves the directory it was supposed to stay in. For the name ../exec/pwn.sh and the root /opt/lab/store it returns:

/opt/lab/store/../exec/pwn.sh

which the file system resolves to:

/opt/lab/exec/pwn.sh

The patched build resolves the path first and then requires containment — lab/fortimail_web.py:156:

    # FortiMail 8.0.2 model: resolve, then require containment.
    try:
        target = os.path.realpath(os.path.join(ROOT, name))
    except (OSError, ValueError) as exc:
        return None, "invalid path: %s" % exc
    if not _inside(target):
        return None, "path outside the restricted directory"
    return target, None

with the containment test at lab/fortimail_web.py:122:

def _inside(path):
    try:
        root = os.path.realpath(ROOT)
        real = os.path.realpath(path)
    except (OSError, ValueError):
        return False
    return real == root or real.startswith(root + os.sep)

realpath() is what makes the check meaningful. It collapses .., it resolves symlinks, and it makes the comparison against the root a comparison of two absolute, fully-resolved paths. A path that merely starts with the root is not inside the root, and the patched build refuses it with HTTP 403.

The write itself carries no authorization. The management interface in the model serves the API without an authentication gate, because the advisory rates the flaw AV:N/AC:L/PR:N/UI:N — the request is processed before any authentication decision. lab/fortimail_web.py:371:

            target, perr = resolve_write(name)
            record_write(route, name, target, perr)
            if perr:
                self._json(403, {"error": perr, "path": name})
                return
            werr = write_file(target, data)

The sink

The traversal becomes code execution because the appliance executes what lands in its script directory. lab/fortimail_web.py:219:

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    936
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    555
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    353
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    348
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    336
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    288

Explore all tools

Browse our collection of tools

View all tools →