{"uuid": "5f21b886-b3e2-49c9-b650-332aa5e76eec", "vulnerability_lookup_origin": "1a89b78e-f703-45f3-bb86-59eb712668bd", "author": "9f56dd64-161d-43a6-b9c3-555944290a09", "vulnerability": "CVE-2025-15366", "type": "seen", "source": "https://gist.github.com/alon710/3935cc4d3f28b0cb5ea2e7fe85b3ea26", "content": "# CVE-2025-15366: CVE-2025-15366: Protocol Command Injection in Python CPython imaplib Standard Library\n\n&gt; **CVSS Score:** 5.9\n&gt; **Published:** 2026-01-20\n&gt; **Full Report:** https://cvereports.com/reports/CVE-2025-15366\n\n## Summary\nCVE-2025-15366 is a command injection vulnerability in Python's standard imaplib module, occurring due to the improper neutralization of carriage returns (\\r), line feeds (\\n), and null bytes (\\x00). When an application passes user-controlled input into standard IMAP library calls, an attacker can break out of the line-oriented protocol context and execute arbitrary IMAP directives with the privileges of the authenticated session.\n\n## TL;DR\nA protocol command injection vulnerability exists in Python's standard imaplib library due to a lack of NUL, CR, and LF byte validation in argument serialization. Attackers passing crafted folder or search parameters can inject arbitrary IMAP commands. This has been remediated in updated CPython versions.\n\n## Exploit Status: POC\n\n## Technical Details\n\n- **CWE ID**: CWE-77\n- **Attack Vector**: Network\n- **CVSS v4.0 Base Score**: 5.9\n- **EPSS Score**: 0.0036\n- **Exploit Status**: Proof-of-Concept (PoC)\n- **CISA KEV Status**: Not Listed\n- **Impact**: Integrity Compromise (High), Confidentiality (Low)\n\n## Affected Systems\n\n- Python (CPython) Runtime Environment\n- **CPython**: &lt; 3.13.15 (Fixed in: `3.13.15`)\n- **CPython**: &gt;= 3.14.0, &lt; 3.14.7 (Fixed in: `3.14.7`)\n- **CPython**: &gt;= 3.15.0a1, &lt; 3.15.0a6 (Fixed in: `3.15.0a6`)\n\n## Mitigation\n\n- Upgrade the CPython runtime to a patched version (3.13.15+, 3.14.7+, or 3.15.0a6+).\n- Implement a manual validation wrapper that rejects input containing '\\x00', '\\r', or '\\n' prior to invoking imaplib operations.\n\n**Remediation Steps:**\n1. Identify any usage of python standard library imaplib in the codebase.\n2. Audit external input flows that populate arguments to select, search, or other high-level library calls.\n3. Upgrade the deployment environment's Python interpreter to one of the fixed minor versions.\n4. In corporate setups with legacy code, apply custom sanitization to filter out Carriage Return, Line Feed, and Null byte characters.\n\n## References\n\n- [CPython Issue gh-143921: imaplib command injection via control characters](https://github.com/python/cpython/issues/143921)\n- [CPython Pull Request gh-143922: Fix control character verification in imaplib](https://github.com/python/cpython/pull/143922)\n- [Python Security Mailing List Announcement](https://mail.python.org/archives/list/security-announce@python.org/thread/DD7C7JZJYTBXMDOWKCEIEBJLBRU64OMR/)\n\n\n---\n*Generated by [CVEReports](https://cvereports.com/reports/CVE-2025-15366) - Automated Vulnerability Intelligence*", "creation_timestamp": "2026-08-06T07:31:27.549421Z"}