Every CVE Search/ Get API key

CVE-2021-38185

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file,...

7.8 HighPublic exploitFix available

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Attack profile

How easy it is to exploit

Attack vector
Local
Complexity
Low
Privileges needed
None
User interaction
Required

What an attacker can affect

Confidentiality
High
Integrity
High
Availability
High

Exploit likelihood

4.17%Down 3.5 points since Aug 8, 2021
90%50%10%1%

What each source reports

NVD Score used 7.8

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
CVE-2021-38185
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CVSS 2.0
6.8 MediumAV:N/AC:M/Au:N/C:P/I:P/A:P
Weakness
CWE-190
Updated
2026-11-02
CVE List 7.8

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
CVE-2021-38185
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness
CWE-190
Updated
2026-11-02
EUVDEUVD-2021-24655 7.8

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
EUVD-2021-24655
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-pp74-ghrg-jwfh 7.8

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file,...

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
GHSA-pp74-ghrg-jwfh
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness
CWE-190
Updated
2026-11-02
OSVALPINE-CVE-2021-38185 7.8

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
ALPINE-CVE-2021-38185
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-03
OSVAZL-6357 7.8

CVE-2021-38185 affecting package cpio for versions less than 2.13-4

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
AZL-6357
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
Show 20 moreShow less
OSVBELL-CVE-2021-38185 7.8

CVE-2021-38185 does not affect BellSoft software

Record
BELL-CVE-2021-38185
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSV 7.8

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
CVE-2021-38185
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVDEBIAN-CVE-2021-38185 7.8

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
DEBIAN-CVE-2021-38185
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVOESA-2021-1325 7.8

cpio security update

GNU cpio copies files into or out of a cpio or tar archive. The archive can be another file on the disk, a magnetic tape, or a pipe.

Security Fix(es):

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.(CVE-2021-38185)

Record
OESA-2021-1325
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVRHSA-2022:1991 7.0

Red Hat Security Advisory: cpio security update

Record
RHSA-2022:1991
CVSS 3.1
7.0 HighCVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVRLSA-2022:1991 7.0

Moderate: cpio security update

The cpio packages provide the GNU cpio utility for creating and extracting archives, or copying files from one place to another.

Security Fix(es):

  • cpio: integer overflow in ds_fgetstr() in dstring.c can lead to an out-of-bounds write via a crafted pattern file (CVE-2021-38185)

For more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section.

Additional Changes:

For detailed information on changes in this release, see the Rocky Linux 8.6 Release Notes linked from the References section.

Record
RLSA-2022:1991
CVSS 3.1
7.0 HighCVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVUBUNTU-CVE-2021-38185 7.8

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. NOTE: it is unclear whether there are common cases where the pattern file, associated with the -E option, is untrusted data.

Record
UBUNTU-CVE-2021-38185
CVSS 3.1
7.8 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Updated
2026-11-02
OSVALSA-2022:1991 No score

Moderate: cpio security update

The cpio packages provide the GNU cpio utility for creating and extracting archives, or copying files from one place to another.

Security Fix(es):

  • cpio: integer overflow in ds_fgetstr() in dstring.c can lead to an out-of-bounds write via a crafted pattern file (CVE-2021-38185)

For more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section.

Additional Changes:

For detailed information on changes in this release, see the AlmaLinux Release Notes linked from the References section.

Record
ALSA-2022:1991
Updated
2026-11-02
OSVMGASA-2021-0423 No score

Updated cpio packages fix security vulnerability

GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer overflow that triggers an out-of-bounds heap write. (CVE-2021-38185).

Record
MGASA-2021-0423
Updated
2026-11-02
OSVopenSUSE-SU-2024:10697-1 No score

cpio-2.13-3.3 on GA media

These are all security issues fixed in the cpio-2.13-3.3 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2024:10697-1
Updated
2026-11-02
OSVSUSE-RU-2021:2779-1 No score

Recommended update for cpio

