nday
CVE-2024-53171

ubifs: authentication: Fix use-after-free in ubifs_tnc_end_commit

Linux / Linux

披露于 。本站尚未获取修复依据,不能据此认为没有补丁。四个 PoC 来源都还没有收录。尚未列入 CISA KEV。

标签 漏洞类型use-after-free 攻击途径本地无需用户交互 产品Linux kernel 产品类型操作系统
这些标签的依据

这些标签由 nday 按固定规则从下列事实自动推导,不是 NVD、编号分配方或其他来源给出的。全部标签和规则见 ~/tags。

use-after-free
CWE-416(来源:ADP CISA-ADP、NVD 分析人员、NVD(转录自 134c704f-9b21-4f2e-91b3-4a467353bcc0))
本地
编号分配方 Linux 给出的 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H(CVSS 3.1)中的 AV:L
无需用户交互
编号分配方 Linux 给出的 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H(CVSS 3.1)中的 UI:N
Linux kernel
CVE 记录列出的受影响产品:Linux · LinuxNVD 分析人员标为易受攻击的 CPE 名称:o:linux:linux_kernel
操作系统
CVE 记录列出的受影响产品:Linux · LinuxNVD 分析人员标为易受攻击的 CPE 名称:o:linux:linux_kernelnday 产品登记表中 Linux kernel 的产品类型
当前阶段
DIS
披露
CVSS
7.8 HIGH v3.1

生命周期

横轴 UTC;点=精确到分钟,宽条=仅日期,空心=未知或推定。
时间未知
DIS披露
2024-12-27T13:49Z
PAT补丁
尚无记录
ANA分析
尚无记录
POCPoC
尚无记录
ITW在野
尚无记录
KEVKEV
尚无记录

摘要

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---

以上是 CVE 记录(cvelist)中的原文,未经改写。

利用条件

按 CVSS 向量说明攻击需要的条件。
攻击途径 AV:L
本地:需要本地或 SSH 会话,或诱使用户在本机上操作
攻击复杂度 AC:L
低:不依赖特殊条件,攻击者可预期重复成功
所需权限 PR:L
低:普通用户权限
用户交互 UI:N
无:除攻击者外不需要任何人配合

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

CVSS 3.1 向量,来自 CVE 记录,由 CNA Linux 评定。

事件记录

+DIS披露

CVE 记录发布,编号分配方是 Linux。CVSS 7.8,高危。

来源 cvelist · 本站 批量导入 · 原始记录
{
  "id": 345852,
  "type": "disclosed",
  "source": "cvelist",
  "url": "https://www.cve.org/CVERecord?id=CVE-2024-53171",
  "occurred_at": "2024-12-27T13:49:16.423Z",
  "observed_at": "2026-11-13T05:38:43.790901Z",
  "is_backfill": true,
  "dedupe_key": "",
  "detail": {
    "cvss": {
      "source": "cna",
      "vector": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "version": "3.1",
      "base_score": 7.8,
      "base_severity": "HIGH"
    },
    "ssvc": {
      "timestamp": "2025-02-11T15:43:44.944550Z",
      "automatable": "no",
      "exploitation": "none",
      "technical_impact": "total"
    },
    "state": "PUBLISHED",
    "date_published": "2024-12-27T13:49:16.423Z",
    "assigner_short_name": "Linux"
  }
}

纠错

报告错误或缺失

页面有误或缺失?告诉编辑;采纳后在本页修订记录公开说明,上游数据不会被改动。

研究员讨论

近 7 天有 0 位研究员提到

研究员在 X 上提到此 CVE 的帖子,原文照录,nday 不核实。

尚未采集到名单内研究员在 X 上提到此 CVE 的帖子。

讨论

0 条评论

还没有评论。