Discussion:
Bug#987890: unblock: python-babel/2.8.0+dfsg.1-7 CVE-2021-20095
(too old to reply)
Thomas Goirand
2021-05-01 15:30:01 UTC
Permalink
Package: release.debian.org
Severity: normal
User: ***@packages.debian.org
Usertags: unblock

Please unblock package python-babel

Version 2.8.0+dfsg.1-7 fixes CVE-2021-20095. See details:
https://bugs.debian.org/987824

Debdiff attached.

Please unblock python-babel/2.8.0+dfsg.1-7

Cheers,

Thomas Goirand (zigo)
Debian Bug Tracking System
2021-05-02 12:20:02 UTC
Permalink
tags -1 moreinfo confirmed
Bug #987890 [release.debian.org] unblock: python-babel/2.8.0+dfsg.1-7 CVE-2021-20095
Added tag(s) confirmed and moreinfo.
--
987890: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=987890
Debian Bug Tracking System
Contact ***@bugs.debian.org with problems
Sebastian Ramacher
2021-05-02 12:20:02 UTC
Permalink
Control: tags -1 moreinfo confirmed
Post by Thomas Goirand
Package: release.debian.org
Severity: normal
Usertags: unblock
Please unblock package python-babel
https://bugs.debian.org/987824
Debdiff attached.
Please unblock python-babel/2.8.0+dfsg.1-7
Please remove the moreinfo tag once the version is available in
unstable.

