CVE-2021-22946: Protocol downgrade required TLS bypassed
In curl, the --ssl-reqd option was silently ignored for IMAP and POP3 if the capability command failed, and for FTP a non-standard 230 response in the greeting forced the connection to continue unencrypted. An attacker in a man-in-the-middle position could then sniff or modify the unencrypted data.
- Triaged in 5 hours
- Fixed in 14 days
- Paid in 14 days
- Disclosed after 16 days
Summary:
In imap and pop3, --ssl-reqd is silently ignored if the capability command failed. In ftp, a non-standard 230 response (preauthentication?) in the greeter message forces curl to continue unencrypted, even if TLS has been required.
Steps To Reproduce:
Use a parameterizable test server to fail capability command for imap (CAPABILITY reply: A001 BAD Not implemented) and pop3 (CAPA reply: -ERR Not implemented) and to send response code 230 in FTP server greeting message.
- curl --ssl-reqd imap://server/...
- curl --ssl-reqd pop3://server/...
- curl --ssl-reqd --ftp-ssl-control ftp://server/...
These 3 commands are successsful, but network sniffing shows that TLS is never negotiated.
Impact
A MitM can silently deny mandatory TLS negotiation and thus sniff and/or update unencrypted transferred data.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, curl treated a failed capability command or an unexpected FTP greeting response as a reason to skip the required TLS negotiation instead of aborting the connection.
Impact
A man-in-the-middle could silently prevent mandatory TLS negotiation and then sniff or modify the unencrypted data.
What the attacker needed
Attacker in man-in-the-middle position; server sends crafted capability or greeting response
How it was found
- Set up a test server that replies to the IMAP CAPABILITY command with a BAD response.
- Run curl with --ssl-reqd against the IMAP server.
- Set up a test server that replies to the POP3 CAPA command with an error.
- Run curl with --ssl-reqd against the POP3 server.
- Set up an FTP server that sends a 230 response in its greeting.
- Run curl with --ssl-reqd and --ftp-ssl-control against the FTP server.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
curl is a tool for transferring data. The --ssl-reqd option tells it to refuse to continue unless the connection is encrypted with TLS. This report shows that in some situations curl ignored that instruction and carried on without encryption, so someone watching the network could read or change the data.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.