Headline
Trellix automates tackling open source vulnerabilities at scale
More than 61,000 vulnerabilities patched and counting
Charlie Osborne 26 January 2023 at 13:52 UTC
Updated: 26 January 2023 at 13:55 UTC
More than 61,000 vulnerabilities patched and counting
Trellix has patched over 61,000 open source projects against a severe Python bug with the help of an automated tool that dramatically accelerated the process.
Last year, the Trellix Advanced Research Center team stumbled upon a 15-year-old vulnerability embedded in Python’s tarfile module. Tracked as CVE-2007-4559, the vulnerability is described as a path traversal issue leading to “user-assisted remote attackers” being able to overwrite arbitrary files via “a … (dot dot) sequence in filenames in a TAR archive”.
BACKGROUND Tarfile path traversal bug from 2007 still present in 350k open source repos
According to Trellix researcher Douglas McKee, while the security flaw was reported back in 2017, it was “left unchecked” or unresolved. As a result, the vulnerability has been unwittingly included in approximately 350,000 open source projects – and is considered “prevalent” in many closed source projects.
However, as documented in a blog post dated January 23, Trellix has been working with GitHub to contain the flaw – a tall order when so many projects are vulnerable.
“The vulnerable tarfile module is included in the base Python package […] it is also, without a direct fix from Python, firmly embedded in the supply chain of many projects,” the cybersecurity company says.
Led by Kasimir Schulz and Charles McFarland, the months-long project centered on the automatic patching of open source repositories containing vulnerable code.
Bulk pull request tactic
The inspiration apparently came from Jonathan Leitschuh’s DEFCON 2022 presentation, which discussed using automated bulk pull request generation as a scalable methodology for fixing open source vulnerabilities.
Trellix and GitHub separated the process into two phases, both of which were automated and just required execution, with quality control – and acceptance – left up to project owners.
The first step was to develop the patch itself. Trellix obtained a list of repositories and files containing the keyword “import tarfile” and then cloned and scanned each repository using Creosote.
“If a repository was determined to contain the vulnerability, we patched the file and created a local patch diff containing the patched file so users can easily compare the two files, the original file, and some metadata about the repository,” McKee explained.
RELATED Patching common vulnerabilities at scale: project promises bulk pull requests
In the pull request phase, the cybersecurity team created repository forks, cloned them, and replaced the original file with the patched version if the original file had not changed. This check was implemented to ensure the patched replacement avoided ignoring or overwriting recent additions to the project’s code.
Lastly, the file was committed, a pull request was generated, and a message was sent explaining the fork and asking the owner to accept or reject the changes.
Scale up
Speaking to The Daily Swig, Kasimir Schulz, vulnerability researcher at Trellix’s Advanced Research Center, said Creosote and the patcher can together perform repository scans, detect the bug, and apply a patch in a matter of seconds – whereas even the most skilled developer would take minutes to do the same without the tool’s help.
“While this difference doesn’t matter much for a handful of repositories, it can be felt quickly as the scale increases,” Schulz noted.
Through GitHub, the Trellix team has patched 61,895 open-source projects to date.
Schulz said that recent discussions at ShmooCon have created “new momentum” for the vulnerability to be patched in Python itself, and there may even be “the possibility of a financial reward being offered in return for a fix”.
Schulz concluded: “Software and supply chains keep getting more complex. There are more people and companies building tons of different software. Because of this, trying to reduce the attack surface is a losing battle. Instead, we should focus on auditing our own supply chains through automated tooling, securing the attack surface rather than wasting time in a battle that can’t be won.”
YOU MAY ALSO LIKE Git security audit reveals critical overflow bugs
Related news
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 - 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 - An update for python3 is now available for Red Hat Enterprise Linux 8. Issues addressed include a traversal vulnerability.
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.
Two security holes — one particularly gnarly — could allow hackers the freedom to do as they wish with the popular edge equipment.
Warning added to Python documentation was deemed preferable to a patch
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,
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.
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.