public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/python3.9] rawhide: Fix CVE-2026-11940: symlink escape via tarfile hardlink fallback
Date: Mon, 26 Oct 2026 10:59:52 GMT	[thread overview]
Message-ID: <179301239247.1.5991122982955784036.rpms-python3.9-bf145556d855@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/python3.9
            Branch : rawhide
            Commit : bf145556d855a7ca81f99b5787c4f5b3dba80c3f
            Author : Miro Hrončok <miro@hroncok.cz>
            Date   : 2026-09-29T11:42:18+02:00
            Stats  : +71/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/python3.9/c/bf145556d855a7ca81f99b5787c4f5b3dba80c3f?branch=rawhide

            Log:
            Fix CVE-2026-11940: symlink escape via tarfile hardlink fallback

Security fix for CVE-2026-11940: Fix symlink escape via tarfile
hardlink-extraction fallback. The patch adds a filter check on the
hardlink target name before extraction to prevent symlink escapes.
The test decorator was adapted from upstream's @symlink_test to
@support.skip_unless_symlink for Python 3.9 compatibility.

CVE: CVE-2026-11940
Upstream patches:
 - https://github.com/python/cpython/commit/27dd970bf6b17ebca7c8ed486a40ab043ed7af8f

This commit was backported by Ymir, a Red Hat Enterprise Linux software maintenance AI agent.

Assisted-by: Ymir

(cherry picked from c9s commit 6c30a5bfd14b3fec9608272afc961cf9368c04ec)

---
diff --git a/00492-cve-2026-11940.patch b/00492-cve-2026-11940.patch
new file mode 100644
index 0000000..c6921fb
--- /dev/null
+++ b/00492-cve-2026-11940.patch
@@ -0,0 +1,61 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Stan Ulbrych <stan@python.org>
+Date: Tue, 23 Jun 2026 14:31:38 +0100
+Subject: 00492: gh-151558: Fix symlink escape via `tarfile`
+ hardlink-extraction fallback
+
+Security fix for CVE-2026-11940
+---
+ Lib/tarfile.py           |  3 +++
+ Lib/test/test_tarfile.py | 24 ++++++++++++++++++++++++
+ 2 files changed, 27 insertions(+)
+
+diff --git a/Lib/tarfile.py b/Lib/tarfile.py
+index 209c206231..760abb6bd2 100755
+--- a/Lib/tarfile.py
++++ b/Lib/tarfile.py
+@@ -2626,6 +2626,9 @@ class TarFile(object):
+                     "makelink_with_filter: if filter_function is not None, "
+                     + "extraction_root must also not be None")
+             try:
++                filter_function(
++                    unfiltered.replace(name=tarinfo.name, deep=False),
++                    extraction_root)
+                 filtered = filter_function(unfiltered, extraction_root)
+             except _FILTER_ERRORS as cause:
+                 raise LinkFallbackError(tarinfo, unfiltered.name) from cause
+diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
+index 17d2239339..2295a2c853 100644
+--- a/Lib/test/test_tarfile.py
++++ b/Lib/test/test_tarfile.py
+@@ -3850,6 +3850,30 @@ class TestExtractionFilters(unittest.TestCase):
+                     self.expect_file("boom", symlink_to='../../link_here')
+                     self.expect_file("c", symlink_to='b')
+ 
++    @support.skip_unless_symlink
++    def test_sneaky_hardlink_fallback_deep(self):
++        # (CVE-2026-11940)
++        with ArchiveMaker() as arc:
++            arc.add("a/b/s", symlink_to=os.path.join("..", "escape"))
++            arc.add("s", hardlink_to=os.path.join("a", "b", "s"))
++
++        with self.check_context(arc.open(), 'data'):
++            e = self.expect_exception(
++                tarfile.LinkFallbackError,
++                "link 's' would be extracted as a copy of "
++                + "'a/b/s', which was rejected")
++            self.assertIsInstance(e.__cause__,
++                                  tarfile.LinkOutsideDestinationError)
++
++        for filter in 'tar', 'fully_trusted':
++            with self.subTest(filter), self.check_context(arc.open(), filter):
++                if not support.can_symlink():
++                    self.expect_file("a/")
++                    self.expect_file("a/b/")
++                else:
++                    self.expect_file("a/b/s", symlink_to=os.path.join('..', 'escape'))
++                    self.expect_file("s", symlink_to=os.path.join('..', 'escape'))
++
+     def test_exfiltration_via_symlink(self):
+         # (CVE-2025-4138)
+         # Test changing symlinks that result in a symlink pointing outside

diff --git a/python3.9.spec b/python3.9.spec
index ad822db..0e1b841 100644
--- a/python3.9.spec
+++ b/python3.9.spec
@@ -26,7 +26,7 @@ URL: https://www.python.org/
 #global prerel ...
 %global upstream_version %{general_version}%{?prerel}
 Version: %{general_version}%{?prerel:~%{prerel}}
-Release: 14%{?dist}
+Release: 15%{?dist}
 # Python is Python-2.0.1
 # pip is MIT and bundles:
 #   CacheControl: Apache-2.0
@@ -593,6 +593,12 @@ Patch490: 00490-cve-2026-15308.patch
 # it's not supported.
 Patch491: 00491-gh-149776-skip-udp-lite-tests-if-it-s-not-supported.patch
 
+# 00492 # edbba0d88308d6364f7cd438100d6b76b7f8d922
+# gh-151558: Fix symlink escape via `tarfile` hardlink-extraction fallback
+#
+# Security fix for CVE-2026-11940
+Patch492: 00492-cve-2026-11940.patch
+
 # (New patches go here ^^^)
 #
 # When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@@ -2080,6 +2086,9 @@ CheckPython optimized
 # ======================================================
 
 %changelog
+* Wed Sep 23 2026 Miro Hrončok <mhroncok@redhat.com> - 3.9.25-15
+- Security fix for CVE-2026-11940
+
 * Wed Sep 23 2026 Lukáš Zachar <lzachar@redhat.com> - 3.9.25-14
 - Security fix for CVE-2026-15308
 Resolves: rhbz#2498693

                 reply	other threads:[~2026-10-26 10:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179301239247.1.5991122982955784036.rpms-python3.9-bf145556d855@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox