CVE-2021-38185 json
GNU cpio through 2.13 allows attackers to execute arbitrary code via a crafted pattern file, because of a dstring.c ds_fgetstr integer over…
published 2021-08-07 5 y ago modified 2026-06-17 4 mo ago also EUVD-2021-24655
- cvss
- 7.8
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 4.2%
- EPSS 4.2% chance of exploitation in 30 days, percentile 90%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- cpio Debian 14, Debian 13, Debian 12 2.13+dfsg-5
debian advisories DEBIAN-CVE-2021-38185
- cpio Ubuntu 18.04 LTS 2.12+dfsg-6ubuntu0.18.04.4
- cpio Ubuntu 20.04 LTS 2.13+dfsg-2ubuntu0.3
- cpio Ubuntu 22.04 LTS 2.13+dfsg-4ubuntu4
- cpio Ubuntu Pro 14.04 LTS 2.11+dfsg-1ubuntu1.2+esm2
- cpio Ubuntu Pro 16.04 LTS 2.11+dfsg-5ubuntu1.1+esm1
ubuntu advisories UBUNTU-CVE-2021-38185
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- cpio RHEL 8 2.12-11.el8
red hat advisories RHSA-2022:1991
- cpio SLES for SAP 12 SP5, SLES for SAP 12 SP4, SLES for SAP 12 SP3 +10 more 2.11-36.15.1
- cpio SLES 11 SP4-LTSS, SLE Point of Sale 11 SP3 2.9-75.81.14.1
- cpio SLES for SAP 15 SP1, SLES for SAP 15, SLES 15-LTSS +13 more 2.12-3.9.1
- cpio SLES for SAP 12 SP5, SLES for SAP 12 SP4, SLES for SAP 12 SP3 +10 more 2.11-36.12.1
- cpio SLES for SAP 12 SP5, SLES for SAP 12 SP4, SLES for SAP 12 SP3 +10 more 2.11-36.9.1
- cpio SLES 11 SP4-LTSS, SLE Point of Sale 11 SP3 2.9-75.81.8.1
suse advisories SUSE-SU-2021:2808-1SUSE-SU-2021:14788-1SUSE-RU-2021:2780-1SUSE-RU-2021:2779-1SUSE-SU-2021:2686-1SUSE-SU-2021:14777-1
- cpio openSUSE Tumbleweed 2.13-3.3
opensuse advisories openSUSE-SU-2024:10697-1
- cpio AlmaLinux 8 2.12-11.el8
almalinux advisories ALSA-2022:1991
- cpio Rocky Linux 8 2.12-11.el8
rocky linux advisories RLSA-2022:1991
- cpio Alpine 3.24, Alpine 3.23, Alpine 3.22 +8 more 2.13-r2
alpine advisories ALPINE-CVE-2021-38185
Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2021-38185 updated cvss 7.0
cpio: integer overflow in ds_fgetstr() in dstring.c can lead to an out-of-bounds write via a crafted pattern file
-
Red Hat Enterprise Linux 6 cpio Red Hat Enterprise Linux 7 cpioaffected: no fix planned “Out of support scope”
-
Red Hat Enterprise Linux BaseOS (v. 8) cpio 2.12-11.el8fixed: vendor fix RHSA-2022:1991
-
Red Hat Enterprise Linux 9 cpionot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
CISA SSVC
- Exploitation
- none
- Automatable
- no
- Technical impact
- total
- Assessed
- 17 mo ago
Exploit prediction
4.17% chance of exploitation in the next 30 days, higher than 90% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- github.com https://github.com/fangqyi/cpiopwn referenced PoC, tagged "exploit" by a source, unverified
- lists.gnu.org https://lists.gnu.org/archive/html/bug-cpio/2021-08/msg00000.html referenced PoC, tagged "exploit" by a source, unverified
- lists.gnu.org https://lists.gnu.org/archive/html/bug-cpio/2021-08/msg00002.html referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CISA ADP | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| NVD | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| CNA | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| NVD | 2.0 | 6.8 | AV:N/AC:M/Au:N/C:P/I:P/A:P |
Classification
- Weakness
-
- CWE-190 Integer Overflow or Wraparound
References
-
git.savannah.gnu.org
/cgit/cpio.git/commit/?id=dd96882877721703e19272fe25034560b794061b
patch, third-party-advisory
-
github.com
/fangqyi/cpiopwn
exploit, third-party-advisory
-
lists.gnu.org
/archive/html/bug-cpio/2021-08/msg00000.html
exploit, mailing-list, vendor-advisory
-
lists.gnu.org
/archive/html/bug-cpio/2021-08/msg00002.html
exploit, mailing-list, vendor-advisory
-
lists.debian.org
/debian-lts-announce/2023/06/msg00007.html
mailing-list
Sources
- CVE List CVE-2021-38185
- NVD CVE-2021-38185
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.