CVE-2023-7216: Cpio: extraction allows symlinks which enables remote command execution

Published Nov 15, 2023
·
Updated

A path traversal vulnerability was found in the CPIO utility. This issue could allow a remote unauthenticated attacker to trick a user into opening a specially crafted archive. During the extraction process, the archiver could follow symlinks outside of the intended directory, which allows files to be written in arbitrary directories through symlinks.

Other sources

Summary:

CPIO found to be vulnerable to Path Traversal vulnerability that can be leveraged to achieve full Remote Command Execution on the target.

Details:

While handling CPIO archives, the CPIO follows symlink, cpio by default will follow stored symlinks while extracting and the Archiver will not check the symlink location, which leads to arbitrary file writes to unintended locations. When the victim extracts the archive, the attacker can craft a malicious cpio archive to achieve RCE on the target system.

PoC ( Steps to reproduce ) : Complete instructions to craft a cpio archive to demonstrate the vulnerability.

mkdir testcpio ln -sf /tmp/ testcpio/tmp echo "TEST Traversal" > testcpio/tmpYtrav.txt cd testcpio/ ls | cpio -ov > ../trav.cpio cd ../ sed -i s/"tmpY"/"tmp\/"/g trav.cpio

Extract the malicious archive: cpio -i < trav.cpio

Impact: An attacker can craft malicious cpio archives that exploit the vulnerability to write files on locations such as ~/.ssh, ~/.bashrc, ~/.config/autostart/ etc., to achieve full remote command execution on the target/victim system. Software that uses CPIO as a component might be vulnerable.

Credit: Febin Mon Saji

Red Hat

Affected Software

4 affected components
GNU cpio
redhat Enterprise Linux=7.0
redhat Enterprise Linux=8.0
redhat Enterprise Linux=9.0

Event History

Nov 15, 2023
Data Sourced
via Red Hat·08:50 PM
DescriptionSeverityAffected Software
Feb 5, 2024
CVE Published
via MITRE·03:12 PM
Data Sourced
via MITRE·03:12 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:15 PM
DescriptionSeverityWeaknessAffected Software
Mar 25, 56186
Event
via MITRE·07:45 AM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2023-7216?

CVE-2023-7216 is classified as a medium severity vulnerability due to its potential for unauthorized access.

2

How do I fix CVE-2023-7216?

To fix CVE-2023-7216, update the GNU cpio package to the latest version available from your distribution.

3

What systems are affected by CVE-2023-7216?

CVE-2023-7216 affects GNU cpio and Red Hat Enterprise Linux versions 7.0, 8.0, and 9.0.

4

Can CVE-2023-7216 be exploited remotely?

Yes, CVE-2023-7216 can be exploited by a remote unauthenticated attacker if users open affected archives.

5

What type of vulnerability is CVE-2023-7216?

CVE-2023-7216 is a path traversal vulnerability that allows symlink access outside intended directories.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203