Cheers
Post by Thomas Goirand
Cheers,
Thomas Goirand (zigo)
diff -Nru python-babel-2.8.0+dfsg.1/debian/changelog python-babel-2.8.0+dfsg.1/debian/changelog
--- python-babel-2.8.0+dfsg.1/debian/changelog 2021-01-21 13:21:26.000000000 +0100
+++ python-babel-2.8.0+dfsg.1/debian/changelog 2021-05-01 17:13:14.000000000 +0200
@@ -1,3 +1,12 @@
+python-babel (2.8.0+dfsg.1-7) unstable; urgency=medium
+
+ * CVE-2021-20095: Relative Path Traversal in Babel 2.9.0 allows an attacker
+ to load arbitrary locale files on disk and execute arbitrary code. Applied
+ upstream patch: Run locale identifiers through `os.path.basename()`.
+ (Closes: #987824).
+
+
python-babel (2.8.0+dfsg.1-6) unstable; urgency=medium
* Fix doctest deprecation
diff -Nru python-babel-2.8.0+dfsg.1/debian/control python-babel-2.8.0+dfsg.1/debian/control
--- python-babel-2.8.0+dfsg.1/debian/control 2021-01-21 13:21:26.000000000 +0100
+++ python-babel-2.8.0+dfsg.1/debian/control 2021-05-01 17:13:14.000000000 +0200
@@ -5,7 +5,7 @@
debhelper-compat (= 13),
dh-python,
diff -Nru python-babel-2.8.0+dfsg.1/debian/patches/CVE-2021-20095_Run_locale_identifiers_through_os.path.basename.patch python-babel-2.8.0+dfsg.1/debian/patches/CVE-2021-20095_Run_locale_identifiers_through_os.path.basename.patch
--- python-babel-2.8.0+dfsg.1/debian/patches/CVE-2021-20095_Run_locale_identifiers_through_os.path.basename.patch 1970-01-01 01:00:00.000000000 +0100
+++ python-babel-2.8.0+dfsg.1/debian/patches/CVE-2021-20095_Run_locale_identifiers_through_os.path.basename.patch 2021-05-01 17:13:14.000000000 +0200
@@ -0,0 +1,76 @@
+Description: CVE-2021-20095: Run locale identifiers through `os.path.basename()`
+Date: Wed, 28 Apr 2021 10:33:40 +0300
+Bug-Debian: https://bugs.debian.org/987824
+Origin: https://github.com/python-babel/babel/commit/3a700b5b8b53606fd98ef8294a56f9510f7290f8.patch
+Last-Update: 2021-05-01
+
+diff --git a/babel/localedata.py b/babel/localedata.py
+index f4771d1f..11085490 100644
+--- a/babel/localedata.py
++++ b/babel/localedata.py
+ """
+ return False
++ name = os.path.basename(name)
+ return True
+ file_found = os.path.exists(os.path.join(_dirname, '%s.dat' % name))
+ :raise `IOError`: if no locale data file is found for the given locale
+ identifer, or one of the locales it inherits from
+ """
++ name = os.path.basename(name)
+ _cache_lock.acquire()
+ data = _cache.get(name)
+diff --git a/tests/test_localedata.py b/tests/test_localedata.py
+index 83cd6699..9cb4282e 100644
+--- a/tests/test_localedata.py
++++ b/tests/test_localedata.py
+ # individuals. For the exact contribution history, see the revision
+ # history and logs, available at http://babel.edgewall.org/log/.
+
++import os
++import pickle
++import sys
++import tempfile
+ import unittest
+ import random
+ from operator import methodcaller
+
+-from babel import localedata
++import pytest
++
++from babel import localedata, Locale, UnknownLocaleError
+
+
+ localedata.locale_identifiers.cache = None
+ assert localedata.locale_identifiers()
+ assert len(listdir_calls) == 2
++
++
++ """
++ Test that locale identifiers are cleaned up to avoid directory traversal.
++ """
++ no_exist_name = os.path.join(tempfile.gettempdir(), "babel%d.dat" % random.randint(1, 99999))
++ pickle.dump({}, f)
++
++ name = os.path.splitext(os.path.relpath(no_exist_name, localedata._dirname))[0]
++ pytest.skip("unable to form relpath")
++ raise
++
++ assert not localedata.exists(name)
++ localedata.load(name)
++ Locale(name)
diff -Nru python-babel-2.8.0+dfsg.1/debian/patches/series python-babel-2.8.0+dfsg.1/debian/patches/series
--- python-babel-2.8.0+dfsg.1/debian/patches/series 2021-01-21 13:21:26.000000000 +0100
+++ python-babel-2.8.0+dfsg.1/debian/patches/series 2021-05-01 17:13:14.000000000 +0200
@@ -4,3 +4,4 @@
0004-Fix-utils-test.patch
0005-fix-methods-changes-wrt-py3.9.patch
0006-remove-doctest-deprecation.patch
+CVE-2021-20095_Run_locale_identifiers_through_os.path.basename.patch
--
Sebastian Ramacher
Salvatore Bonaccorso
2021-05-09 08:10:01 UTC
Permalink
Hi Thomas,
Post by Sebastian Ramacher
Control: tags -1 moreinfo confirmed
Post by Thomas Goirand
Package: release.debian.org
Severity: normal
Usertags: unblock
Please unblock package python-babel
https://bugs.debian.org/987824
Debdiff attached.
Please unblock python-babel/2.8.0+dfsg.1-7
Please remove the moreinfo tag once the version is available in
unstable.
Did you saw this ack from Sebastian Ramacher?

Regards,
Salvatore
Thomas Goirand
2021-05-13 21:00:02 UTC
Permalink
Hi,

I mishandled the orig tarball, which is why my upload was rejected. Once
I understood, I got busy with other (personal) stuff. Sorry that it took
so long. Anyways, it should be good now, and hopefully, this last upload
will go through.

I removed the moreinfo tag...

Cheers,

Thomas Goirand (zigo)
Debian Bug Tracking System
2021-05-15 13:00:02 UTC
Permalink
Your message dated Sat, 15 May 2021 12:47:30 +0000
with message-id <E1lhtha-0005zy-***@respighi.debian.org>
and subject line unblock python-babel
has caused the Debian Bug report #987890,
regarding unblock: python-babel/2.8.0+dfsg.1-7 CVE-2021-20095
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ***@bugs.debian.org
immediately.)
--
987890: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=987890
Debian Bug Tracking System
Contact ***@bugs.debian.org with problems
Loading...