KRB-FTP: Security level downgrade
libcurl does not abort an FTP connection when Kerberos authentication fails; instead it falls back to plain clear-text password authentication. An active man-in-the-middle attacker can force the Kerberos attempt to fail and thereby downgrade the session to unprotected credentials.
- Disclosed after 3 days
Summary:
libcurl doesn't fail the FTP connection if Kerberos authentication fails for some reason, but rather reverts back to using regular clear text password authentication.
The logic is inlib/ftp.c ftp_statemachine: https://github.com/curl/curl/blob/07a9b89fedaec60bdbc254f23f66149b31d2f8da/lib/ftp.c#L2706
This means that active attacker in a man in the middle position can downgrade any attempt to use Kerberos FTP to regular one by merely forcing the Kerberos authentication to fail.
The more secure course of action would be to fail the FTP connection if Kerberos authentication fails. If such change is not deemed necessary the current limitations should be documented.
Steps To Reproduce:
- MitM the connection and make the kerberos authentication fail
curl --krb private ftp://victim.tld/
Impact
- Security level downgrade.
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 the FTP state machine treats a failed Kerberos authentication as a reason to try the next authentication method rather than as a fatal error, so it silently falls back to clear-text credentials.
Impact
An active attacker in a man-in-the-middle position could downgrade a Kerberos-protected FTP session to clear-text password authentication.
What the attacker needed
Attacker in man-in-the-middle position; client uses Kerberos FTP option
The fix
The connection should be aborted when Kerberos authentication fails, or, if that behaviour is kept, the limitation should be documented.
How it was found
- Place yourself in a man-in-the-middle position and cause the Kerberos authentication to fail.
- Run curl against the FTP server with Kerberos requested and observe the fallback.
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.
Kerberos is a way of logging in without sending a password over the network. libcurl is a library many programs use to download files. The report says that when the Kerberos login fails, libcurl quietly switches to sending a normal password in the clear instead of stopping, so someone sitting on the network path can force that switch and read the password.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.