Executive brief
Courier IMAP and Courier Mail Server are widely used email server components that allow users to access their mailboxes. A vulnerability in these servers allows a logged-in user to crash the email service by sending a specially crafted search request. This can lead to a denial-of-service, preventing all users from accessing their email until the service is restarted.
Technical details
A stack-based buffer overflow exists in the SEARCH command parser of Courier IMAP (before 6.0.1) and Courier Mail Server (before 2.0.2). The vulnerability is caused by uncontrolled recursion in the 'alloc_search_key' function within 'searchinfo.C', which lacks a depth limit for nested parenthesized groups. An authenticated attacker can trigger a mutual recursion chain (involving alloc_search_andlist and alloc_search_notkey) by sending a single IMAP command with approximately 2,500 nested parentheses. This exhausts the default 8MB stack, resulting in a SIGSEGV and process crash. The issue is mitigated in Courier IMAP 6.0.1 and Courier Mail Server 2.0.2 by implementing hard caps on IMAP command constructs.
Affected products
- svarshavchik Courier IMAP < 6.0.1
- svarshavchik Courier Mail Server < 2.0.2
Timeline
- 2026-06-27: patched: Fixes released in Courier IMAP 6.0.1 and Courier Mail Server 2.0.2
- 2026-07-29: disclosed: Vulnerability details and CVE assigned
References
- https://github.com/svarshavchik/courier-libs/commit/b5b5581aabea3efadf5e2944947ff0214aa3533e
- https://github.com/svarshavchik/courier/releases/tag/courier%2F2.0.2%2F20260627214309
- https://github.com/svarshavchik/courier/releases/tag/courier-imap%2F6.0.1%2F20260627214444
- https://packages.debian.org/sid/courier-imap
- https://www.vulncheck.com/advisories/courier-imap-mail-server-stack-overflow-dos-via-nested-search-queries