Sudo OpenVPN Privilege Escalation
The sudo openvpn command might be vulnerable to privilege escalation.
Investigation
If we can execute openvpn command as root and we have a permission of editing the .ovpn file, we can escalate to privilege.
Exploitation
1. Create a Payload
First create a shell script to reverse shell. For example, create /tmp/shell.sh.
Replace <local-ip> with your local ip address.
Then change the file permission so that root can execute this script.
2. Edit .ovpn File
Next edit the .ovpn file.
We need to add "script-security 2" and "up /tmp/shell.sh" into the header.
3. Reverse Shell
In local machine, start a listener.
Now execute openvpn command as root.
This command executes our shell.sh, so we should get a root shell.