diff options
author | Ned Deily <nad@python.org> | 2018-03-11 18:29:05 (GMT) |
---|---|---|
committer | larryhastings <larry@hastings.org> | 2018-03-11 18:29:05 (GMT) |
commit | 937ac1fe069a4dc8471dff205f553d82e724015b (patch) | |
tree | 64c5769356219b7be82419a1e7b7c5dccb636790 /Misc | |
parent | 6fb30f43147a6c5afeb92c04f359e66393006b2c (diff) | |
download | cpython-937ac1fe069a4dc8471dff205f553d82e724015b.zip cpython-937ac1fe069a4dc8471dff205f553d82e724015b.tar.gz cpython-937ac1fe069a4dc8471dff205f553d82e724015b.tar.bz2 |
[3.5] bpo-32981: Fix catastrophic backtracking vulns (GH-5955) (#6034)
* Prevent low-grade poplib REDOS (CVE-2018-1060)
The regex to test a mail server's timestamp is susceptible to
catastrophic backtracking on long evil responses from the server.
Happily, the maximum length of malicious inputs is 2K thanks
to a limit introduced in the fix for CVE-2013-1752.
A 2KB evil response from the mail server would result in small slowdowns
(milliseconds vs. microseconds) accumulated over many apop calls.
This is a potential DOS vector via accumulated slowdowns.
Replace it with a similar non-vulnerable regex.
The new regex is RFC compliant.
The old regex was non-compliant in edge cases.
* Prevent difflib REDOS (CVE-2018-1061)
The default regex for IS_LINE_JUNK is susceptible to
catastrophic backtracking.
This is a potential DOS vector.
Replace it with an equivalent non-vulnerable regex.
Also introduce unit and REDOS tests for difflib.
Co-authored-by: Tim Peters <tim.peters@gmail.com>
Co-authored-by: Christian Heimes <christian@python.org>.
(cherry picked from commit 0e6c8ee2358a2e23117501826c008842acb835ac)
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Security/2018-03-02-10-24-52.bpo-32981.O_qDyj.rst | 4 |
2 files changed, 5 insertions, 0 deletions
@@ -341,6 +341,7 @@ Kushal Das Jonathan Dasteel Pierre-Yves David A. Jesse Jiryu Davis +Jamie (James C.) Davis Merlijn van Deen John DeGood Ned Deily diff --git a/Misc/NEWS.d/next/Security/2018-03-02-10-24-52.bpo-32981.O_qDyj.rst b/Misc/NEWS.d/next/Security/2018-03-02-10-24-52.bpo-32981.O_qDyj.rst new file mode 100644 index 0000000..9ebabb4 --- /dev/null +++ b/Misc/NEWS.d/next/Security/2018-03-02-10-24-52.bpo-32981.O_qDyj.rst @@ -0,0 +1,4 @@ +Regexes in difflib and poplib were vulnerable to catastrophic backtracking. +These regexes formed potential DOS vectors (REDOS). They have been +refactored. This resolves CVE-2018-1060 and CVE-2018-1061. +Patch by Jamie Davis. |