This update for cpio fixes the following issues:

  • A regression in the previous update could lead to crashes (bsc#1189465)
Record
SUSE-RU-2021:2779-1
Updated
2026-11-02
OSVSUSE-RU-2021:2780-1 No score

Recommended update for cpio

This update for cpio fixes the following issues:

  • A regression in the previous update could lead to crashes (bsc#1189465)
Record
SUSE-RU-2021:2780-1
Updated
2026-11-02
OSVSUSE-SU-2021:14777-1 No score

Security update for cpio

This update for cpio fixes the following issues:

It was possible to trigger Remote code execution due to a integer overflow (CVE-2021-38185, bsc#1189206)

Record
SUSE-SU-2021:14777-1
Updated
2026-11-02
OSVSUSE-SU-2021:14788-1 No score

Security update for cpio

This update for cpio fixes the following issues:

  • A patch previously applied to remedy CVE-2021-38185 introduced a regression that had the potential to cause a segmentation fault in cpio. [bsc#1189465]
Record
SUSE-SU-2021:14788-1
Updated
2026-11-02
OSVSUSE-SU-2021:2686-1 No score

Security update for cpio

This update for cpio fixes the following issues:

It was possible to trigger Remote code execution due to a integer overflow (CVE-2021-38185, bsc#1189206)

Record
SUSE-SU-2021:2686-1
Updated
2026-11-02
OSVSUSE-SU-2021:2689-1 No score

Security update for cpio

This update for cpio fixes the following issues:

It was possible to trigger Remote code execution due to a integer overflow (CVE-2021-38185, bsc#1189206)

Record
SUSE-SU-2021:2689-1
Updated
2026-11-02
OSVSUSE-SU-2021:2808-1 No score

Security update for cpio

This update for cpio fixes the following issues:

  • A patch previously applied to remedy CVE-2021-38185 introduced a regression that had the potential to cause a segmentation fault in cpio. [bsc#1189465]
Record
SUSE-SU-2021:2808-1
Updated
2026-11-02
OSVUSN-5064-1 No score

cpio vulnerability

Maverick Chung and Qiaoyi Fang discovered that cpio incorrectly handled certain pattern files. A remote attacker could use this issue to cause cpio to crash, resulting in a denial of service, or possibly execute arbitrary code.

Record
USN-5064-1
Updated
2026-11-02
OSVUSN-5064-2 No score

cpio vulnerability

USN-5064-1 fixed vulnerabilities in GNU cpio. This update provides the corresponding updates for Ubuntu 16.04 ESM.

Original advisory details:

Maverick Chung and Qiaoyi Fang discovered that cpio incorrectly handled certain pattern files. A remote attacker could use this issue to cause cpio to crash, resulting in a denial of service, or possibly execute arbitrary code.

Record
USN-5064-2
Updated
2026-11-02
OSVUSN-5064-3 No score

cpio vulnerability

USN-5064-1 fixed a vulnerability in GNU. This update provides the corresponding update for Ubuntu 14.04 LTS.

Original advisory details:

Maverick Chung and Qiaoyi Fang discovered that cpio incorrectly handled certain pattern files. A remote attacker could use this issue to cause cpio to crash, resulting in a denial of service, or possibly execute arbitrary code.

Record
USN-5064-3
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
cpio
Alpine:v3.14
before 2.13-r2
2.13-r2
cpio
Alpine:v3.15
before 2.13-r2
2.13-r2
cpio
Alpine:v3.16
before 2.13-r2
2.13-r2
cpio
Alpine:v3.17
before 2.13-r2
2.13-r2
cpio
Alpine:v3.18
before 2.13-r2
2.13-r2
cpio
Alpine:v3.19
before 2.13-r2
2.13-r2
cpio
Alpine:v3.20
before 2.13-r2
2.13-r2
cpio
Alpine:v3.21
before 2.13-r2
2.13-r2
cpio
Alpine:v3.22
before 2.13-r2
2.13-r2
cpio
Alpine:v3.23
before 2.13-r2
2.13-r2
Show 79 moreShow less
Affected packages
PackageAffectedFixed
cpio
Alpine:v3.24
before 2.13-r2
2.13-r2
cpio
AlmaLinux:8
before 2.12-11.el8
2.12-11.el8
cpio
Azure Linux:2
before 2.13-4
2.13-4
cpio
Debian:12
before 2.13+dfsg-5
2.13+dfsg-5
cpio
Debian:13
before 2.13+dfsg-5
2.13+dfsg-5
cpio
Debian:14
before 2.13+dfsg-5
2.13+dfsg-5
cpio
Debian:10
before 2.12+dfsg-9+deb10u1, plus listed versions
2.12+dfsg-9
2.12+dfsg-9+deb10u1
cpio
Mageia:8
before 2.13-5.1.mga8
2.13-5.1.mga8
cpio
openEuler:20.03-LTS-SP1
before 2.13-4.oe1
2.13-4.oe1
cpio
openEuler:20.03-LTS-SP2
before 2.13-4.oe1
2.13-4.oe1
cpio
Red Hat:enterprise_linux:8::baseos
before 0:2.12-11.el8
0:2.12-11.el8
cpio-debuginfo
Red Hat:enterprise_linux:8::baseos
before 0:2.12-11.el8
0:2.12-11.el8
cpio-debugsource
Red Hat:enterprise_linux:8::baseos
before 0:2.12-11.el8
0:2.12-11.el8
cpio
Rocky Linux:8
before 0:2.12-11.el8
0:2.12-11.el8
cpio
SUSE:HPE Helion OpenStack 8
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:OpenStack Cloud 8
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:OpenStack Cloud 9
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:OpenStack Cloud Crowbar 8
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:OpenStack Cloud Crowbar 9
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP3
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP4
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Server 12 SP2-BCL
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Server 12 SP3-LTSS
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Server 12 SP3-BCL
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Server 12 SP4-LTSS
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Server 12 SP5
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP5
before 2.11-36.12.1
2.11-36.12.1
cpio
SUSE:Linux Enterprise Module for Basesystem 15 SP2
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise Module for Basesystem 15 SP3
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise High Performance Computing 15-ESPOS
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise High Performance Computing 15-LTSS
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise High Performance Computing 15 SP1-ESPOS
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise Server 15-LTSS
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise Server 15 SP1-BCL
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise Server 15 SP1-LTSS
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 15
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 15 SP1
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Manager Proxy 4.0
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Manager Retail Branch Server 4.0
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Manager Server 4.0
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise Micro 5.0
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Enterprise Storage 6
before 2.12-3.9.1
2.12-3.9.1
cpio
SUSE:Linux Enterprise Point of Sale 11 SP3
before 2.9-75.81.8.1
2.9-75.81.8.1
cpio
SUSE:Linux Enterprise Server 11 SP4-LTSS
before 2.9-75.81.8.1
2.9-75.81.8.1
cpio
SUSE:Linux Enterprise Point of Sale 11 SP3
before 2.9-75.81.14.1
2.9-75.81.14.1
cpio
SUSE:Linux Enterprise Server 11 SP4-LTSS
before 2.9-75.81.14.1
2.9-75.81.14.1
cpio
SUSE:HPE Helion OpenStack 8
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:OpenStack Cloud 8
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:OpenStack Cloud 9
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:OpenStack Cloud Crowbar 8
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:OpenStack Cloud Crowbar 9
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP3
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP4
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:Linux Enterprise Server 12 SP2-BCL
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:Linux Enterprise Server 12 SP3-LTSS
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:Linux Enterprise Server 12 SP3-BCL
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:Linux Enterprise Server 12 SP4-LTSS
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:Linux Enterprise Server 12 SP5
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP5
before 2.11-36.9.1
2.11-36.9.1
cpio
SUSE:HPE Helion OpenStack 8
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:OpenStack Cloud 8
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:OpenStack Cloud 9
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:OpenStack Cloud Crowbar 8
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:OpenStack Cloud Crowbar 9
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP3
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP4
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:Linux Enterprise Server 12 SP2-BCL
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:Linux Enterprise Server 12 SP3-LTSS
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:Linux Enterprise Server 12 SP3-BCL
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:Linux Enterprise Server 12 SP4-LTSS
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:Linux Enterprise Server 12 SP5
before 2.11-36.15.1
2.11-36.15.1
cpio
SUSE:Linux Enterprise Server for SAP Applications 12 SP5
before 2.11-36.15.1
2.11-36.15.1
cpio
Ubuntu:Pro:14.04:LTS
before 2.11+dfsg-1ubuntu1.2+esm2, plus listed versions
2.11+dfsg-1ubuntu12.11+dfsg-1ubuntu1.12.11+dfsg-1ubuntu1.22.11+dfsg-1ubuntu1.2+esm1
2.11+dfsg-1ubuntu1.2+esm2
cpio
Ubuntu:Pro:16.04:LTS
before 2.11+dfsg-5ubuntu1.1+esm1, plus listed versions
2.11+dfsg-4.1ubuntu12.11+dfsg-5ubuntu12.11+dfsg-5ubuntu1.1
2.11+dfsg-5ubuntu1.1+esm1
cpio
Ubuntu:18.04:LTS
before 2.12+dfsg-6ubuntu0.18.04.4, plus listed versions
2.11+dfsg-62.12+dfsg-62.12+dfsg-6ubuntu0.18.04.1
2.12+dfsg-6ubuntu0.18.04.4
cpio
Ubuntu:20.04:LTS
before 2.13+dfsg-2ubuntu0.3, plus listed versions
2.12+dfsg-92.12+dfsg-9ubuntu12.13+dfsg-12.13+dfsg-2
2.13+dfsg-2ubuntu0.3
cpio
Ubuntu:22.04:LTS
before 2.13+dfsg-4ubuntu4
2.13+dfsg-4ubuntu4
cpio
openSUSE:Tumbleweed
before 2.13-3.3
2.13-3.3

Public exploits

Links only. Every CVE stores no exploit code.

Public exploits
SourceLinkDate
PoC in GitHubfangqyi/cpiopwn2021-07-19

History

History
RecordedChangedSources
affected, aliases, referencesOSV
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV, PoC in GitHub

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2021-38185 is a high vulnerability (CVSS 7.8) in Gnu Cpio, published August 7, 2021. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 4.17%, the 90th percentile. Fixed in cpio 2.13-r2.

References

Show 35 moreShow less
MoveEnter Open