CVE-2024-53143 – fsnotify: Fix ordering of iput() and watched_objects decrement (10 Dec 2024)

Preface: The Go language is also developed on fsnotify, but the file extension is fsnotify[.]go. fsnotify is a Go library to provide cross-platform filesystem notifications on Windows, Linux, macOS, BSD, and illumos. Go 1.17 or newer is .

Background: In Linux, fsnotify is actually implemented based on the inotify system call. inotify is a subsystem of Linux VFS, which can monitor changes in the file system. When the file system changes, the kernel will notify the user space of these changes, and the user space can do something based on these changes.

Vulnerability details: Fix ordering of iput() and watched_objects decrement. Ensure the superblock is kept alive until we’re done with iput(). Holding a reference to an inode is not allowed unless we ensure the superblock stays alive, which fsnotify does by keeping the watched_objects count elevated, so iput() must happen before the watched_objects decrement. This can lead to a UAF of something like sb->s_fs_info in tmpfs, but the UAF is hard to hit because race orderings that oops are more likely, thanks to the CHECK_DATA_CORRUPTION() block in generic_shutdown_super(). Also, ensure that fsnotify_put_sb_watched_objects() doesn’t call fsnotify_sb_watched_objects() on a superblock that may have already been freed, which would cause a UAF read of sb->s_fsnotify_info.

Official announcement: Please see the link below for details –

https://nvd.nist.gov/vuln/detail/CVE-2024-53143

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.