OpenSSL Privilege Escalation
Reference: https://chaudhary1337.github.io/p/how-to-openssl-cap_setuid-ep-privesc-exploit/
Chack capabilities in the target machine.
If you see the openssl has the capability set as below, you can successfully exploit it.
In local machine, you need to have “libssl-dev” to use the header file named “openssl/engine.h” in the exploit. If you don't have it yet, install it.
Then create "exploit.c".
Now compile it using gcc.
Transfer the "exploit.so" to the target machine.
Run the exploit and finally you should get the root shell.
If the above command is executed by root and use values of subjects in any way, we might be able to execute arbitrary command as root.
For example, create a certificate that contains the malicious subject value. When the prompt asks us to enter values, we can insert arbitrary command.
Then some shell script, that uses the subject values, is executed as root, our command ($(chmod u+s /bin/bash)
) may be executed as root.
Last updated