Vulnerabilities > CVE-2019-18348 - Injection vulnerability in Python
Summary
An issue was discovered in urllib2 in Python 2.x through 2.7.17 and urllib in Python 3.x through 3.8.0. CRLF injection is possible if the attacker controls a url parameter, as demonstrated by the first argument to urllib.request.urlopen with \r\n (specifically in the host component of a URL) followed by an HTTP header. This is similar to the CVE-2019-9740 query string issue and the CVE-2019-9947 path string issue. (This is not exploitable when glibc has CVE-2016-10739 fixed.). This is fixed in: v2.7.18, v2.7.18rc1; v3.5.10, v3.5.10rc1; v3.6.11, v3.6.11rc1, v3.6.12; v3.7.8, v3.7.8rc1, v3.7.9; v3.8.3, v3.8.3rc1, v3.8.4, v3.8.4rc1, v3.8.5, v3.8.6, v3.8.6rc1.
Vulnerable Configurations
Common Weakness Enumeration (CWE)
Common Attack Pattern Enumeration and Classification (CAPEC)
- Buffer Overflow via Environment Variables This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.
- Server Side Include (SSI) Injection An attacker can use Server Side Include (SSI) Injection to send code to a web application that then gets executed by the web server. Doing so enables the attacker to achieve similar results to Cross Site Scripting, viz., arbitrary code execution and information disclosure, albeit on a more limited scale, since the SSI directives are nowhere near as powerful as a full-fledged scripting language. Nonetheless, the attacker can conveniently gain access to sensitive files, such as password files, and execute shell commands.
- Cross Site Scripting through Log Files An attacker may leverage a system weakness where logs are susceptible to log injection to insert scripts into the system's logs. If these logs are later viewed by an administrator through a thin administrative interface and the log data is not properly HTML encoded before being written to the page, the attackers' scripts stored in the log will be executed in the administrative interface with potentially serious consequences. This attack pattern is really a combination of two other attack patterns: log injection and stored cross site scripting.
- Command Line Execution through SQL Injection An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
- Subverting Environment Variable Values The attacker directly or indirectly modifies environment variables used by or controlling the target software. The attacker's goal is to cause the target software to deviate from its expected operation in a manner that benefits the attacker.
Nessus
NASL family Fedora Local Security Checks NASL id FEDORA_2019-B06EC6159B.NASL description Python 3.5 has now entered last seen 2020-06-01 modified 2020-06-02 plugin id 130793 published 2019-11-12 reporter This script is Copyright (C) 2019 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/130793 title Fedora 30 : python35 (2019-b06ec6159b) NASL family SuSE Local Security Checks NASL id SUSE_SU-2020-1339-1.NASL description This update for python fixes the following issues : Security issues fixed : CVE-2019-18348: Fixed a CRLF injection via the host part of the url passed to urlopen(). Now an InvalidURL exception is raised (bsc#1155094). CVE-2019-9674: Improved the documentation to reflect the dangers of zip-bombs (bsc#1162825). Note that Tenable Network Security has extracted the preceding description block directly from the SUSE security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues. last seen 2020-05-31 modified 2020-05-22 plugin id 136798 published 2020-05-22 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/136798 title SUSE SLED15 / SLES15 Security Update : python (SUSE-SU-2020:1339-1) NASL family SuSE Local Security Checks NASL id SUSE_SU-2020-0750-1.NASL description This update for python36 fixes the following issues : CVE-2019-18348: Fixed a CRLF injection via the host part of the url passed to urlopen(). Now an InvalidURL exception is raised (bsc#1155094). Note that Tenable Network Security has extracted the preceding description block directly from the SUSE security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues. last seen 2020-03-26 modified 2020-03-24 plugin id 134853 published 2020-03-24 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/134853 title SUSE SLES12 Security Update : python36 (SUSE-SU-2020:0750-1) NASL family FreeBSD Local Security Checks NASL id FREEBSD_PKG_CA595A2591D811EAB470080027846A02.NASL description Python reports : An issue was discovered in urllib2 in Python 2.x through 2.7.17 and urllib in Python 3.x through 3.8.0. CRLF injection is possible if the attacker controls a url parameter, as demonstrated by the first argument to urllib.request.urlopen with \r\n (specifically in the host component of a URL) followed by an HTTP header. last seen 2020-06-10 modified 2020-05-11 plugin id 136443 published 2020-05-11 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/136443 title FreeBSD : Python -- CRLF injection via the host part of the url passed to urlopen() (ca595a25-91d8-11ea-b470-080027846a02) NASL family SuSE Local Security Checks NASL id OPENSUSE-2020-696.NASL description This update for python fixes the following issues : Security issues fixed : - CVE-2019-18348: Fixed a CRLF injection via the host part of the url passed to urlopen(). Now an InvalidURL exception is raised (bsc#1155094). - CVE-2019-9674: Improved the documentation to reflect the dangers of zip-bombs (bsc#1162825). This update was imported from the SUSE:SLE-15:Update update project. last seen 2020-05-31 modified 2020-05-26 plugin id 136884 published 2020-05-26 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/136884 title openSUSE Security Update : python (openSUSE-2020-696) NASL family SuSE Local Security Checks NASL id SUSE_SU-2020-0854-1.NASL description This update for python3 fixes the following issue : CVE-2019-18348: Fixed a CRLF injection via the host part of the url passed to urlopen(). Now an InvalidURL exception is raised (bsc#1155094). CVE-2019-9674: Improved the documentation to reflect the dangers of zip-bombs (bsc#1162825). CVE-2020-8492: Fixed a regular expression in urllib that was prone to denial of service via HTTP (bsc#1162367). Fixed an issue with version missmatch (bsc#1162224). Rename idle icons to idle3 in order to not conflict with python2 variant of the package. (bsc#1165894) Note that Tenable Network Security has extracted the preceding description block directly from the SUSE security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues. last seen 2020-04-10 modified 2020-04-03 plugin id 135197 published 2020-04-03 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/135197 title SUSE SLES12 Security Update : python3 (SUSE-SU-2020:0854-1) NASL family PhotonOS Local Security Checks NASL id PHOTONOS_PHSA-2020-1_0-0287_PYTHON2.NASL description An update of the python2 package has been released. last seen 2020-04-22 modified 2020-04-15 plugin id 135487 published 2020-04-15 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/135487 title Photon OS 1.0: Python2 PHSA-2020-1.0-0287 NASL family PhotonOS Local Security Checks NASL id PHOTONOS_PHSA-2020-2_0-0223_PYTHON2.NASL description An update of the python2 package has been released. last seen 2020-04-14 modified 2020-04-10 plugin id 135308 published 2020-04-10 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/135308 title Photon OS 2.0: Python2 PHSA-2020-2.0-0223 NASL family Fedora Local Security Checks NASL id FEDORA_2019-D202CDA4F8.NASL description Python 3.5 has now entered last seen 2020-06-01 modified 2020-06-02 plugin id 130797 published 2019-11-12 reporter This script is Copyright (C) 2019 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/130797 title Fedora 29 : python35 (2019-d202cda4f8) NASL family PhotonOS Local Security Checks NASL id PHOTONOS_PHSA-2020-3_0-0073_PYTHON3.NASL description An update of the python3 package has been released. last seen 2020-04-14 modified 2020-04-12 plugin id 135405 published 2020-04-12 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/135405 title Photon OS 3.0: Python3 PHSA-2020-3.0-0073 NASL family Ubuntu Local Security Checks NASL id UBUNTU_USN-4333-2.NASL description USN-4333-1 fixed vulnerabilities in Python. This update provides the corresponding update for Ubuntu 20.04 LTS. Original advisory details : It was discovered that Python incorrectly stripped certain characters from requests. A remote attacker could use this issue to perform CRLF injection. (CVE-2019-18348) It was discovered that Python incorrectly handled certain HTTP requests. An attacker could possibly use this issue to cause a denial of service. (CVE-2020-8492). Note that Tenable Network Security has extracted the preceding description block directly from the Ubuntu security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues. last seen 2020-05-08 modified 2020-05-01 plugin id 136281 published 2020-05-01 reporter Ubuntu Security Notice (C) 2020 Canonical, Inc. / NASL script (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/136281 title Ubuntu 20.04 : python3.8 vulnerabilities (USN-4333-2) NASL family Fedora Local Security Checks NASL id FEDORA_2019-57462FA10D.NASL description Python 3.5 has now entered last seen 2020-06-01 modified 2020-06-02 plugin id 130784 published 2019-11-12 reporter This script is Copyright (C) 2019 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/130784 title Fedora 31 : python35 (2019-57462fa10d) NASL family Ubuntu Local Security Checks NASL id UBUNTU_USN-4333-1.NASL description It was discovered that Python incorrectly stripped certain characters from requests. A remote attacker could use this issue to perform CRLF injection. (CVE-2019-18348) It was discovered that Python incorrectly handled certain HTTP requests. An attacker could possibly use this issue to cause a denial of service. (CVE-2020-8492). Note that Tenable Network Security has extracted the preceding description block directly from the Ubuntu security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues. last seen 2020-04-30 modified 2020-04-22 plugin id 135894 published 2020-04-22 reporter Ubuntu Security Notice (C) 2020 Canonical, Inc. / NASL script (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/135894 title Ubuntu 16.04 LTS / 18.04 LTS / 19.10 : python2.7, python3.4, python3.5, python3.6, python3.7 vulnerabilities (USN-4333-1) NASL family PhotonOS Local Security Checks NASL id PHOTONOS_PHSA-2020-3_0-0073_PYTHON2.NASL description An update of the python2 package has been released. last seen 2020-04-14 modified 2020-04-12 plugin id 135404 published 2020-04-12 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/135404 title Photon OS 3.0: Python2 PHSA-2020-3.0-0073 NASL family PhotonOS Local Security Checks NASL id PHOTONOS_PHSA-2020-2_0-0223_PYTHON3.NASL description An update of the python3 package has been released. last seen 2020-04-14 modified 2020-04-10 plugin id 135309 published 2020-04-10 reporter This script is Copyright (C) 2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/135309 title Photon OS 2.0: Python3 PHSA-2020-2.0-0223
References
- https://bugs.python.org/issue30458#msg347282
- https://bugzilla.redhat.com/show_bug.cgi?id=1727276
- https://security.netapp.com/advisory/ntap-20191107-0004/
- https://usn.ubuntu.com/4333-1/
- https://usn.ubuntu.com/4333-2/
- http://lists.opensuse.org/opensuse-security-announce/2020-05/msg00041.html
- https://lists.debian.org/debian-lts-announce/2020/07/msg00011.html
- https://www.oracle.com/security-alerts/cpuoct2020.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/M34WOYCDKTDE5KLUACE2YIEH7D37KHRX/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/JCPGLTTOBB3QEARDX4JOYURP6ELNNA2V/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/4X3HW5JRZ7GCPSR7UHJOLD7AWLTQCDVR/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UESGYI5XDAHJBATEZN3MHNDUBDH47AS6/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/A5NSAX4SC3V64PGZUPH7PRDLSON34Q5A/