Compare commits
20 Commits
c8
...
changed/a8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57b76f6e6f | ||
|
|
abc701df16 | ||
|
|
a71ef53091 | ||
|
|
570ec9d800 | ||
| bd6971bee7 | |||
| 8d3d925919 | |||
| bdbf48b9b5 | |||
| f3cf09f99c | |||
| 17a8498e33 | |||
| 9e83f4dfcf | |||
| bd2db93423 | |||
| c89b6ec208 | |||
|
|
18cf2f85c2 | ||
| 7b5facad40 | |||
|
|
5cfeb69b84 | ||
|
|
4d68a8f267 | ||
|
|
3b658081cd | ||
|
|
64c6635563 | ||
|
|
35ba6d59a5 | ||
| 3714d7eba9 |
@ -1,119 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Seth Michael Larson <seth@python.org>
|
|
||||||
Date: Fri, 31 Jan 2025 11:41:34 -0600
|
|
||||||
Subject: [PATCH] 00450: CVE-2025-0938: Disallow square brackets ([ and ]) in
|
|
||||||
domain names for parsed URLs
|
|
||||||
|
|
||||||
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
|
||||||
---
|
|
||||||
Lib/test/test_urlparse.py | 37 ++++++++++++++++++-
|
|
||||||
Lib/urllib/parse.py | 20 +++++++++-
|
|
||||||
...-01-28-14-08-03.gh-issue-105704.EnhHxu.rst | 4 ++
|
|
||||||
3 files changed, 58 insertions(+), 3 deletions(-)
|
|
||||||
create mode 100644 Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst
|
|
||||||
|
|
||||||
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
|
|
||||||
index 090d2f17bf..8b2f5ca50f 100644
|
|
||||||
--- a/Lib/test/test_urlparse.py
|
|
||||||
+++ b/Lib/test/test_urlparse.py
|
|
||||||
@@ -1087,16 +1087,51 @@ class UrlParseTestCase(unittest.TestCase):
|
|
||||||
self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@[0439:23af::2309::fae7:1234]/Path?Query')
|
|
||||||
self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@[0439:23af:2309::fae7:1234:2342:438e:192.0.2.146]/Path?Query')
|
|
||||||
self.assertRaises(ValueError, urllib.parse.urlsplit, 'Scheme://user@]v6a.ip[/Path')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]/')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix/')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip]?')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip].suffix?')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]/')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix/')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]?')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix?')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:a')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:a')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:a1')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:a1')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:1a')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:1a')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[::1].suffix:/')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[::1]:?')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://user@prefix.[v6a.ip]')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://user@[v6a.ip].suffix')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://[v6a.ip')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip]')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://]v6a.ip[')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://]v6a.ip')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip[')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix.[v6a.ip')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip].suffix')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix]v6a.ip[suffix')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://prefix]v6a.ip')
|
|
||||||
+ self.assertRaises(ValueError, urllib.parse.urlsplit, 'scheme://v6a.ip[suffix')
|
|
||||||
|
|
||||||
def test_splitting_bracketed_hosts(self):
|
|
||||||
- p1 = urllib.parse.urlsplit('scheme://user@[v6a.ip]/path?query')
|
|
||||||
+ p1 = urllib.parse.urlsplit('scheme://user@[v6a.ip]:1234/path?query')
|
|
||||||
self.assertEqual(p1.hostname, 'v6a.ip')
|
|
||||||
self.assertEqual(p1.username, 'user')
|
|
||||||
self.assertEqual(p1.path, '/path')
|
|
||||||
+ self.assertEqual(p1.port, 1234)
|
|
||||||
p2 = urllib.parse.urlsplit('scheme://user@[0439:23af:2309::fae7]/path?query')
|
|
||||||
self.assertEqual(p2.hostname, '0439:23af:2309::fae7')
|
|
||||||
self.assertEqual(p2.username, 'user')
|
|
||||||
self.assertEqual(p2.path, '/path')
|
|
||||||
+ self.assertIs(p2.port, None)
|
|
||||||
p3 = urllib.parse.urlsplit('scheme://user@[0439:23af:2309::fae7:1234:192.0.2.146]/path?query')
|
|
||||||
self.assertEqual(p3.hostname, '0439:23af:2309::fae7:1234:192.0.2.146')
|
|
||||||
self.assertEqual(p3.username, 'user')
|
|
||||||
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
|
|
||||||
index bf186b7984..af41edf2ca 100644
|
|
||||||
--- a/Lib/urllib/parse.py
|
|
||||||
+++ b/Lib/urllib/parse.py
|
|
||||||
@@ -426,6 +426,23 @@ def _remove_unsafe_bytes_from_url(url):
|
|
||||||
url = url.replace(b, "")
|
|
||||||
return url
|
|
||||||
|
|
||||||
+def _check_bracketed_netloc(netloc):
|
|
||||||
+ # Note that this function must mirror the splitting
|
|
||||||
+ # done in NetlocResultMixins._hostinfo().
|
|
||||||
+ hostname_and_port = netloc.rpartition('@')[2]
|
|
||||||
+ before_bracket, have_open_br, bracketed = hostname_and_port.partition('[')
|
|
||||||
+ if have_open_br:
|
|
||||||
+ # No data is allowed before a bracket.
|
|
||||||
+ if before_bracket:
|
|
||||||
+ raise ValueError("Invalid IPv6 URL")
|
|
||||||
+ hostname, _, port = bracketed.partition(']')
|
|
||||||
+ # No data is allowed after the bracket but before the port delimiter.
|
|
||||||
+ if port and not port.startswith(":"):
|
|
||||||
+ raise ValueError("Invalid IPv6 URL")
|
|
||||||
+ else:
|
|
||||||
+ hostname, _, port = hostname_and_port.partition(':')
|
|
||||||
+ _check_bracketed_host(hostname)
|
|
||||||
+
|
|
||||||
# Valid bracketed hosts are defined in
|
|
||||||
# https://www.rfc-editor.org/rfc/rfc3986#page-49 and https://url.spec.whatwg.org/
|
|
||||||
def _check_bracketed_host(hostname):
|
|
||||||
@@ -493,8 +510,7 @@ def urlsplit(url, scheme='', allow_fragments=True):
|
|
||||||
(']' in netloc and '[' not in netloc)):
|
|
||||||
raise ValueError("Invalid IPv6 URL")
|
|
||||||
if '[' in netloc and ']' in netloc:
|
|
||||||
- bracketed_host = netloc.partition('[')[2].partition(']')[0]
|
|
||||||
- _check_bracketed_host(bracketed_host)
|
|
||||||
+ _check_bracketed_netloc(netloc)
|
|
||||||
if allow_fragments and '#' in url:
|
|
||||||
url, fragment = url.split('#', 1)
|
|
||||||
if '?' in url:
|
|
||||||
diff --git a/Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst b/Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000..bff1bc6b0d
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/Misc/NEWS.d/next/Security/2025-01-28-14-08-03.gh-issue-105704.EnhHxu.rst
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+When using :func:`urllib.parse.urlsplit` and :func:`urllib.parse.urlparse` host
|
|
||||||
+parsing would not reject domain names containing square brackets (``[`` and
|
|
||||||
+``]``). Square brackets are only valid for IPv6 and IPvFuture hosts according to
|
|
||||||
+`RFC 3986 Section 3.2.2 <https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2>`__.
|
|
||||||
12
SOURCES/python-3.6-almalinux_support.patch
Normal file
12
SOURCES/python-3.6-almalinux_support.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -Naur Python-3.6.8.orig/Lib/platform.py Python-3.6.8.almalinux/Lib/platform.py
|
||||||
|
--- Python-3.6.8.orig/Lib/platform.py 2018-12-24 00:37:14.000000000 +0300
|
||||||
|
+++ Python-3.6.8.almalinux/Lib/platform.py 2021-03-09 11:46:50.252385459 +0300
|
||||||
|
@@ -297,7 +297,7 @@
|
||||||
|
# and http://www.die.net/doc/linux/man/man1/lsb_release.1.html
|
||||||
|
|
||||||
|
_supported_dists = (
|
||||||
|
- 'SuSE', 'debian', 'fedora', 'redhat', 'centos',
|
||||||
|
+ 'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'almalinux',
|
||||||
|
'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
|
||||||
|
'UnitedLinux', 'turbolinux', 'arch', 'mageia')
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ URL: https://www.python.org/
|
|||||||
# WARNING When rebasing to a new Python version,
|
# WARNING When rebasing to a new Python version,
|
||||||
# remember to update the python3-docs package as well
|
# remember to update the python3-docs package as well
|
||||||
Version: %{pybasever}.8
|
Version: %{pybasever}.8
|
||||||
Release: 74%{?dist}
|
Release: 73%{?dist}.alma.1
|
||||||
License: Python
|
License: Python
|
||||||
|
|
||||||
|
|
||||||
@ -918,10 +918,6 @@ Patch443: 00443-gh-124651-quote-template-strings-in-venv-activation-scripts.patc
|
|||||||
# Tests are adjusted because Python <3.9 don't support scoped IPv6 addresses.
|
# Tests are adjusted because Python <3.9 don't support scoped IPv6 addresses.
|
||||||
Patch444: 00444-security-fix-for-cve-2024-11168.patch
|
Patch444: 00444-security-fix-for-cve-2024-11168.patch
|
||||||
|
|
||||||
# 00450 # 31aa7c11975e890489e31d8b293c3f92d3ea1180
|
|
||||||
# CVE-2025-0938: Disallow square brackets ([ and ]) in domain names for parsed URLs
|
|
||||||
Patch450: 00450-cve-2025-0938-disallow-square-brackets-and-in-domain-names-for-parsed-urls.patch
|
|
||||||
|
|
||||||
# 00465 #
|
# 00465 #
|
||||||
# Security fixes for CVE-2025-4517, CVE-2025-4330, CVE-2025-4138, CVE-2024-12718, CVE-2025-4435 on tarfile
|
# Security fixes for CVE-2025-4517, CVE-2025-4330, CVE-2025-4138, CVE-2024-12718, CVE-2025-4435 on tarfile
|
||||||
#
|
#
|
||||||
@ -992,6 +988,9 @@ Patch475: 00475-cve-2025-15367.patch
|
|||||||
# (cherry-picked from commit 45b2f8893c1b7ab3b3981a966f82e42beea82106)
|
# (cherry-picked from commit 45b2f8893c1b7ab3b3981a966f82e42beea82106)
|
||||||
Patch476: 00476-cve-2026-1299.patch
|
Patch476: 00476-cve-2026-1299.patch
|
||||||
|
|
||||||
|
# AlmaLinux Patch
|
||||||
|
Patch1000: python-3.6-almalinux_support.patch
|
||||||
|
|
||||||
# (New patches go here ^^^)
|
# (New patches go here ^^^)
|
||||||
#
|
#
|
||||||
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
|
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
|
||||||
@ -1361,7 +1360,6 @@ GIT_DIR=$PWD git apply %{PATCH351}
|
|||||||
%patch437 -p1
|
%patch437 -p1
|
||||||
%patch443 -p1
|
%patch443 -p1
|
||||||
%patch444 -p1
|
%patch444 -p1
|
||||||
%patch450 -p1
|
|
||||||
%patch465 -p1
|
%patch465 -p1
|
||||||
%patch467 -p1
|
%patch467 -p1
|
||||||
%patch471 -p1
|
%patch471 -p1
|
||||||
@ -1370,6 +1368,9 @@ GIT_DIR=$PWD git apply %{PATCH351}
|
|||||||
%patch475 -p1
|
%patch475 -p1
|
||||||
%patch476 -p1
|
%patch476 -p1
|
||||||
|
|
||||||
|
# Applying AlmaLinux Patch
|
||||||
|
%patch1000 -p1 -b .python-36-almalinux_support
|
||||||
|
|
||||||
# Remove files that should be generated by the build
|
# Remove files that should be generated by the build
|
||||||
# (This is after patching, so that we can use patches directly from upstream)
|
# (This is after patching, so that we can use patches directly from upstream)
|
||||||
rm configure pyconfig.h.in
|
rm configure pyconfig.h.in
|
||||||
@ -2300,9 +2301,8 @@ fi
|
|||||||
# ======================================================
|
# ======================================================
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Mar 06 2026 Lumír Balhar <lbalhar@redhat.com> - 3.6.8-74
|
* Thu Feb 05 2026 Eduard Abdullin <eabdullin@almalinux.org> - 3.6.8-73.alma.1
|
||||||
- Security fix for CVE-2025-0938
|
- Add AlmaLinux to supported distros
|
||||||
Resolves: RHEL-153235
|
|
||||||
|
|
||||||
* Thu Jan 29 2026 Lumír Balhar <lbalhar@redhat.com> - 3.6.8-73
|
* Thu Jan 29 2026 Lumír Balhar <lbalhar@redhat.com> - 3.6.8-73
|
||||||
- Security fixes for CVE-2026-0865, CVE-2025-15366, CVE-2025-15367, CVE-2026-1299
|
- Security fixes for CVE-2026-0865, CVE-2025-15366, CVE-2025-15367, CVE-2026-1299
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user