I wrote a simple module for the Linux Kernel and it has a stack buffer overflow vulnerability. I want to exploit the module, but I have to turn off the stack protector in the kernel first. How could I do this quickly and simply?
Is it required to compile the kernel every time?
Is there any other way to turn off stack protection in a module of the Linux Kernel (without compiling the kernel)?
Those options work by passing options to the compiler, so the most straightforward way is to recompile the kernel.
However for a reproducible and module-specific way kbuild allows you to set custom CFLAGs on a per-module basis.
https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt
You particularly want to set -fno-stack-protector for the modules you want to exploit.
DKMS additionally allows you to set up automatic rebuild for out of tree drivers against arbitrary kernel versions.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments