Discourse ImageMagick Vulnerability Enables Arbitrary File Read Through Malicious Image Uploads
Researchers disclosed CVE-2026-55420, letting low-privilege Discourse users read server files via ImageMagick uploads.
Searchlight Cyber disclosed CVE-2026-55420, a critical flaw in default Discourse Docker deployments. A Trust Level 0 user can upload a polyglot file that passes image checks, then win a TOCTOU race so ImageMagick, Ghostscript, and Magick Scripting Language read or write local files such as /etc/passwd. Hosted customers were fixed in June 2026, with public disclosure on June 30. Discourse now uses a default-deny ImageMagick policy that blocks unsafe delegates, including Ghostscript.
- CVE-2026-55420 affects default Discourse Docker deployments.
- A Trust Level 0 user can read and write server files.
- A polyglot upload passes image checks then hits ImageMagick and Ghostscript.
- A TOCTOU race swaps a temp file for an MSL payload.
- Discourse now blocks unsafe ImageMagick coders and delegates by default.
Vulnerabilities mentionedAll →
- CVE-2026-554208.1<1%Discourse: 2026.5.1, 2026.4.2, and 2026.1.5, under certain non-default configurations, processing of PDF uploads could be exploited to…published · discourse discourse
| CVE | Vulnerability | CVSS | EPSS | Flags | Affected | Exposure | Published |
|---|---|---|---|---|---|---|---|
| CVE-2026-55420 | Discourse: 2026.5.1, 2026.4.2, and 2026.1.5, under certain non-default configurations, processing of PDF uploads could be exploited to… Discourse is an open-source discussion platform. Prior to 2026.6.0, 2026.5.1, 2026.4.2, and 2026.1.5, under certain non-default configurations, processing of PDF uploads could be exploited to obtain RCE on the server. This issue is patched in 2026.6.0, 2026.5.1, 2026.4.2, and 2026.1.5. |
Full article627 words · extracted from gbhackers.com · click to collapse
Security researchers have revealed a critical vulnerability in Discourse, tracked as CVE-2026-55420. This flaw could let a low-privileged user read and write files on the underlying server by exploiting the platform’s ImageMagick-based upload pipeline.
The issue was fixed for hosted customers in June 2026 and was publicly disclosed on June 30, 2026.
The vulnerability affects default Discourse deployments using its Docker-based stack. It requires only a Trust Level 0 account, the platform’s lowest user privilege tier.
An attacker could exploit specially crafted image uploads to trigger a time-of-check-to-time-of-use (TOCTOU) race condition, ultimately gaining access to sensitive local files from the server.
Discourse ImageMagick Vulnerability
Research published by Kevin Gervot of Searchlight Cyber identified several unsafe interactions among Discourse’s upload validation, ImageMagick, Ghostscript, FastImage, and temporary file handling processes.
Discourse checks whether an upload appears to be a supported image based on the provided filename or image type detection. Supported file extensions include JPEG, PNG, GIF, SVG, WebP, AVIF, HEIC, and JPEG XL (JXL).
However, the upload-processing workflow later invokes ImageMagick’s convert utility on a temporary path that retains the attacker-controlled file extension.
The researchers created a polyglot file, a single file accepted as more than one format, by combining JPEG XL-like structures with PostScript content.
This allowed the malicious file to pass Discourse’s image checks while still reaching the ImageMagick and Ghostscript processing paths used for PDF and PostScript handling. The proof of concept demonstrated PostScript execution through the dominant-color calculation in the upload pipeline.

The more critical phase involved ImageMagick’s MSVG and MSL processing capabilities. MSL, or Magick Scripting Language, can instruct ImageMagick to read content from local paths and write it elsewhere.
In this chain, the researchers used a malicious upload to place an MSL payload in/tmp. Then they replaced a separate temporary upload file with an SVG trigger during processing.
To make this race practical, the researchers used a specially crafted JPEG file that prolonged the jpegoptim stage of Discourse’s image optimization workflow.
This delay widened the window for the target temporary file to be atomically replaced. When the later dominant-color operation processed the substituted SVG, it invoked ImageMagick’s internal SVG handling and loaded the attacker-controlled MSL payload.
The payload could read files such as /etc/passwd, save the content into an image, and then arrange for that image to be stored as a normal Discourse upload. The attack response would provide a URL to the uploaded result, eliminating the need for attackers to know the server’s filesystem layout.
This issue highlights why file-upload pipelines should not rely solely on file extensions, magic-byte detection, or format conversion as independent security measures. Complex parsers and delegate programs like Ghostscript significantly expand the attack surface, particularly when a file can be interpreted differently at various processing stages.

Although the demonstrated impact was arbitrary file read/write, the researchers cautioned that sensitive files, such as Rails secrets or environment data, could be leveraged to escalate access, depending on deployment configuration and available deserialization paths.
Discourse addressed this issue by implementing a default-deny security policy for ImageMagick. The new configuration blocks unsafe delegates, including Ghostscript execution, and only allows the necessary coders required by Discourse. This limits uploaded content’s ability to access risky ImageMagick functionality.
Administrators are advised to promptly update Discourse, verify that their deployed ImageMagick policy blocks unnecessary coders and delegates, restrict low-trust account upload capabilities whenever possible, and monitor for suspicious uploads involving mismatched extensions, unusual JXL/PDF characteristics, oversized JPEG metadata, or unexpected temporary file activities.
Stops Cyber threats before impact with 21 min faster MTTR. Integrate ANYRUN’s Sandbox in your SOC.
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.