# CVE-2024-53171: ubifs: authentication: Fix use-after-free in ubifs\_tnc\_end\_commit

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.34% (percentile 20, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2024-12-27T13:49:16.423Z
- **Modified:** 2026-08-05T11:44:19.813Z

## Who should check

- Anyone running Linux \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< daac4aa1825de0dbc1a6eede2fa7f9fc53f14223; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 8d8b3f5f4cbfbf6cb0ea4a4d5dc296872b4151eb; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 4d9807048b851d7a58d5bd089c16254af896e4df; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 74981f7577d183acad1cd58f74c10d263711a215; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 01d3a2293d7e4edfff96618c15727db7e51f11b6; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 398a91599d263e41c5f95a2fd4ebdb6280b5c6c3; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 2497479aecebe869d23a0064e0fd1a03e34f0e2a; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 4617fb8fc15effe8eda4dd898d4e33eb537a7140
- Anyone running Linux 4.20

## Description

In the Linux kernel, the following vulnerability has been resolved:

ubifs: authentication: Fix use-after-free in ubifs\_tnc\_end\_commit

After an insertion in TNC, the tree might split and cause a node to
change its \`znode-\>parent\`. A further deletion of other nodes in the
tree (which also could free the nodes), the aforementioned node's
\`znode-\>cparent\` could still point to a freed node. This
\`znode-\>cparent\` may not be updated when getting nodes to commit in
\`ubifs\_tnc\_start\_commit()\`. This could then trigger a use-after-free
when accessing the \`znode-\>cparent\` in \`write\_index()\` in
\`ubifs\_tnc\_end\_commit()\`.

This can be triggered by running

  rm -f /etc/test-file.bin
  dd if=/dev/urandom of=/etc/test-file.bin bs=1M count=60 conv=fsync

in a loop, and with \`CONFIG\_UBIFS\_FS\_AUTHENTICATION\`. KASAN then
reports:

  BUG: KASAN: use-after-free in ubifs\_tnc\_end\_commit+0xa5c/0x1950
  Write of size 32 at addr ffffff800a3af86c by task ubifs\_bgt0\_20/153

  Call trace:
   dump\_backtrace+0x0/0x340
   show\_stack+0x18/0x24
   dump\_stack\_lvl+0x9c/0xbc
   print\_address\_description.constprop.0+0x74/0x2b0
   kasan\_report+0x1d8/0x1f0
   kasan\_check\_range+0xf8/0x1a0
   memcpy+0x84/0xf4
   ubifs\_tnc\_end\_commit+0xa5c/0x1950
   do\_commit+0x4e0/0x1340
   ubifs\_bg\_thread+0x234/0x2e0
   kthread+0x36c/0x410
   ret\_from\_fork+0x10/0x20

  Allocated by task 401:
   kasan\_save\_stack+0x38/0x70
   \_\_kasan\_kmalloc+0x8c/0xd0
   \_\_kmalloc+0x34c/0x5bc
   tnc\_insert+0x140/0x16a4
   ubifs\_tnc\_add+0x370/0x52c
   ubifs\_jnl\_write\_data+0x5d8/0x870
   do\_writepage+0x36c/0x510
   ubifs\_writepage+0x190/0x4dc
   \_\_writepage+0x58/0x154
   write\_cache\_pages+0x394/0x830
   do\_writepages+0x1f0/0x5b0
   filemap\_fdatawrite\_wbc+0x170/0x25c
   file\_write\_and\_wait\_range+0x140/0x190
   ubifs\_fsync+0xe8/0x290
   vfs\_fsync\_range+0xc0/0x1e4
   do\_fsync+0x40/0x90
   \_\_arm64\_sys\_fsync+0x34/0x50
   invoke\_syscall.constprop.0+0xa8/0x260
   do\_el0\_svc+0xc8/0x1f0
   el0\_svc+0x34/0x70
   el0t\_64\_sync\_handler+0x108/0x114
   el0t\_64\_sync+0x1a4/0x1a8

  Freed by task 403:
   kasan\_save\_stack+0x38/0x70
   kasan\_set\_track+0x28/0x40
   kasan\_set\_free\_info+0x28/0x4c
   \_\_kasan\_slab\_free+0xd4/0x13c
   kfree+0xc4/0x3a0
   tnc\_delete+0x3f4/0xe40
   ubifs\_tnc\_remove\_range+0x368/0x73c
   ubifs\_tnc\_remove\_ino+0x29c/0x2e0
   ubifs\_jnl\_delete\_inode+0x150/0x260
   ubifs\_evict\_inode+0x1d4/0x2e4
   evict+0x1c8/0x450
   iput+0x2a0/0x3c4
   do\_unlinkat+0x2cc/0x490
   \_\_arm64\_sys\_unlinkat+0x90/0x100
   invoke\_syscall.constprop.0+0xa8/0x260
   do\_el0\_svc+0xc8/0x1f0
   el0\_svc+0x34/0x70
   el0t\_64\_sync\_handler+0x108/0x114
   el0t\_64\_sync+0x1a4/0x1a8

The offending \`memcpy()\` in \`ubifs\_copy\_hash()\` has a use-after-free
when a node becomes root in TNC but still has a \`cparent\` to an already
freed node. More specifically, consider the following TNC:

         zroot
         /
        /
      zp1
      /
     /
    zn

Inserting a new node \`zn\_new\` with a key smaller then \`zn\` will trigger
a split in \`tnc\_insert()\` if \`zp1\` is full:

         zroot
         /   \\
        /     \\
      zp1     zp2
      /         \\
     /           \\
  zn\_new          zn

\`zn-\>parent\` has now been moved to \`zp2\`, \*but\* \`zn-\>cparent\` still
points to \`zp1\`.

Now, consider a removal of all the nodes \_except\_ \`zn\`. Just when
\`tnc\_delete()\` is about to delete \`zroot\` and \`zp2\`:

         zroot
             \\
              \\
              zp2
                \\
                 \\
                 zn

\`zroot\` and \`zp2\` get freed and the tree collapses:

           zn

\`zn\` now becomes the new \`zroot\`.

\`get\_znodes\_to\_commit()\` will now only find \`zn\`, the new \`zroot\`, and
\`write\_index()\` will check its \`znode-\>cparent\` that wrongly points to
the already freed \`zp1\`. \`ubifs\_copy\_hash()\` thus gets wrongly called
with \`znode-\>cparent-\>zbranch\[znode-\>iip\].hash\` that triggers the
use-after-free!

Fix this by explicitly setting \`znode-\>cparent\` to \`NULL\` in
\`get\_znodes\_to\_commit()\` for the root node. The search for the dirty
nodes
---truncated---

## Affected and fixed versions

- Linux: \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< daac4aa1825de0dbc1a6eede2fa7f9fc53f14223; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 8d8b3f5f4cbfbf6cb0ea4a4d5dc296872b4151eb; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 4d9807048b851d7a58d5bd089c16254af896e4df; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 74981f7577d183acad1cd58f74c10d263711a215; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 01d3a2293d7e4edfff96618c15727db7e51f11b6; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 398a91599d263e41c5f95a2fd4ebdb6280b5c6c3; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 2497479aecebe869d23a0064e0fd1a03e34f0e2a; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 4617fb8fc15effe8eda4dd898d4e33eb537a7140 (cvelist)
- Linux: 4.20 (cvelist)

## Mitigation

- Upgrade Linux to 4617fb8fc15effe8eda4dd898d4e33eb537a7140 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-53171. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-53171.md
Affected: Linux >= 16a26b20d2afd0cf063816725b45b12e78d5bb31, < daac4aa1825de0dbc1a6eede2fa7f9fc53f14223; >= 16a26b20d2afd0cf063816725b45b12e78d5bb31, < 8d8b3f5f4cbfbf6cb0ea4a4d5dc296872b4151eb; >= 16a26b20d2afd0cf063816725b45b12e78d5bb31, < 4d9807048b851d7a58d5bd089c16254af896e4df; >= 16a26b20d2afd0cf0638167…
Fixed in: Linux 8d8b3f5f4cbfbf6cb0ea4a4d5dc296872b4151eb, Linux 4d9807048b851d7a58d5bd089c16254af896e4df, Linux 74981f7577d183acad1cd58f74c10d263711a215, Linux 01d3a2293d7e4edfff96618c15727db7e51f11b6, Linux 398a91599d263e41c5f95a2fd4ebdb6280b5c6c3, Linux 2497479aecebe869d23a0064e0fd1a03e34f0e2a, Linux 4617f…

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-53171 being exploited?

There is no confirmed exploitation: CVE-2024-53171 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.34% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-53171?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-53171?

Linux \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< daac4aa1825de0dbc1a6eede2fa7f9fc53f14223; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 8d8b3f5f4cbfbf6cb0ea4a4d5dc296872b4151eb; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 4d9807048b851d7a58d5bd089c16254af896e4df; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 74981f7577d183acad1cd58f74c10d263711a215; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 01d3a2293d7e4edfff96618c15727db7e51f11b6; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 398a91599d263e41c5f95a2fd4ebdb6280b5c6c3; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 2497479aecebe869d23a0064e0fd1a03e34f0e2a; \>= 16a26b20d2afd0cf063816725b45b12e78d5bb31, \< 4617fb8fc15effe8eda4dd898d4e33eb537a7140; Linux 4.20.

### Is there a fix for CVE-2024-53171?

Yes. Fixed in Linux 8d8b3f5f4cbfbf6cb0ea4a4d5dc296872b4151eb, Linux 4d9807048b851d7a58d5bd089c16254af896e4df, Linux 74981f7577d183acad1cd58f74c10d263711a215, Linux 01d3a2293d7e4edfff96618c15727db7e51f11b6, Linux 398a91599d263e41c5f95a2fd4ebdb6280b5c6c3, Linux 2497479aecebe869d23a0064e0fd1a03e34f0e2a, Linux 4617fb8fc15effe8eda4dd898d4e33eb537a7140. Upgrade Linux to 4617fb8fc15effe8eda4dd898d4e33eb537a7140 or later.

### How do I check if I'm affected by CVE-2024-53171?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/daac4aa1825de0dbc1a6eede2fa7f9fc53f14223>
- patch: <https://git.kernel.org/stable/c/8d8b3f5f4cbfbf6cb0ea4a4d5dc296872b4151eb>
- patch: <https://git.kernel.org/stable/c/4d9807048b851d7a58d5bd089c16254af896e4df>
- patch: <https://git.kernel.org/stable/c/74981f7577d183acad1cd58f74c10d263711a215>
- patch: <https://git.kernel.org/stable/c/01d3a2293d7e4edfff96618c15727db7e51f11b6>
- patch: <https://git.kernel.org/stable/c/398a91599d263e41c5f95a2fd4ebdb6280b5c6c3>
- patch: <https://git.kernel.org/stable/c/2497479aecebe869d23a0064e0fd1a03e34f0e2a>
- patch: <https://git.kernel.org/stable/c/4617fb8fc15effe8eda4dd898d4e33eb537a7140>
- other: <https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html>
- other: <https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-53171>

HTML: <https://flawdb.com/CVE-2024-53171> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-53171>
