{"id":"CVE-2023-54050","state":"PUBLISHED","title":"ubifs: Fix memleak when insert_old_idx() failed","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nubifs: Fix memleak when insert_old_idx() failed\n\nFollowing process will cause a memleak for copied up znode:\n\ndirty_cow_znode\n  zn = copy_znode(c, znode);\n  err = insert_old_idx(c, zbr->lnum, zbr->offs);\n  if (unlikely(err))\n     return ERR_PTR(err);   // No one refers to zn.\n\nFetch a reproducer in [Link].\n\nFunction copy_znode() is split into 2 parts: resource allocation\nand znode replacement, insert_old_idx() is split in similar way,\nso resource cleanup could be done in error handling path without\ncorrupting metadata(mem & disk).\nIt's okay that old index inserting is put behind of add_idx_dirt(),\nold index is used in layout_leb_in_gaps(), so the two processes do\nnot depend on each other.","publishedAt":"2025-12-24T12:23:00.366Z","updatedAt":"2026-08-05T09:16:47.787Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"cc29c7216d7f057eb0613b97dc38c7e1962a88d2","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"6f2eee5457bc48b0426dedfd78cdbdea241a6edb","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"66e9f2fb3e753f820bec2a98e8c6387029988320","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"3ae75f82c33fa1b4ca2006b55c84f4ef4a428d4d","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"ef9aac603659e9ffe7d69ae16e3f0fc0991a965b","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"79079cebbeed624b9d01cfcf1e3254ae1a1f6e14","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"a6da0ab9847779e05a7416c7a98148b549de69ef","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"b5fda08ef213352ac2df7447611eb4d383cce929","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ubifs/tnc.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.27","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.27","versionType":"semver"},{"version":"4.19.283","status":"unaffected","lessThanOrEqual":"4.19.*","versionType":"semver"},{"version":"5.4.243","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.180","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.111","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.28","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.2.15","status":"unaffected","lessThanOrEqual":"6.2.*","versionType":"semver"},{"version":"6.3.2","status":"unaffected","lessThanOrEqual":"6.3.*","versionType":"semver"},{"version":"6.4","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ubifs/tnc.c"]}],"references":["https://git.kernel.org/stable/c/cc29c7216d7f057eb0613b97dc38c7e1962a88d2","https://git.kernel.org/stable/c/6f2eee5457bc48b0426dedfd78cdbdea241a6edb","https://git.kernel.org/stable/c/66e9f2fb3e753f820bec2a98e8c6387029988320","https://git.kernel.org/stable/c/3ae75f82c33fa1b4ca2006b55c84f4ef4a428d4d","https://git.kernel.org/stable/c/ef9aac603659e9ffe7d69ae16e3f0fc0991a965b","https://git.kernel.org/stable/c/79079cebbeed624b9d01cfcf1e3254ae1a1f6e14","https://git.kernel.org/stable/c/a6da0ab9847779e05a7416c7a98148b549de69ef","https://git.kernel.org/stable/c/b5fda08ef213352ac2df7447611eb4d383cce929"],"weaknesses":[],"ingestedAt":"2026-10-29T20:06:42.242Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2023/54xxx/CVE-2023-54050.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2023-54050","state":"PUBLISHED","datePublished":"2025-12-24T12:23:00.366Z","dateUpdated":"2026-08-05T09:16:47.787Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-12-24T12:21:05.090Z"},"containers":{"cna":{"title":"ubifs: Fix memleak when insert_old_idx() failed","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nubifs: Fix memleak when insert_old_idx() failed\n\nFollowing process will cause a memleak for copied up znode:\n\ndirty_cow_znode\n  zn = copy_znode(c, znode);\n  err = insert_old_idx(c, zbr->lnum, zbr->offs);\n  if (unlikely(err))\n     return ERR_PTR(err);   // No one refers to zn.\n\nFetch a reproducer in [Link].\n\nFunction copy_znode() is split into 2 parts: resource allocation\nand znode replacement, insert_old_idx() is split in similar way,\nso resource cleanup could be done in error handling path without\ncorrupting metadata(mem & disk).\nIt's okay that old index inserting is put behind of add_idx_dirt(),\nold index is used in layout_leb_in_gaps(), so the two processes do\nnot depend on each other."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"cc29c7216d7f057eb0613b97dc38c7e1962a88d2","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"6f2eee5457bc48b0426dedfd78cdbdea241a6edb","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"66e9f2fb3e753f820bec2a98e8c6387029988320","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"3ae75f82c33fa1b4ca2006b55c84f4ef4a428d4d","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"ef9aac603659e9ffe7d69ae16e3f0fc0991a965b","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"79079cebbeed624b9d01cfcf1e3254ae1a1f6e14","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"a6da0ab9847779e05a7416c7a98148b549de69ef","versionType":"git"},{"version":"1e51764a3c2ac05a23a22b2a95ddee4d9bffb16d","status":"affected","lessThan":"b5fda08ef213352ac2df7447611eb4d383cce929","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ubifs/tnc.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.27","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.27","versionType":"semver"},{"version":"4.19.283","status":"unaffected","lessThanOrEqual":"4.19.*","versionType":"semver"},{"version":"5.4.243","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.180","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.111","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.28","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.2.15","status":"unaffected","lessThanOrEqual":"6.2.*","versionType":"semver"},{"version":"6.3.2","status":"unaffected","lessThanOrEqual":"6.3.*","versionType":"semver"},{"version":"6.4","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ubifs/tnc.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/cc29c7216d7f057eb0613b97dc38c7e1962a88d2"},{"url":"https://git.kernel.org/stable/c/6f2eee5457bc48b0426dedfd78cdbdea241a6edb"},{"url":"https://git.kernel.org/stable/c/66e9f2fb3e753f820bec2a98e8c6387029988320"},{"url":"https://git.kernel.org/stable/c/3ae75f82c33fa1b4ca2006b55c84f4ef4a428d4d"},{"url":"https://git.kernel.org/stable/c/ef9aac603659e9ffe7d69ae16e3f0fc0991a965b"},{"url":"https://git.kernel.org/stable/c/79079cebbeed624b9d01cfcf1e3254ae1a1f6e14"},{"url":"https://git.kernel.org/stable/c/a6da0ab9847779e05a7416c7a98148b549de69ef"},{"url":"https://git.kernel.org/stable/c/b5fda08ef213352ac2df7447611eb4d383cce929"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerable path is reached only through local filesystem syscalls (write/create/unlink/rename/truncate) on a mounted UBIFS volume via ubifs_jnl_* → ubifs_tnc_add/remove → lookup_level0_dirty → dirty_cow_znode. No network protocol handler parses remote data into this code.\nAC:L - Both preconditions are attacker-driven: the COW branch is entered by forcing a commit with fsync/sync while doing metadata work, and the GFP_NOFS allocation failure is produced by deliberately induced memory pressure, which is readily achievable by an unprivileged process on the memory-constrained embedded systems where UBIFS is deployed and which simultaneously activates the shrinker path that turns the corruption into a UAF.\nPR:L - Only an unprivileged local user with write access to any directory on the UBIFS mount is needed; there is no capability, namespace, or admin check anywhere between the syscall entry and dirty_cow_znode.\nUI:N - The attacker triggers everything with their own file operations on an already-mounted filesystem; no victim action, no mount by another user, and no special file is required.\nS:U - The corruption is confined to the kernel's own TNC structures and the mounted filesystem; there is no crossing into another security authority such as a hypervisor or IOMMU domain.\nC:H - The dangling zbranch[].znode left after shrink_tnc() frees a child through the orphaned parent yields a use-after-free read of a generic kmalloc slab object, letting the attacker read reclaimed kernel memory through TNC descent and, with a sprayed replacement znode, escalate to arbitrary kernel reads.\nI:H - The same use-after-free gives write access to the freed/reallocated znode (flag setting, key_copy, parent re-pointing), a classic control-flow-hijack primitive, and the truncated commit list plus mis-set cparent additionally corrupt the on-disk index — the commit message itself cites \"corrupting metadata(mem & disk)\".\nA:H - Beyond the znode memory leak, the orphaned root case NULL-derefs in ubifs_tnc_levelorder_next() and runs off the end of ubifs_destroy_tnc_subtree() (oops at shrink or unmount), and the dirty_zn_cnt/parent assertions in get_znodes_to_commit() force the filesystem read-only or BUG() depending on assert_action."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T09:16:47.787Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"4.19.283"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"5.4.243"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"5.10.180"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"5.15.111"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.1.28"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.2.15"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.3.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.27","versionEndExcluding":"6.4"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}