CVE-2016-0772: smtplib TLS stripping

A vulnerability in smtplib allowing MITM attacker to perform a startTLS stripping attack. smtplib does not seem to raise an exception when the remote end (SMTP server) is capable of negotiating starttls but fails to respond with 220 (ok) to an explicit call of SMTP.starttls(). This may allow a malicious MITM to perform a startTLS stripping attack if the client code does not explicitly check the response code for startTLS.

  • Disclosure date: 2016-06-11 (commit date)
  • Reported at: 2016-02-01 (Red Hat issue reported)
  • Reported by: Tin (Team Oststrom)

Fixed In

CVE-2016-0772

The smtplib library in CPython (aka Python) before 2.7.12, 3.x before 3.4.5, and 3.5.x before 3.5.2 does not return an error when StartTLS fails, which might allow man-in-the-middle attackers to bypass the TLS protections by leveraging a network position between the client and the registry to block the StartTLS command, aka a “StartTLS stripping attack.”

Timeline

Timeline using the disclosure date 2016-06-11 as reference:

  • 2016-02-01 (-131 days): Reported (Red Hat issue reported)
  • 2016-06-11: Disclosure date (commit date)
  • 2016-06-11 (+0 days): commit 2e1b7fc
  • 2016-06-11 (+0 days): commit 46b32f3
  • 2016-06-27 (+16 days): Python 3.4.5 released
  • 2016-06-27 (+16 days): Python 3.5.2 released
  • 2016-06-28 (+17 days): Python 2.7.12 released
  • 2016-09-02 (+83 days): CVE-2016-0772 published
  • 2016-12-23: Python 3.6.0 released
  • 2017-07-19 (+403 days): commit 3625f7f
  • 2017-09-19 (+465 days): Python 3.3.7 released