.. _smtplib-tls-stripping: smtplib TLS stripping ===================== .. warning:: This resource is maintained for historical reference and **does not contain the latest vulnerability info for Python**. The `canonical database for vulnerabilities affecting Python `_ is available on GitHub in the Open Source Vulnerability (OSV) format. This vulnerability can be viewed online at the `Open Source Vulnerability Database `_. 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. Dates: * Disclosure date: **2016-06-11** (commit date) * Reported at: 2016-02-01 (Red Hat issue reported) * Reported by: Tin (Team Oststrom) Fixed In -------- * Python **2.7.12** (2016-06-25) fixed by `commit 2e1b7fc (branch 2.7) `_ (2016-06-11) * Python **3.3.7** (2017-09-19) fixed by `commit 3625f7f (branch 3.3) `_ (2017-07-19) * Python **3.4.5** (2016-06-25) fixed by `commit 46b32f3 (branch 3.4) `_ (2016-06-11) * Python **3.5.2** (2016-06-25) fixed by `commit 46b32f3 (branch 3.4) `_ (2016-06-11) * Python **3.6.0** (2016-12-22) fixed by `commit 46b32f3 (branch 3.4) `_ (2016-06-11) 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." * CVE ID: `CVE-2016-0772 `_ * Published: 2016-09-02 * `CVSS Score `_: 5.8 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: `commit 2e1b7fc (branch 2.7) `_ * 2016-06-11: `commit 46b32f3 (branch 3.4) `_ * 2016-06-25 (**+14 days**): Python 2.7.12 released * 2016-06-25 (**+14 days**): Python 3.4.5 released * 2016-06-25 (**+14 days**): Python 3.5.2 released * 2016-09-02 (**+83 days**): CVE-2016-0772 published * 2016-12-22: Python 3.6.0 released * 2017-07-19 (**+403 days**): `commit 3625f7f (branch 3.3) `_ * 2017-09-19 (**+465 days**): Python 3.3.7 released Links ----- * http://seclists.org/oss-sec/2016/q2/541 * https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2016-0772