Discourse Image Pipeline Flaws Allow File Read and Cache Poisoning
Researchers disclosed two vulnerabilities in Discourse’s image handling that enable local file access and script execution, with patches released before publication.

Key points
- Basic users could read server files by chaining a JPEG race condition with Ghostscript and ImageMagick processing.
- A separate cache poisoning flaw allowed anonymous visitors to run JavaScript code.
- Researchers reported both issues in June 2026, and Discourse patched them before the technical report was published.
Security researchers disclosed two vulnerabilities in the Discourse forum software that allowed attackers to read server files and execute scripts. The findings, detailed in a report by Searchlight Cyber, were reported in June 2026. Discourse released patches for both issues before the researchers published their technical analysis.
The primary exploit chain enabled users with the lowest trust level to read arbitrary files on the server. This attack combined a time-of-check to time-of-use race condition with gaps in how Discourse processed image uploads. The chain leveraged the interaction between FastImage, ImageMagick, and Ghostscript to bypass security controls without exploiting a separate vulnerability in Ghostscript itself.
Technical Details of the Exploit Chain
The attack began by exploiting a mismatch in Discourse’s image validation logic. Although ImageMagick’s security policy blocked PostScript formats, it still permitted Ghostscript to process PDF files. Researchers crafted a file that contained JPEG XL identification bytes but held valid PostScript content. FastImage recognized the image dimensions, while the PDF extension directed ImageMagick to use Ghostscript for further processing.
Ghostscript interpreted the content as PostScript, allowing the file to reach Discourse’s dominant color calculation feature. This function passed the temporary file path to ImageMagick without enforcing a specific image decoder. The researchers then exploited a race condition between when the file was checked and when it was used.
To make the race condition reliable, attackers uploaded a valid JPEG with an .msvg extension and replaced the temporary file after FastImage checked it but before ImageMagick processed it. A specially padded JPEG slowed the jpegoptim processing stage to approximately 25 seconds. This delay provided a window for PostScript’s rename operation to replace the file atomically, allowing later reads to access the replacement SVG content instead of the original JPEG.
Impact and Affected Systems
Discourse powers more than 22,000 communities, making its upload handling a significant security target. The file read vulnerability required only a Trust Level 0 account, which is the lowest user trust level available on the platform. The research tested these exploits against default configurations, indicating that standard installations were vulnerable if not updated.
A second, separate flaw involved cache poisoning that could run JavaScript for anonymous visitors. This issue did not require user authentication. The findings are independent of other recent research by Hacktron, which involved different image decoder and sign-on bugs previously covered by Cybersecurity News.
What should you do?
Administrators running Discourse should verify that their installations are updated to the latest version that addresses these June 2026 patches. Since the exploits relied on default configurations, ensuring that image processing components like ImageMagick and Ghostscript are also up to date is critical. Organizations should review their upload handling policies to ensure strict validation of file types and extensions.
What to do and how to stay safe: Discourse
- Update Discourse installations immediately to apply the patches released in June 2026 for the image pipeline and cache poisoning flaws.
- Verify that underlying image processing libraries, including ImageMagick and Ghostscript, are updated to their latest stable versions to mitigate potential chaining risks.
- Review server configurations to ensure that temporary file handling during image processing does not allow race conditions or atomic replacements by low-privilege users.
- Monitor server logs for unusual file access patterns or unexpected execution of scripts from anonymous visitors, which could indicate exploitation of the cache poisoning flaw.
Step-by-step guide: Risk Based Vulnerability Management: Prioritize Fixes by Actual Threat
General security guidance from the Threat Times newsroom. It is not confirmed advice from the organisations named in this story.
Frequently asked questions
What trust level is required to exploit the file read vulnerability in Discourse?
The file read chain required only a Trust Level 0 account, which is the lowest user trust level available on the platform.
Did the researchers need to exploit a vulnerability in Ghostscript to perform the attack?
No, the researchers achieved the exploit without using a Ghostscript vulnerability or breaking its patched sandbox, instead leveraging how Discourse handled the file.
Are these vulnerabilities related to the Hacktron research on OpenAI?
No, the findings are independent of Hacktron’s OpenAI research, which involved different image decoder and sign-on bugs previously covered by Cybersecurity News.


