| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
reject control chars in http method in http.client.putrequest to prevent http header injection
(cherry picked from commit 8ca8a2e8fb068863c1138f07e3098478ef8be12e)
Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
[rebased for py2.7]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The AbstractBasicAuthHandler class of the urllib.request module uses
an inefficient regular expression which can be exploited by an
attacker to cause a denial of service. Fix the regex to prevent the
catastrophic backtracking. Vulnerability reported by Ben Caller
and Matt Schwager.
AbstractBasicAuthHandler of urllib.request now parses all
WWW-Authenticate HTTP headers and accepts multiple challenges per
header: use the realm of the first Basic challenge.
Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
(cherry picked from commit 0b297d4ff1c0e4480ad33acae793fbaf4bf015b4)
[rebased for py2.7]
|
|
|
|
|
|
|
| |
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
[stripped test to avoid binary patch]
|
|
|
|
|
|
| |
Resolves test errors when running in the Gentoo sandbox environment.
Bug: https://bugs.gentoo.org/679628
|
| |
|
|
|
|
| |
https://bugs.python.org/issue25397
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
https://bugs.gentoo.org/show_bug.cgi?id=266703
https://bugs.python.org/issue1762561
|
| |
|
|
|
|
| |
https://bugs.python.org/issue1222585
|
|
|
|
| |
https://bugs.python.org/issue12619
|
|
|
|
|
| |
https://bugs.gentoo.org/show_bug.cgi?id=335505
https://bugs.python.org/issue10268
|
|
|
|
|
| |
https://bugs.gentoo.org/show_bug.cgi?id=281968
https://bugs.python.org/issue6731
|
| |
|
| |
|
|
|
|
|
| |
https://bugs.gentoo.org/show_bug.cgi?id=252372
https://bugs.python.org/issue6103
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
(GH-19251)
(cherry picked from commit cd16661f903153ecac55f190ed682e576c5deb24)
|
|
|
|
|
|
|
|
|
| |
http.client. (GH-19052)
Add host validation for control characters for more
CVE-2019-18348 protection.
(cherry picked from commit 83fc70159b24)
Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit f4800b8ed3dbe15a0078869a836d968ab3362b8c)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
|
|
|
|
|
|
|
| |
(#17774)
desired behavior under windows platform.
Suggestion by David Bolen
|
|
|
|
|
| |
(cherry picked from commit 32f1443aa98db769d87db497b45bd0dcb732445b)
Co-authored-by: Ned Deily <nad@python.org>
|
|
|
|
|
| |
(cherry picked from commit 946b29ea0b3b386ed05e87e60b8617c9dc19cd53)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
|
|
|
|
|
|
|
|
| |
transfer (#1040)
* bpo-27973: Fix urllib.urlretrieve failing on subsequent ftp transfers from the same host.
* bpo-35411: Skip test_urllibnet FTP tests on Travis CI.
|
|
|
|
|
|
| |
(cherry picked from commit 5c7ed7550ec2da16d7679e538fcd7c1a5631811f)
Co-authored-by: William Ayd <william.ayd@icloud.com>
|
|
|
|
|
|
|
| |
Catalina (GH-17636)
(cherry picked from commit bf3aa1060a29a05813abbe877193af16e3e7131e)
Co-authored-by: Ned Deily <nad@python.org>
|
|
|
| |
In all these cases, we know the exact length we want copied, so memcpy is the right function to use.
|
| |
|
|
|
|
|
|
|
| |
output format (GH-17418). (#17452)
(cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a)
Co-authored-by: Matthew Rollings <1211162+stealthcopter@users.noreply.github.com>
|
|
|
|
|
| |
(cherry picked from commit fdafa1d0ed0a8930b52ee81e57c931cc4d5c2388)
Co-authored-by: idomic <michael.ido@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The regex http.cookiejar.LOOSE_HTTP_DATE_RE was vulnerable to regular
expression denial of service (REDoS).
LOOSE_HTTP_DATE_RE.match is called when using http.cookiejar.CookieJar
to parse Set-Cookie headers returned by a server.
Processing a response from a malicious HTTP server can lead to extreme
CPU usage and execution will be blocked for a long time.
The regex contained multiple overlapping \s* capture groups.
Ignoring the ?-optional capture groups the regex could be simplified to
\d+-\w+-\d+(\s*\s*\s*)$
Therefore, a long sequence of spaces can trigger bad performance.
Matching a malicious string such as
LOOSE_HTTP_DATE_RE.match("1-c-1" + (" " * 2000) + "!")
caused catastrophic backtracking.
The fix removes ambiguity about which \s* should match a particular
space.
You can create a malicious server which responds with Set-Cookie headers
to attack all python programs which access it e.g.
from http.server import BaseHTTPRequestHandler, HTTPServer
def make_set_cookie_value(n_spaces):
spaces = " " * n_spaces
expiry = f"1-c-1{spaces}!"
return f"b;Expires={expiry}"
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
self.log_request(204)
self.send_response_only(204) # Don't bother sending Server and Date
n_spaces = (
int(self.path[1:]) # Can GET e.g. /100 to test shorter sequences
if len(self.path) > 1 else
65506 # Max header line length 65536
)
value = make_set_cookie_value(n_spaces)
for i in range(99): # Not necessary, but we can have up to 100 header lines
self.send_header("Set-Cookie", value)
self.end_headers()
if __name__ == "__main__":
HTTPServer(("", 44020), Handler).serve_forever()
This server returns 99 Set-Cookie headers. Each has 65506 spaces.
Extracting the cookies will pretty much never complete.
Vulnerable client using the example at the bottom of
https://docs.python.org/3/library/http.cookiejar.html :
import http.cookiejar, urllib.request
cj = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
r = opener.open("http://localhost:44020/")
The popular requests library was also vulnerable without any additional
options (as it uses http.cookiejar by default):
import requests
requests.get("http://localhost:44020/")
* Regression test for http.cookiejar REDoS
If we regress, this test will take a very long time.
* Improve performance of http.cookiejar.ISO_DATE_RE
A string like
"444444" + (" " * 2000) + "A"
could cause poor performance due to the 2 overlapping \s* groups,
although this is not as serious as the REDoS in LOOSE_HTTP_DATE_RE was.
(cherry picked from commit 1b779bfb8593739b11cbb988ef82a883ec9d077e)
|
|
|
|
| |
(GH-17081)
|
| |
|
|
|
|
| |
(GH-17077)
|
|
|
|
|
|
|
| |
_POSIX_C_SOURCE (GH-16733)
(cherry picked from commit 8177404d520e81f16324a900f093adf3856d33f8)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit d898d20e8c228229eb68e545f544db13f246f216)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
|
| |
decorators. (GH-16861). (GH-16931)
(cherry picked from commit 26ae9f6d3d755734c9f371b9356325afe5764813)
|
|
|
|
|
| |
(cherry picked from commit 01659ca62c4508518478a74615ac91c0009427ad)
Co-authored-by: Ned Deily <nad@python.org>
|
|
|
| |
AddRefActCtx() does not return a value.
|
|
|
|
|
| |
(cherry picked from commit dfe726b1ace03f206f45253b93ed7610473ae20f)
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
|
|
|
|
|
|
| |
(GH-16869). (GH-16877)
(cherry picked from commit 5bc6a7c06eda20ba131ecba6752be0506d310181)
|