Cloudanix VulnDB

CVE-2016-0772

Medium · 6.5

CVSS

6.5

EPSS

14.5%

Published

Sep 2, 2016

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

Python programs that send email could be tricked into sending messages without encryption, letting someone in the middle read or change them.

Exploit Available
Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
High
Impact
Data Tampering
Component
Library
Class
Cryptographic Weakness
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

smtplib fails to raise an error or abort when the StartTLS command is rejected or stripped, allowing the subsequent SMTP session to continue over plaintext instead of TLS.

Why it matters to the business

Organizations using Python scripts to send email over untrusted networks risk disclosure or tampering of message contents and credentials because encryption can be silently disabled by an attacker positioned on the network path.

How an attack unfolds

An attacker on the path between a Python client and an SMTP server intercepts traffic, drops or responds negatively to the StartTLS command, and lets the client proceed with AUTH and mail transmission in cleartext; because no exception is raised the application continues as if TLS succeeded.

How to fix it

Upgrade CPython to 2.7.12 or later, 3.4.5 or later, or 3.5.2 or later; after upgrade, verify that smtplib.starttls() raises SMTPResponseException or aborts on failure and consider enforcing TLS with context.check_hostname and verify_mode.

How to confirm the fix worked

Run a test SMTP connection against a server that rejects StartTLS and confirm an exception is raised; scan source for calls to starttls() without subsequent exception handling; review installed Python version against the fixed releases listed above.

Typical attack path

  1. Position as network MITM between Python SMTP client and mail server
  2. Block or forge failure response to client's StartTLS command
  3. Allow subsequent AUTH, MAIL FROM, RCPT TO, and DATA commands to proceed unencrypted
  4. Capture or modify message content and any credentials sent in plaintext

How to detect it

Search application and mail-server logs for SMTP sessions that begin without a 220 STARTTLS-capable banner or that proceed directly to AUTH after a failed or absent StartTLS exchange; inspect network captures for plaintext SMTP traffic from Python processes on ports 25/587/465.

What your security team should do

  • Immediately inventory all Python 2.7 < 2.7.12, 3.4 < 3.4.5, and 3.5 < 3.5.2 deployments that use smtplib
  • Prioritize patching internet-facing or cloud-hosted Python email clients first
  • Add runtime checks or wrapper code that treats StartTLS failure as fatal until upgrades complete
  • Monitor EPSS and exploit availability; treat as high priority despite age because working exploits exist

The record

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."

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 python2.7 0 2.7.12~rc1-1
Debian:7 python2.7 0 2.7.3-6+deb7u3
Debian:7 python3.2 0 3.2.3-7+deb7u1
Debian:8 python3.4 0 3.4.2-1+deb8u2
Mageia:5 python 0 2.7.9-2.3.mga5
Mageia:5 python3 0 3.4.3-1.4.mga5
Red Hat:enterprise_linux:6::client python 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::client python-debuginfo 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::client python-devel 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::client python-libs 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::client python-test 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::client python-tools 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::client tkinter 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::computenode python 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::computenode python-debuginfo 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::computenode python-devel 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::computenode python-libs 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::computenode python-test 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::computenode python-tools 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::computenode tkinter 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::server python 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::server python-debuginfo 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::server python-devel 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::server python-libs 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::server python-test 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::server python-tools 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::server tkinter 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::workstation python 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::workstation python-debuginfo 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::workstation python-devel 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::workstation python-libs 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::workstation python-test 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::workstation python-tools 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:6::workstation tkinter 0 0:2.6.6-66.el6_8
Red Hat:enterprise_linux:7::client python 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::client python-debug 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::client python-debuginfo 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::client python-devel 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::client python-libs 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::client python-test 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::client python-tools 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::client tkinter 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::computenode python 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::computenode python-debug 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::computenode python-debuginfo 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::computenode python-devel 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::computenode python-libs 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::computenode python-test 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::computenode python-tools 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::computenode tkinter 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::server python 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::server python-debug 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::server python-debuginfo 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::server python-devel 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::server python-libs 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::server python-test 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::server python-tools 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::server tkinter 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::workstation python 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::workstation python-debug 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::workstation python-debuginfo 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::workstation python-devel 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::workstation python-libs 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::workstation python-test 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::workstation python-tools 0 0:2.7.5-38.el7_2
Red Hat:enterprise_linux:7::workstation tkinter 0 0:2.7.5-38.el7_2
Red Hat:rhel_software_collections:2::el6 python27-python 0 0:2.7.8-18.el6
Red Hat:rhel_software_collections:2::el6 python27-python-debug 0 0:2.7.8-18.el6
Red Hat:rhel_software_collections:2::el6 python27-python-debuginfo 0 0:2.7.8-18.el6
Red Hat:rhel_software_collections:2::el6 python27-python-devel 0 0:2.7.8-18.el6
Red Hat:rhel_software_collections:2::el6 python27-python-libs 0 0:2.7.8-18.el6
Red Hat:rhel_software_collections:2::el6 python27-python-test 0 0:2.7.8-18.el6
Red Hat:rhel_software_collections:2::el6 python27-python-tools 0 0:2.7.8-18.el6
Red Hat:rhel_software_collections:2::el6 python27-tkinter 0 0:2.7.8-18.el6
Red Hat:rhel_software_collections:2::el6 python33-python 0 0:3.3.2-18.el6
Red Hat:rhel_software_collections:2::el6 python33-python-debug 0 0:3.3.2-18.el6
Red Hat:rhel_software_collections:2::el6 python33-python-debuginfo 0 0:3.3.2-18.el6
Red Hat:rhel_software_collections:2::el6 python33-python-devel 0 0:3.3.2-18.el6
Red Hat:rhel_software_collections:2::el6 python33-python-libs 0 0:3.3.2-18.el6
Red Hat:rhel_software_collections:2::el6 python33-python-test 0 0:3.3.2-18.el6
Red Hat:rhel_software_collections:2::el6 python33-python-tkinter 0 0:3.3.2-18.el6
Red Hat:rhel_software_collections:2::el6 python33-python-tools 0 0:3.3.2-18.el6
Red Hat:rhel_software_collections:2::el6 rh-python34-python 0 0:3.4.2-14.el6
Red Hat:rhel_software_collections:2::el6 rh-python34-python-debug 0 0:3.4.2-14.el6
Red Hat:rhel_software_collections:2::el6 rh-python34-python-debuginfo 0 0:3.4.2-14.el6
Red Hat:rhel_software_collections:2::el6 rh-python34-python-devel 0 0:3.4.2-14.el6
Red Hat:rhel_software_collections:2::el6 rh-python34-python-libs 0 0:3.4.2-14.el6
Red Hat:rhel_software_collections:2::el6 rh-python34-python-test 0 0:3.4.2-14.el6
Red Hat:rhel_software_collections:2::el6 rh-python34-python-tkinter 0 0:3.4.2-14.el6
Red Hat:rhel_software_collections:2::el6 rh-python34-python-tools 0 0:3.4.2-14.el6
Red Hat:rhel_software_collections:2::el7 python27-python 0 0:2.7.8-16.el7
Red Hat:rhel_software_collections:2::el7 python27-python-debug 0 0:2.7.8-16.el7
Red Hat:rhel_software_collections:2::el7 python27-python-debuginfo 0 0:2.7.8-16.el7
Red Hat:rhel_software_collections:2::el7 python27-python-devel 0 0:2.7.8-16.el7
Red Hat:rhel_software_collections:2::el7 python27-python-libs 0 0:2.7.8-16.el7
Red Hat:rhel_software_collections:2::el7 python27-python-test 0 0:2.7.8-16.el7
Red Hat:rhel_software_collections:2::el7 python27-python-tools 0 0:2.7.8-16.el7
Red Hat:rhel_software_collections:2::el7 python27-tkinter 0 0:2.7.8-16.el7
Red Hat:rhel_software_collections:2::el7 python33-python 0 0:3.3.2-16.el7
Red Hat:rhel_software_collections:2::el7 python33-python-debug 0 0:3.3.2-16.el7
Red Hat:rhel_software_collections:2::el7 python33-python-debuginfo 0 0:3.3.2-16.el7
Red Hat:rhel_software_collections:2::el7 python33-python-devel 0 0:3.3.2-16.el7
Red Hat:rhel_software_collections:2::el7 python33-python-libs 0 0:3.3.2-16.el7
Red Hat:rhel_software_collections:2::el7 python33-python-test 0 0:3.3.2-16.el7
Red Hat:rhel_software_collections:2::el7 python33-python-tkinter 0 0:3.3.2-16.el7
Red Hat:rhel_software_collections:2::el7 python33-python-tools 0 0:3.3.2-16.el7
Red Hat:rhel_software_collections:2::el7 rh-python34-python 0 0:3.4.2-13.el7
Red Hat:rhel_software_collections:2::el7 rh-python34-python-debug 0 0:3.4.2-13.el7
Red Hat:rhel_software_collections:2::el7 rh-python34-python-debuginfo 0 0:3.4.2-13.el7
Red Hat:rhel_software_collections:2::el7 rh-python34-python-devel 0 0:3.4.2-13.el7
Red Hat:rhel_software_collections:2::el7 rh-python34-python-libs 0 0:3.4.2-13.el7
Red Hat:rhel_software_collections:2::el7 rh-python34-python-test 0 0:3.4.2-13.el7
Red Hat:rhel_software_collections:2::el7 rh-python34-python-tkinter 0 0:3.4.2-13.el7
Red Hat:rhel_software_collections:2::el7 rh-python34-python-tools 0 0:3.4.2-13.el7
Red Hat:rhel_software_collections:2::el7 rh-python35-python 0 0:3.5.1-9.el7
Red Hat:rhel_software_collections:2::el7 rh-python35-python-debug 0 0:3.5.1-9.el7
Red Hat:rhel_software_collections:2::el7 rh-python35-python-debuginfo 0 0:3.5.1-9.el7
Red Hat:rhel_software_collections:2::el7 rh-python35-python-devel 0 0:3.5.1-9.el7
Red Hat:rhel_software_collections:2::el7 rh-python35-python-libs 0 0:3.5.1-9.el7
Red Hat:rhel_software_collections:2::el7 rh-python35-python-test 0 0:3.5.1-9.el7
Red Hat:rhel_software_collections:2::el7 rh-python35-python-tkinter 0 0:3.5.1-9.el7
Red Hat:rhel_software_collections:2::el7 rh-python35-python-tools 0 0:3.5.1-9.el7
SUSE:Linux Enterprise Desktop 12 SP1 python 0 2.7.9-24.1
SUSE:Linux Enterprise Desktop 12 SP1 python-base 0 2.7.9-24.2
SUSE:Linux Enterprise Desktop 12 SP1 python3 0 3.4.5-17.1
SUSE:Linux Enterprise Desktop 12 SP1 python3-base 0 3.4.5-17.1
SUSE:Linux Enterprise Desktop 12 SP2 python3 0 3.4.5-19.1
SUSE:Linux Enterprise Desktop 12 SP2 python3-base 0 3.4.5-19.1
SUSE:Linux Enterprise Module for Basesystem 15 python 0 2.7.17-7.32.2
SUSE:Linux Enterprise Module for Basesystem 15 python-base 0 2.7.17-7.32.1
SUSE:Linux Enterprise Module for Basesystem 15 python3 0 3.6.10-3.42.2
SUSE:Linux Enterprise Module for Basesystem 15 python3-base 0 3.6.10-3.42.2
SUSE:Linux Enterprise Module for Basesystem 15 SP1 python 0 2.7.17-7.32.2
SUSE:Linux Enterprise Module for Basesystem 15 SP1 python-base 0 2.7.17-7.32.1
SUSE:Linux Enterprise Module for Basesystem 15 SP1 python3 0 3.6.10-3.42.2
SUSE:Linux Enterprise Module for Basesystem 15 SP1 python3-base 0 3.6.10-3.42.2
SUSE:Linux Enterprise Module for Desktop Applications 15 python 0 2.7.17-7.32.2
SUSE:Linux Enterprise Module for Desktop Applications 15 SP1 python 0 2.7.17-7.32.2
SUSE:Linux Enterprise Module for Development Tools 15 python3-base 0 3.6.10-3.42.2
SUSE:Linux Enterprise Module for Development Tools 15 SP1 python3-base 0 3.6.10-3.42.2
SUSE:Linux Enterprise Module for Python 2 15 SP1 python 0 2.7.17-7.32.2
SUSE:Linux Enterprise Module for Python 2 15 SP1 python-base 0 2.7.17-7.32.1
SUSE:Linux Enterprise Module for Web and Scripting 12 python3 0 3.4.5-17.1
SUSE:Linux Enterprise Module for Web and Scripting 12 python3-base 0 3.4.5-17.1
SUSE:Linux Enterprise Server 11 SP4 python 0 2.6.9-39.1
SUSE:Linux Enterprise Server 11 SP4 python-base 0 2.6.9-39.1
SUSE:Linux Enterprise Server 11 SP4 python-doc 0 2.6-8.39.1
SUSE:Linux Enterprise Server 12 SP1 python 0 2.7.9-24.1
SUSE:Linux Enterprise Server 12 SP1 python-base 0 2.7.9-24.2
SUSE:Linux Enterprise Server 12 SP1 python-doc 0 2.7.9-24.4
SUSE:Linux Enterprise Server 12 SP1 python3 0 3.4.5-17.1
SUSE:Linux Enterprise Server 12 SP1 python3-base 0 3.4.5-17.1
SUSE:Linux Enterprise Server 12 SP2 python3 0 3.4.5-19.1
SUSE:Linux Enterprise Server 12 SP2 python3-base 0 3.4.5-19.1
SUSE:Linux Enterprise Server 12-LTSS python 0 2.7.9-16.7.1
SUSE:Linux Enterprise Server 12-LTSS python-base 0 2.7.9-16.7.2
SUSE:Linux Enterprise Server 12-LTSS python-doc 0 2.7.9-16.7.2
SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 python3 0 3.4.5-19.1
SUSE:Linux Enterprise Server for Raspberry Pi 12 SP2 python3-base 0 3.4.5-19.1
SUSE:Linux Enterprise Server for SAP Applications 11 SP4 python 0 2.6.9-39.1
SUSE:Linux Enterprise Server for SAP Applications 11 SP4 python-base 0 2.6.9-39.1
SUSE:Linux Enterprise Server for SAP Applications 11 SP4 python-doc 0 2.6-8.39.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP1 python 0 2.7.9-24.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP1 python-base 0 2.7.9-24.2
SUSE:Linux Enterprise Server for SAP Applications 12 SP1 python-doc 0 2.7.9-24.4
SUSE:Linux Enterprise Server for SAP Applications 12 SP1 python3 0 3.4.5-17.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP1 python3-base 0 3.4.5-17.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP2 python3 0 3.4.5-19.1
SUSE:Linux Enterprise Server for SAP Applications 12 SP2 python3-base 0 3.4.5-19.1
SUSE:Linux Enterprise Software Development Kit 11 SP4 python 0 2.6.9-39.1
SUSE:Linux Enterprise Software Development Kit 11 SP4 python-base 0 2.6.9-39.1
SUSE:Linux Enterprise Software Development Kit 11 SP4 python-doc 0 2.6-8.39.1
SUSE:Linux Enterprise Software Development Kit 12 SP1 python-base 0 2.7.9-24.2
SUSE:Linux Enterprise Software Development Kit 12 SP1 python3-base 0 3.4.5-17.1
SUSE:Linux Enterprise Software Development Kit 12 SP2 python3-base 0 3.4.5-19.1
SUSE:Linux Enterprise Workstation Extension 12 SP1 python-base 0 2.7.9-24.2
Ubuntu:14.04:LTS python2.7 0 2.7.6-8ubuntu0.3
Ubuntu:14.04:LTS python3.4 0 3.4.3-1ubuntu1~14.04.5
Ubuntu:14.04:LTS python3.5 0 3.5.2-2ubuntu0~16.04.4~14.04.1
Ubuntu:16.04:LTS python2.7 0 2.7.12-1ubuntu0~16.04.1
Ubuntu:16.04:LTS python3.5 0 3.5.2-2ubuntu0~16.04.1
openSUSE:Leap 15.1 python3 0 3.6.10-lp151.6.7.1
openSUSE:Leap 15.1 python3-base 0 3.6.10-lp151.6.7.1
openSUSE:Tumbleweed python 0 2.7.12-1.5
openSUSE:Tumbleweed python-base 0 2.7.12-1.4
openSUSE:Tumbleweed python-doc 0 2.7.12-1.3
openSUSE:Tumbleweed python36 0 3.6.15-1.1

Related vulnerabilities