BIT-python-min-2025-15366: IMAP command injection in user-controlled commands
The imaplib module, when passed a user-controlled command, can have additional commands injected using newlines. Mitigation rejects commands containing control characters.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Reject user-controlled IMAP commands that contain control characters, including newlines, to prevent additional commands from being injected.
Event History
Frequently Asked Questions
What must an attacker control to exploit this issue?
The attacker must be able to influence a command passed to imaplib. Newline characters in that command can be used to inject additional IMAP commands.
What can be done if an update cannot be applied immediately?
Reject user-controlled commands containing control characters, including newlines, before passing them to imaplib. This is the mitigation described for the issue.
How can I assess whether an application is exposed?
Review code paths that construct or pass IMAP commands through imaplib and identify whether any portion of those commands can be controlled by untrusted input. Exposure depends on user-controlled command content reaching the module without control-character rejection.