Linux kernel REFCOUNT overflow/Use-After-Free in keyrings
This exploit is a proof-of-concept code for a vulnerability in the Linux kernel. It is a REFCOUNT overflow/Use-After-Free vulnerability in keyrings. It allows an attacker to gain root privileges on the system. The exploit is written in C and uses the keyutils library. It takes a keyring name as an argument and creates a keyring with that name. It then sets the permissions of the keyring to allow all users to access it. It then sets the timeout of the keyring to a large value and assumes authority over the keyring. It then invalidates the keyring and waits for the child process to finish. The child process creates a message queue and sends a message to it. It then sets the request key keyring to 1 and sets the timeout of the keyring to a large value. It then assumes authority over the keyring and calls the userspace_revoke function which calls the commit_creds and prepare_kernel_cred functions to gain root privileges.