Junglewise Threat Intelligence

CVE-2025-15366: Python CPython command injection in imaplib

CVE-2025-15366 · Severity: info · CVSS 5.9 · Published 2026-01-20

Technologies: Python Software Foundation CPython. Vendors: Python Software Foundation.

Executive brief

A vulnerability in Python's standard IMAP library could allow an attacker to inject unauthorized commands into an email session. If an application uses this library to process user-provided input without proper validation, an attacker could potentially manipulate email data or perform unauthorized actions on a mail server. This issue primarily affects systems where users can influence the specific commands sent to an IMAP server.

Technical details

A command injection vulnerability exists in the imaplib module of CPython. The module failed to properly neutralize control characters, specifically newlines (CR/LF), when processing user-supplied input for IMAP commands. An attacker with the ability to influence command arguments can inject additional, unintended IMAP commands into the protocol stream. The fix involves implementing a check that rejects commands containing NUL, CR, or LF characters. This vulnerability is tracked as CWE-77 (Command Injection).

Affected products

  • Python Software Foundation CPython < 3.15.0a6

Timeline

  • 2026-01-16: disclosed: Issue reported and initial PR created in CPython repository.
  • 2026-01-20: patched: Initial fix merged into CPython main branch.
  • 2026-01-20: advisory: Official security announcement via Python security-announce mailing list.

References

Related threats