Postiz stored XSS via file upload (CVE-2026-40487) [PoC]
CVE-2026-40487
Postiz is an AI social media scheduling tool. Prior to version 2.21.6, a file upload validation bypass allows any authenticated user to upload arbitrary HTML, SVG, or other executable file types to th...
Overview
A security vulnerability in the Postiz AI social media scheduling tool allows authenticated users to upload malicious files to the server. This flaw, tracked as CVE-2026-40487, exists in versions prior to 2.21.6 and has a high severity CVSS score of 8.9.
Vulnerability Details
The vulnerability is a file upload validation bypass. The application’s security check, which should restrict uploads to safe file types, can be circumvented by an attacker spoofing the Content-Type header in their upload request. This allows the upload of arbitrary HTML, SVG, or other executable file types.
Once uploaded, the files are served by the nginx web server with a content type based on the file’s actual extension (e.g., text/html for .html files). This enables a Stored Cross-Site Scripting (XSS) attack, where malicious scripts are hosted on the application’s own domain and execute automatically when accessed by other users.
Impact
Successful exploitation can lead to a full compromise of user accounts within the Postiz application. An attacker could:
- Perform actions on behalf of other users (session riding).
- Steal session cookies and authentication tokens to hijack accounts.
- Deface the application or redirect users to malicious sites. Since the attack only requires a standard user account, the potential for widespread account takeover is significant.
Remediation and Mitigation
The primary and definitive remediation is to update the Postiz application. The vendor has released a fix in version 2.21.6. All instances running a version prior to 2.21.6 must be upgraded to this version immediately.
If an immediate update is not possible, consider the following temporary mitigation strategies:
- Review server logs for unexpected file uploads, particularly of HTML or SVG files, from authenticated sessions.
- Implement a Web Application Firewall (WAF) rule to block requests that upload files with executable extensions but claim a non-executable
Content-Typeheader. - Advise users to be cautious of unexpected links or content within the application, though this is not a reliable security control.
For more information on the consequences of account compromise, you can review recent incidents in our breach reports.
Security Insight
This vulnerability highlights the critical importance of implementing file upload validation on both the client and server side, with the server-side check being the authoritative and immutable one. Relying on client-supplied headers like Content-Type for security decisions is a recurring anti-pattern, similar to flaws that have led to major compromises in other content management and social platforms. It underscores that even modern AI-integrated applications must adhere to fundamental, rigorous security hygiene for all input handling functions.
Further Reading
Never miss a critical vulnerability
Get real-time security alerts delivered to your preferred platform.
Public PoC References
Unverified third-party code
These repositories are publicly listed on GitHub and have not been audited by Yazoul Security. They may contain malware, backdoors, destructive payloads, or operational security risks (telemetry, exfiltration). Treat them as hostile binaries. Inspect source before execution. Run only in isolated, disposable lab environments (offline VM, no credentials, no production data).
Authorized use only. This information is provided for defensive research, detection engineering, and patch validation. Using exploit code against systems you do not own or do not have explicit written permission to test is illegal in most jurisdictions and violates Yazoul's terms of use.
| Repository | Stars |
|---|---|
| Astaruf/CVE-2026-40487 CVE-2026-40487 | Postiz <= 2.21.5 | Arbitrary File Upload via MIME-Type Spoofing → Stored XSS → Account Takeover | CVSS 8.9 High | ★ 1 |
Showing 1 of 1 known references. Source: nomi-sec/PoC-in-GitHub.
Related Advisories
A Stored Cross-Site Scripting vulnerability was discovered in the Assets and Nodes functionality due to improper validation of an input parameter. An authenticated user with custom fields privileges c...
A Cross-site Scripting (XSS) vulnerability was identified in the `from_dict` method of the `AppLollmsMessage` class in parisneo/lollms prior to version 2.2.0. The vulnerability arises from the lack of...
Stored XSS in log viewer in CoolerControl/coolercontrol-ui <4.0.0 allows unauthenticated attackers to take over the service via malicious JavaScript in poisoned log entries...
MyBB Downloads Plugin 2.0.3 contains a persistent cross-site scripting vulnerability that allows regular members to inject malicious scripts through the download title field. Attackers can submit a ne...