Bug 2234387 (CVE-2023-5189) - CVE-2023-5189 Ansible Automation Hub: insecure galaxy-importer tarfile extraction
Summary: CVE-2023-5189 Ansible Automation Hub: insecure galaxy-importer tarfile extrac...
Keywords:
Status: NEW
Alias: CVE-2023-5189
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 2234389 2260392
Blocks: 2234388
TreeView+ depends on / blocked
 
Reported: 2023-08-24 09:23 UTC by Mauro Matteo Cascella
Modified: 2024-01-25 21:01 UTC (History)
32 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
A path traversal vulnerability exists in Ansible when extracting tarballs. An attacker could craft a malicious tarball so that when using the galaxy importer of Ansible Automation Hub, a symlink could be dropped on the disk, resulting in files being overwritten.
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2023:7773 0 None None None 2023-12-13 08:32:23 UTC

Description Mauro Matteo Cascella 2023-08-24 09:23:04 UTC
A vulnerability was found in the galaxy importer of Ansible Automation Hub. The tarball extraction code is open to abuse in several ways (relative paths in the middle of a path, as well as symlinks that target arbitrary paths). If used to extract user-provided tarballs, this flaw could lead to arbitrary file overwrite.

Comment 2 Salvatore Bonaccorso 2023-11-05 19:51:19 UTC
Are there any details you can share about this issue? Is there an upstream report about it? Is an upstream fix known?

Comment 3 Mauro Matteo Cascella 2023-11-06 09:09:32 UTC
Redirecting NEEDINFO to Vipul who worked on this CVE and should be able to shed some light on it. As far as I know, the affected code can be found in _extract_archive() in galaxy-importer/collection.py. I do not know if there is a patch or any upstream discussions about it, though.

Comment 4 Vipul Nair 2023-11-14 17:00:58 UTC
The affected code can be found at https://github.com/ansible/galaxy-importer/blob/2c5c7c05fdfb0835878234b36de32902c703616d/galaxy_importer/collection.py#L160-L165

It does not protect against `..` in the middle of paths, nor does it protect against directory traversals in `linkname` only `name`.

Comment 5 Salvatore Bonaccorso 2023-11-20 06:24:45 UTC
Thanks

Comment 7 errata-xmlrpc 2023-12-13 08:32:21 UTC
This issue has been addressed in the following products:

  Red Hat Ansible Automation Platform 2.4 for RHEL 8
  Red Hat Ansible Automation Platform 2.4 for RHEL 9

Via RHSA-2023:7773 https://access.redhat.com/errata/RHSA-2023:7773


Note You need to log in before you can comment on or make changes to this bug.