#1143836 tar: CVE-2026-18477 CVE-2026-18508

Package:
src:tar
Source:
src:tar
Submitter:
Salvatore Bonaccorso
Date:
2026-11-03 05:19:02 UTC
Severity:
normal
Tags:
#1143836#5
Date:
2026-08-07 04:09:56 UTC
From:
To:
Hi,

The following vulnerabilities were published for tar.

At point of writing this bugreport only the Red Hat bugzilla entries
are avaiable, can you check upstream, is this reported, is it fixed
already?

CVE-2026-18508[0]:
| A flaw was found in GNU tar. When extracting an archive with the
| --one-top-level option, hardlink targets are not confined to the
| designated top-level directory and may resolve relative to the
| extraction working directory. A crafted archive can create hardlinks
| that escape the intended boundary and, when combined with a
| preexisting symbolic link under the working directory, may allow
| writing outside that boundary during a single extraction.


CVE-2026-18477[1]:
| A TOCTOU (Time-of-Check Time-of-Use) vulnerability in GNU tar's
| incremental dumpdir 'X' rename handling allows a local attacker with
| write access to a directory being backed up to influence the restore
| process if the attacker has access to the system where the restore
| is being performed. During restoration, files or directories may be
| created, renamed or overwritten outside the intended extraction
| directory. This could lead to unauthorized file modification or, in
| some cases, privilege escalation. Exploitation does not require the
| attacker to modify or craft the archive, and standard backup and
| restore workflows—including extracting into a newly created
| directory without using the -P option do not mitigate the issue.


If you fix the vulnerabilities please also make sure to include the
CVE (Common Vulnerabilities & Exposures) ids in your changelog entry.

For further information see:

[0] https://security-tracker.debian.org/tracker/CVE-2026-18508
https://www.cve.org/CVERecord?id=CVE-2026-18508
https://bugzilla.redhat.com/show_bug.cgi?id=2509843
[1] https://security-tracker.debian.org/tracker/CVE-2026-18477
https://www.cve.org/CVERecord?id=CVE-2026-18477
https://bugzilla.redhat.com/show_bug.cgi?id=2509735

Please adjust the affected versions in the BTS as needed.

Regards,
Salvatore

#1143836#10
Date:
2026-11-03 05:16:01 UTC
From:
To:
Hi,

Upstream has no commits or release mentioning these CVE IDs. However, Red
Hat shipped fixes for both on tar 1.35 (RHSA-2026:61586 for RHEL 10;
RHEL 8 and 9 too), and the CentOS Stream c10s tar.spec lists the upstream
commits behind each patch:

CVE-2026-18477 (incremental 'X' dumpdir entries):
tar-1.35-CVE-2026-18477.patch = upstream
0714d2f082 tar: strip '/' from incremental 'X' entries
d479b2cc91 Use mkdtempat instead of mkdtemp
b17665b2c0 Add tests for cyclic renames (rename08, rename09)

CVE-2026-18508 (--one-top-level and hard link targets):
The spec says this is fixed "by the way" by
tar-1.35-fix-absolute-one-top-level.patch, upstream
bfc3346394, b4fc9ca136, 67c8dff696, 55e8233438, 0470c109c0,
1b91f5f66f, 325b899214, 1980e032af, e335e2c8b1 and part of 941f62b2
That patch is layered on RHEL's tar-1.35-CVE-2025-45582.patch (the
openat2/fdbase extraction rework) and
tar-1.35-tar-one-top-level-DIR-must-be-relative.patch.

https://www.google.com/url?q=https://gitlab.com/redhat/centos-stream/rpms/tar/-/tree/c10s&source=gmail&ust=1793769361552000&sa=E

What I found trying these on Debian's tree (1.35+dfsg-6 with
debian/patches; -7 only adds a src/sparse.c change, so the same applies):

- The CVE-2026-18477 patch applies textually (only the NEWS hunk fails)
but does not build. src/incremen.c now calls fdbase() and checks BADFD,
both from the CVE-2025-45582 rework, which Debian doesn't carry and the
tracker marks as disputed. So either that infrastructure comes too, or
the mkdtempat() call needs adapting to 1.35's chdir_fd handling. I
haven't attempted that adaptation.
- The CVE-2026-18508 patch depends on the same rework and fails in
several src/extract.c hunks.

So neither is a drop-in backport. I'm sending this so whoever picks it up
has the upstream commit mapping and knows about the fdbase dependency.

(For CVE-2026-5704, #1132999: RHEL's tar-1.35-CVE-2026-5704.patch does
apply to Debian 1.35 apart from test registration. With it, upstream's
"skip file injection" (extrac32) and skipdir regression tests pass; they
fail on 1.35+dfsg-6. The full test suite gives 220 passed / 27 skipped,
against 217 / 27 unpatched. That may be useful to cross-check the debdiff
already on that bug.)

Thanks!