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

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

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.

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

Quick answers

Is CVE-2025-15366 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2025-15366 being exploited in the wild.
How severe is CVE-2025-15366?
Informational severity, with a CVSS score of 5.9, published 20 January 2026.
Which products and versions are affected?
Python Software Foundation CPython < 3.15.0a6.
Is there a fix for CVE-2025-15366?
A patch was published on 2026-01-20: Initial fix merged into CPython main branch. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2025-15366 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2025-15366?
Check whether you run Python Software Foundation CPython at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

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

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.