Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2007-4559: [Python-Dev] tarfile and directory traversal vulnerability

Directory traversal vulnerability in the (1) extract and (2) extractall functions in the tarfile module in Python allows user-assisted remote attackers to overwrite arbitrary files via a … (dot dot) sequence in filenames in a TAR archive, a related issue to CVE-2001-1267.

CVE
#vulnerability#linux#auth

Jan Matejek jmatejek at suse.cz
Fri Aug 24 19:36:41 CEST 2007

  • Previous message: [Python-Dev] any problem with py’s RC?
  • Next message: [Python-Dev] tarfile and directory traversal vulnerability
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

hi, once upon a time there was a known vulnerability in tar (CVE-2001-1267, [1]), and while tar is now long fixed, python’s tarfile module is affected too.

The vulnerability goes basically like this: If you tar a file named “…/…/…/…/…/etc/passwd” and then make the admin untar it, /etc/passwd gets overwritten. Another variety of this bug is a symlink one: if tar contains files like: ./aaaa-directory -> /etc ./aaaa-directory/passwd then the “aaaa-directory” symlink would be created first and /etc/passwd will be overwritten once again.

I was wondering how to fix it. The symlink problem obviously applies only to extractall() method and is easily fixed by delaying external (or possibly all) symlink creation, similar to how directory attributes are delayed now. I’ve attached a draft of the patch, if you like it, i’ll polish it.

The traversal problem is harder, and it applies to extract() method as well. For extractall() alone, i would use something like:

if tarinfo.name.startswith(‘…/’): self.extract(tarinfo, path) else: warnings.warn(“non-local file skipped: %s” % tarinfo.name, RuntimeWarning, stacklevel=1)

For extract(), i am not sure. Maybe it should throw exception when it encounters such file, and have a special option to extract such files anyway. Or maybe it should be left alone altogether.

Any suggestions are welcome.

regards jan matejek

[1] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1267 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4-svn0 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFGzxcpjBrWA+AvBr8RAlduAKCk0iiSoBF+wA9xgXmDlpWsECZ7KgCfQORg lZ85inT1FGwhGqBfxJvCGGU= =TiWx -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed… Name: python-2.5.1-tarfile-traversal.patch Type: text/x-patch Size: 1127 bytes Desc: not available Url : http://mail.python.org/pipermail/python-dev/attachments/20070824/5605f4ef/attachment.bin

  • Previous message: [Python-Dev] any problem with py’s RC?
  • Next message: [Python-Dev] tarfile and directory traversal vulnerability
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the Python-Dev mailing list

Related news

Red Hat Security Advisory 2024-0374-03

Red Hat Security Advisory 2024-0374-03 - An update for python-pip is now available for Red Hat Enterprise Linux 8.6 Extended Update Support. Issues addressed include a traversal vulnerability.

Red Hat Security Advisory 2023-7176-01

Red Hat Security Advisory 2023-7176-01 - An update for python-pip is now available for Red Hat Enterprise Linux 8. Issues addressed include a traversal vulnerability.

Red Hat Security Advisory 2023-7151-01

Red Hat Security Advisory 2023-7151-01 - An update for python3 is now available for Red Hat Enterprise Linux 8. Issues addressed include a traversal vulnerability.

Gentoo Linux Security Advisory 202309-06

Gentoo Linux Security Advisory 202309-6 - Multiple vulnerabilities have been discovered in Samba, the worst of which could result in root remote code execution. Versions greater than or equal to 4.18.4 are affected.

Command-Injection Bug in Cisco Industrial Gear Opens Devices to Complete Takeover

Two security holes — one particularly gnarly — could allow hackers the freedom to do as they wish with the popular edge equipment.

15-Year-Old Unpatched Python Vulnerability Potentially Affects Over 350,000 Projects

As many as 350,000 open source projects are believed to be potentially vulnerable to exploitation as a result of a security flaw in a Python module that has remained unpatched for 15 years. The open source repositories span a number of industry verticals, such as software development, artificial intelligence/machine learning, web development, media, security, IT management. The shortcoming,

15-Year-Old Python Flaw Slithers into Software Worldwide

An unpatched flaw in more than 350,000 unique open source repositories leaves software applications vulnerable to exploit. The path traversal-related vulnerability is tracked as CVE-2007-4559.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907