CVE-2024-49889 ext4: avoid use-after-free in ext4_ext_show_leaf()

High 7.8 Published Updated

A use-after-free in the Linux kernel ext4 filesystem can cause a crash, but only when debug features are enabled.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-49889?

CVE-2024-49889 is a high-severity use after free vulnerability in Linux kernel, published on 21 Oct 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

ext4: avoid use-after-free in ext4_ext_show_leaf()

In ext4_find_extent(), path may be freed by error or be reallocated, so using a previously saved *ppath may have been freed and thus may trigger use-after-free, as follows:

ext4_split_extent path = *ppath; ext4_split_extent_at(ppath) path = ext4_find_extent(ppath) ext4_split_extent_at(ppath) // ext4_find_extent fails to free path // but zeroout succeeds ext4_ext_show_leaf(inode, path) eh = path[depth].p_hdr // path use-after-free !!!

Similar to ext4_split_extent_at(), we use *ppath directly as an input to ext4_ext_show_leaf(). Fix a spelling error by the way.

Same problem in ext4_ext_handle_unwritten_extents(). Since 'path' is only used in ext4_ext_show_leaf(), remove 'path' and use *ppath directly.

This issue is triggered only when EXT_DEBUG is defined and therefore does not affect functionality.

Weakness: CWE-416

Which versions are affected by CVE-2024-49889?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-49889?

Apply the vendor's patch.

Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.

Is CVE-2024-49889 being exploited?

There is no known exploitation of CVE-2024-49889 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-51489, BELL-CVE-2024-49889, DEBIAN-CVE-2024-49889, GHSA-rcg3-vwp6-7grp, UBUNTU-CVE-2024-49889.

Is CVE-2024-49889 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free