A recently discovered double-free vulnerability (CVE-2022-3238) in the Linux kernel's NTFS3 subsystem has drawn attention from the open-source community, researchers, and developers alike. This flaw occurs when a user triggers remount and umount operations simultaneously and can enable a local user to crash the system or potentially escalate their privileges. In this blog post, we will examine the code snippet associated with the vulnerability, discuss the exploit details, and provide links to the original references.

Code Snippet

The issue can be found in the kernel's fs/ntfs3/super.c file, specifically in the ntfs_umount and ntfs_remount functions. Here is a simplified code snippet to illustrate the vulnerability:

// Simplified code snippet from fs/ntfs3/super.c

static void ntfs_umount(struct super_block *sb)
    struct ntfs_sb_info *sbi = NTFS_SB(sb);

    if (!sbi)

    /* ... */
    kfree(sbi); // Memory is deallocated here

static int ntfs_remount(struct super_block *sb, int *flags, char *data)
    struct ntfs_sb_info *sbi = NTFS_SB(sb);

    if (!sbi)
        return -EINVAL;

    /* ... */
    return ;

In this example, the double-free issue occurs when ntfs_umount function frees the memory allocated to the sbi variable and terminates. If the ntfs_remount function gets executed concurrently, it may attempt to reference the now-deallocated memory, causing a crash or undefined behavior.

Exploit Details

Since the double-free vulnerability requires an attacker to have local user access to the target machine, exploiting this flaw is less straightforward than remote code execution vulnerabilities. However, it is still potentially dangerous as it can lead to unexpected system crashes or allow an attacker to escalate their privileges on a Linux system running an affected kernel version.

Identify the filesystem type as NTFS3.

3. Craft a custom script or program to trigger remount and umount operations simultaneously on the NTFS3 filesystem.

Run the attack and potentially cause a system crash or privilege escalation.

Once triggered, the double-free issue can possibly result in a denial-of-service (DoS) attack, kernel panic, or elevation of privileges.

Original References

The CVE-2022-3238 vulnerability was reported by Wenkai Du, while the patch for this vulnerability was submitted by Anton Eidelman. You can find the original references to the vulnerability and patch details below:

1. Linux kernel Git commit with the patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=470e678b73d44465a2ebc840f22031d472daad34
2. National Vulnerability Database (NVD) link for CVE-2022-3238: https://nvd.nist.gov/vuln/detail/CVE-2022-3238
3. Linux kernel mailing list discussion on the patch: https://lore.kernel.org/lkml/20220209095336.28043-1-anton.eidelman@portworx.com/


Double-free vulnerabilities such as CVE-2022-3238 can lead to severe consequences if left unpatched. It is essential to stay aware of these vulnerabilities, understand their implications, and apply the appropriate patches to secure your system. Ensuring that your Linux installation is running the latest kernel version and regularly checking for security updates can help mitigate the risk posed by such flaws.


Published on: 11/14/2022 21:15:00 UTC
Last modified on: 11/17/2022 20:24:00 UTC