Register for the AI for Security Summit: Join Figma, Perplexity & Wiz

CVE-2025-59337
NixOS vulnerability analysis and mitigation

Overview

CVE-2025-59337 is a backup restore meta-command injection vulnerability in Discourse, an open-source community discussion platform. Malicious PostgreSQL meta-commands (e.g., \restrict, \unrestrict) could be embedded in a backup dump file and executed during the restore process. In multisite deployments, this allowed an administrator of one site to access data or credentials belonging to other sites sharing the same infrastructure. Affected versions include stable releases up to and including 3.5.0 and beta/tests-passed releases up to 3.6.0.beta1-dev. The vulnerability was published on September 30, 2025, and carries a CVSS v3.1 score of 6.8 (Medium) and a CVSS v4.0 score of 5.5 (Medium) (GitHub Advisory, Red Hat CVE).

Technical details

The root cause is improper neutralization of special elements used in a command (CWE-77 — Command Injection). Discourse's backup restore process pipes a SQL dump through a sed filter to strip unwanted SQL statements before passing it to psql. However, the original implementation did not strip or sanitize PostgreSQL meta-commands such as \restrict and \unrestrict, which are interpreted directly by the psql client rather than the database engine. An attacker with admin privileges on one Discourse site in a multisite setup could craft a malicious backup dump containing these meta-commands, then trigger a restore operation to have them executed in the context of the shared psql session, potentially accessing other sites' schemas and credentials (GitHub Advisory, GitHub Commit).

Impact

Successful exploitation primarily impacts confidentiality in multisite Discourse deployments, with no direct availability impact. A malicious site administrator can access sensitive data and credentials from other sites sharing the same infrastructure, constituting a significant cross-site data breach. The CVSS v4.0 scoring reflects high subsequent-system confidentiality, integrity, and availability impact, underscoring the risk to co-hosted sites beyond the attacker's own instance (GitHub Advisory, Red Hat CVE).

Exploitability

There is no public proof-of-concept exploit and no evidence of in-the-wild exploitation at this time. Exploitation requires high privileges (site administrator access) on a Discourse instance within a multisite deployment, limiting the attack surface. The EPSS score is approximately 0.043%, reflecting low near-term exploitation probability. The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog (GitHub Advisory).

Exploitation steps

  1. Gain admin access: Obtain administrator privileges on one Discourse site within a multisite deployment (e.g., through legitimate admin credentials or a separate compromise).
  2. Craft malicious backup: Create or modify a PostgreSQL dump file to embed malicious psql meta-commands (e.g., \restrict or \unrestrict directives) that, when processed by the psql client during restore, alter session-level access controls or execute cross-schema queries.
  3. Upload the backup: Use the Discourse admin backup interface to upload the crafted dump file to the target Discourse instance.
  4. Trigger restore: Initiate a backup restore operation via the admin panel. The restore process pipes the dump through sed (which did not previously strip \restrict/\unrestrict commands) and into psql.
  5. Access cross-site data: The injected meta-commands execute in the shared psql session, enabling the attacker to read data or credentials from other sites' database schemas within the same multisite infrastructure (GitHub Advisory, GitHub Commit).

Indicators of compromise

  • Logs: Discourse application logs showing backup restore operations initiated by an administrator, particularly on multisite deployments; PostgreSQL logs containing unexpected \restrict or \unrestrict meta-commands during restore sessions.
  • File System: Presence of modified or externally sourced .sql backup dump files in the Discourse backup directory containing \restrict or \unrestrict directives not generated by standard pg_dump.
  • Database: Unexpected cross-schema queries or access patterns in PostgreSQL audit logs originating from the Discourse restore process; unauthorized reads of credential tables from schemas belonging to other sites in a multisite setup.

Mitigation and workarounds

Upgrade Discourse to version 3.5.1 (stable) or 3.6.0.beta2-dev (tests-passed) or later, which implement nonce-based restrictions during restore to prevent injection of arbitrary meta-commands. The fix adds \restrict and \unrestrict to the sed filter's blocklist and wraps the restore pipeline with a cryptographically random nonce, ensuring only trusted meta-commands are processed. No configuration-based workaround is available; upgrading is the only remediation. In multisite environments, administrators should also audit existing backup files for suspicious meta-commands before performing any restore operations (GitHub Advisory, GitHub Commit).

Additional resources


SourceThis report was generated using AI

Related NixOS vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-91782LOW1.9
  • NixOS logoNixOS
  • gcc10-binutils
NoYesSep 15, 2026
CVE-2026-91781LOW1.9
  • NixOS logoNixOS
  • binutils
NoYesSep 15, 2026
CVE-2026-91780LOW1.9
  • NixOS logoNixOS
  • binutils
NoNoSep 15, 2026
CVE-2026-91779LOW1.9
  • NixOS logoNixOS
  • binutils
NoNoSep 15, 2026
CVE-2026-90831LOW1.9
  • NixOS logoNixOS
  • gcc-toolset-16-binutils.src
NoYesSep 14, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management