The artifact contains two Python scripts (poc.py and poc_vector2_multitype.py) that exploit CVE-2025-12421, a token type confusion vulnerability in Mattermost Server. The primary script inserts a crafted token into the database and exchanges it at the vulnerable /api/v4/users/login/sso/code-exchange endpoint to obtain a valid session for a victim user, achieving full account takeover. The secondary script demonstrates that any token type is accepted.
Backdoor review
No backdoor observed in reviewed code
The supplied evidence consists of documentation and two Python PoC scripts for CVE-2025-12421, a token type confusion vulnerability in Mattermost. The scripts implement the described exploit chain: they connect to a local Mattermost instance and PostgreSQL database, insert a crafted token, and call the vulnerable code-exchange endpoint to obtain a victim's session. All behavior is consistent with demonstrating the stated vulnerability. No concealed executable behavior, unrelated payload, persistence mechanism, credential exfiltration to external parties, or operator-directed harm was observed.
The primary artifact is poc.py, which is explicitly designed to perform an account takeover by exploiting a token type confusion vulnerability. It executes a multi-step attack chain: inserting a malicious token into the database and then exchanging it for a victim's session. This is the definition of exploit code, as it actively exercises the vulnerability to achieve an unauthorized outcome (session theft). The secondary script, poc_vector2_multitype.py, also performs the same exploitation steps for multiple token types to prove the lack of validation.
poc/poc.py:1-3poc/poc.py:18-32poc/poc.py:234-235
Requirements
Direct access to the Mattermost PostgreSQL database to insert a crafted token.poc/poc.py:316-325
Knowledge of the victim's user_id, which is discoverable via the Mattermost API.poc/poc.py:280-291
The Mattermost instance must have the MobileSSOCodeExchange feature flag enabled (default in affected versions).README.md:156
Observed behavior
Authenticates to the Mattermost API as a low-privileged user to discover the victim's user_id.poc/poc.py:262-275
Generates attacker-controlled PKCE values (code_verifier, code_challenge) and a random token value.poc/poc.py:296-311
Inserts a crafted token with an arbitrary type (e.g., 'saml') and the victim's user_id into the Tokens table via a direct PostgreSQL connection.poc/poc.py:316-332
Sends a POST request to the unauthenticated /api/v4/users/login/sso/code-exchange endpoint with the crafted token and matching PKCE verifier.poc/poc.py:345-358
Receives a valid session token for the victim user from the server's HTTP 200 response.poc/poc.py:362-372
Uses the stolen session token to access the /api/v4/users/me endpoint, confirming the session belongs to the victim.poc/poc.py:382-398
Safety-review evidence
Behaviors behind the backdoor verdict
Observables
Network Connection
localhost:8065 (Mattermost API) and localhost:5432 (PostgreSQL)The PoC scripts connect to the local lab environment to demonstrate the exploit. No external or unrelated network connections are made.poc/poc.py:234-236poc/poc.py:328poc/poc_vector2_multitype.py:261-269
Database Operation
INSERT INTO tokens (token, createat, type, extra) VALUES ...The PoC inserts a crafted token into the local PostgreSQL database to simulate the prerequisite for the exploit. This is a required step in the documented attack chain.poc/poc.py:322-325poc/poc_vector2_multitype.py:226-229
Credential Usage
Hardcoded lab credentials: mmuser/mostest (PostgreSQL), admin@example.com/Admin12345 (Mattermost)The scripts use hardcoded credentials for the local lab environment described in the README. These are not exfiltrated; they are used only to authenticate to the local services.poc/poc.py:67-68poc/poc.py:72-73poc/poc_vector2_multitype.py:62-63poc/poc_vector2_multitype.py:66-67
Review boundaries
What the analysis did not establish
The evidence packet reports complete_artifact_coverage is false, indicating not all files from the repository unit were provided. The analysis is based on the 5 selected text files.
The evidence includes a non_text_media_file_count of 1, which was not analyzed.
The exploit code was not executed; the analysis is based solely on static review of the provided source code and documentation.
8 unclassified files and 1 non-text media file in the repository were not analyzed; their content is unknown.
Binary files were flagged as metadata-only and not inspected for embedded payloads.
The review is limited to the supplied text evidence and does not include dynamic analysis of the scripts.
Model interpretation
This review is limited to the supplied PoC code and context. It does not assert that the code works or is safe to execute.
A single-container Docker Compose lab for CVE-2025-12421, a token type confusion vulnerability in Mattermost Server v11.0.2. The container runs PostgreSQL 14 and Mattermost Team Edition together, exposing ports 8065 (Mattermost API) and 5432 (PostgreSQL) on the host.
The environment is explicitly described as a lab for CVE-2025-12421, a critical authentication bypass in Mattermost. It includes a vulnerable version of Mattermost, a Dockerfile to build it, a Compose file for orchestration, and PoC scripts to demonstrate the exploit.
vulnerable Mattermost Server v11.0.2PostgreSQL 14 database
A single container built from postgres:14 that runs both PostgreSQL and Mattermost Team Edition v11.0.2. It exposes ports 8065 (Mattermost API) and 5432 (PostgreSQL) on the host. The container is configured with relaxed security settings to enable the vulnerability, including enabling the MobileSSOCodeExchange feature flag and disabling email verification.
A Python 3 script that demonstrates the CVE-2025-12421 vulnerability by inserting a crafted SAML token into the PostgreSQL database and exchanging it at the SSO code-exchange endpoint to achieve account takeover. It uses only the standard library.
A Python 3 script that tests seven different token types (including a fabricated one) against the code-exchange endpoint to prove zero type validation in the vulnerable function. It uses only the standard library.
A shell script that starts PostgreSQL, waits for it to be ready, updates CA certificates, and then starts the Mattermost server.
CVE-2025-12421/docker-entry.sh:1-24
config_docker.json
Mattermost configuration
A JSON configuration file for Mattermost that sets relaxed security options, including enabling open server, developer mode, testing mode, and authentication transfer, and disabling email verification.
CVE-2025-12421/config_docker.json:1-55
CVE assessment
How the supplied evidence relates each vulnerability
The lab explicitly targets CVE-2025-12421. The README, PoC scripts, and verification report all describe the vulnerability as a token type confusion in Mattermost Server's SSO code exchange flow. The Dockerfile builds the vulnerable version 11.0.2, and the PoC scripts demonstrate the exploit by inserting a token with an incorrect type and successfully obtaining a session for a victim user.
Requirements and sequence described by the evidence
Prerequisites
Docker and Docker Compose must be installed to build and run the lab.CVE-2025-12421/README.md:85-90
The Mattermost feature flag MobileSSOCodeExchange must be enabled (set to true in the Compose environment and Dockerfile).CVE-2025-12421/docker-compose.yml:18CVE-2025-12421/Dockerfile.vulnerable:36
PostgreSQL must be accessible on port 5432 with credentials mmuser:mostest to insert the crafted token.CVE-2025-12421/poc/poc.py:30-33
A victim user must exist in Mattermost; the lab provides pre-created admin and victim users.CVE-2025-12421/README.md:100-105
Evidence-described exercise path
Build and start the lab container using 'docker compose build' and 'docker compose up -d'.CVE-2025-12421/README.md:85-90
Create test users (admin and victim) via the Mattermost API.CVE-2025-12421/README.md:92-99
Run the primary PoC script (poc.py) to demonstrate account takeover using a SAML token type confusion.CVE-2025-12421/README.md:101-102
Optionally run the multi-type PoC script (poc_vector2_multitype.py) to prove that all token types are accepted.CVE-2025-12421/README.md:104-105
Clean up the lab with 'docker compose down'.CVE-2025-12421/README.md:107-108
Safety-review evidence
Behaviors behind the stored safety assessment
No harmful behavior observed
All visible behavior is directed at the lab's own target (the vulnerable Mattermost container). The PoC scripts connect to the lab's PostgreSQL and Mattermost API to demonstrate the vulnerability. There is no evidence of host escape, external connections, persistence, credential theft, or destructive actions beyond the intended exploit demonstration. Port mappings and relaxed security settings are documented as necessary for the lab.
The packet does not include the actual Mattermost binary; it is downloaded at build time from an external URL.
The PoC scripts are not executed; their behavior is inferred from the source code and documentation.
The lab uses a single container for both PostgreSQL and Mattermost, which is atypical for production but documented as a preview-style setup.
Model interpretation
This review is limited to the supplied lab evidence packet. It does not assert that the environment runs, reproduces a vulnerability, or is safe to execute. Contract: eip-docker-lab-analysis-v1.