┌──(root💀kali)-[~/Documents/hackthebox/routerspace]└─#nmap-T5-sC-sV-O-Pn-p-10.10.11.148StartingNmap7.92 ( https://nmap.org ) at 2022-05-14 17:40 EDTsendtoinsend_ip_packet_sd:sendto(5,packet,44,0,10.10.11.148,16) =>OperationnotpermittedOffending packet: TCP 10.10.14.11:62477 > 10.10.11.148:14426 S ttl=54 id=40535 iplen=44 seq=3554380708 win=1024 <mss 1460>
Nmapscanreportfor10.10.11.148Hostisup (0.022s latency).Notshown:65533filteredtcpports (no-response)PORTSTATESERVICEVERSION22/tcpopenssh (protocol 2.0)|fingerprint-strings:|NULL:|_SSH-2.0-RouterSpacePacketFilteringV1|ssh-hostkey:|3072f4:e4:c8:0a:a6:af:66:93:af:69:5a:a9:bc:75:f9:0c (RSA)|2567f:05:cd:8c:42:7b:a9:4a:b2:e6:35:2c:c4:59:78:02 (ECDSA)|_2562f:d7:a8:8b:be:2d:10:b0:c9:b4:29:52:a8:94:24:78 (ED25519)80/tcpopenhttp|_http-trane-info:ProblemwithXMLparsingof/evox/about|_http-title:RouterSpace|fingerprint-strings:|FourOhFourRequest:|HTTP/1.1200OK|X-Powered-By:RouterSpace|X-Cdn:RouterSpace-7888|Content-Type:text/html; charset=utf-8|Content-Length:71|ETag:W/"47-sX+54c6peisKtGNZVOIFN0Fam58"|Date:Sat,14May202221:49:15GMT|Connection:close|Suspiciousactivitydetected!!!{RequestID:prA9AJaHgwGOJe}|GetRequest:|HTTP/1.1200OK|X-Powered-By:RouterSpace|X-Cdn:RouterSpace-17500|Accept-Ranges:bytes|Cache-Control:public,max-age=0|Last-Modified:Mon,22Nov202111:33:57GMT|ETag:W/"652c-17d476c9285"|Content-Type:text/html; charset=UTF-8|Content-Length:25900|Date:Sat,14May202221:49:15GMT|Connection:close|<!doctypehtml>|<htmlclass="no-js"lang="zxx">|<head>|<metacharset="utf-8">|<metahttp-equiv="x-ua-compatible"content="ie=edge">|<title>RouterSpace</title>|<metaname="description"content="">|<metaname="viewport"content="width=device-width, initial-scale=1">|<linkrel="stylesheet"href="css/bootstrap.min.css">|<linkrel="stylesheet"href="css/owl.carousel.min.css">|<linkrel="stylesheet"href="css/magnific-popup.css">|<linkrel="stylesheet"href="css/font-awesome.min.css">|<linkrel="stylesheet"href="css/themify-icons.css">|HTTPOptions:|HTTP/1.1200OK|X-Powered-By:RouterSpace|X-Cdn:RouterSpace-83120|Allow:GET,HEAD,POST|Content-Type:text/html; charset=utf-8|Content-Length:13|ETag:W/"d-bMedpZYGrVt1nR4x+qdNZ2GqyRo"|Date:Sat,14May202221:49:15GMT|Connection:close|GET,HEAD,POST|RTSPRequest,X11Probe:|HTTP/1.1400BadRequest|_Connection:close2 services unrecognized despite returning data. If you know the service/version, please submit the following fingerprints at https://nmap.org/cgi-bin/submit.cgi?new-service :
==============NEXTSERVICEFINGERPRINT (SUBMIT INDIVIDUALLY)==============SF-Port22-TCP:V=7.92%I=7%D=5/14%Time=6280220D%P=x86_64-pc-linux-gnu%r(NULLSF:,29,"SSH-2\.0-RouterSpace\x20Packet\x20Filtering\x20V1\r\n");==============NEXTSERVICEFINGERPRINT (SUBMIT INDIVIDUALLY)==============SF-Port80-TCP:V=7.92%I=7%D=5/14%Time=6280220D%P=x86_64-pc-linux-gnu%r(GetRSF:equest,31BA,"HTTP/1\.1\x20200\x20OK\r\nX-Powered-By:\x20RouterSpace\r\nSF:X-Cdn:\x20RouterSpace-17500\r\nAccept-Ranges:\x20bytes\r\nCache-ControlSF::\x20public,\x20max-age=0\r\nLast-Modified:\x20Mon,\x2022\x20Nov\x20202SF:1\x2011:33:57\x20GMT\r\nETag:\x20W/\"652c-17d476c9285\"\r\nContent-TypeSF::\x20text/html;\x20charset=UTF-8\r\nContent-Length:\x2025900\r\nDate:\xSF:20Sat,\x2014\x20May\x202022\x2021:49:15\x20GMT\r\nConnection:\x20close\SF:r\n\r\n<!doctype\x20html>\n<html\x20class=\"no-js\"\x20lang=\"zxx\">\n<SF:head>\n\x20\x20\x20\x20<meta\x20charset=\"utf-8\">\n\x20\x20\x20\x20<meSF:ta\x20http-equiv=\"x-ua-compatible\"\x20content=\"ie=edge\">\n\x20\x20\SF:x20\x20<title>RouterSpace</title>\n\x20\x20\x20\x20<meta\x20name=\"descSF:ription\"\x20content=\"\">\n\x20\x20\x20\x20<meta\x20name=\"viewport\"\SF:x20content=\"width=device-width,\x20initial-scale=1\">\n\n\x20\x20\x20\SF:x20<link\x20rel=\"stylesheet\"\x20href=\"css/bootstrap\.min\.css\">\n\xSF:20\x20\x20\x20<link\x20rel=\"stylesheet\"\x20href=\"css/owl\.carousel\.SF:min\.css\">\n\x20\x20\x20\x20<link\x20rel=\"stylesheet\"\x20href=\"css/SF:magnific-popup\.css\">\n\x20\x20\x20\x20<link\x20rel=\"stylesheet\"\x20SF:href=\"css/font-awesome\.min\.css\">\n\x20\x20\x20\x20<link\x20rel=\"stSF:ylesheet\"\x20href=\"css/themify-icons\.css\">\n\x20")%r(HTTPOptions,10SF:8,"HTTP/1\.1\x20200\x20OK\r\nX-Powered-By:\x20RouterSpace\r\nX-Cdn:\x20SF:RouterSpace-83120\r\nAllow:\x20GET,HEAD,POST\r\nContent-Type:\x20text/hSF:tml;\x20charset=utf-8\r\nContent-Length:\x2013\r\nETag:\x20W/\"d-bMedpZSF:YGrVt1nR4x\+qdNZ2GqyRo\"\r\nDate:\x20Sat,\x2014\x20May\x202022\x2021:49SF::15\x20GMT\r\nConnection:\x20close\r\n\r\nGET,HEAD,POST")%r(RTSPRequestSF:,2F,"HTTP/1\.1\x20400\x20Bad\x20Request\r\nConnection:\x20close\r\n\r\nSF:")%r(X11Probe,2F,"HTTP/1\.1\x20400\x20Bad\x20Request\r\nConnection:\x20SF:close\r\n\r\n")%r(FourOhFourRequest,12C,"HTTP/1\.1\x20200\x20OK\r\nX-PoSF:wered-By:\x20RouterSpace\r\nX-Cdn:\x20RouterSpace-7888\r\nContent-Type:SF:\x20text/html;\x20charset=utf-8\r\nContent-Length:\x2071\r\nETag:\x20W/SF:\"47-sX\+54c6peisKtGNZVOIFN0Fam58\"\r\nDate:\x20Sat,\x2014\x20May\x2020SF:22\x2021:49:15\x20GMT\r\nConnection:\x20close\r\n\r\nSuspicious\x20actiSF:vity\x20detected\x20!!!\x20{RequestID:\x20p\x20\x20rA9A\x20\x20\x20JaHgSF:w\x20\x20G\x20OJe\x20}\n\n");Warning:OSScanresultsmaybeunreliablebecausewecouldnotfindatleast1openand1closedportAggressive OS guesses: Linux 4.15 - 5.6 (92%), Linux 5.0 (92%), Linux 5.0 - 5.4 (91%), Linux 5.3 - 5.4 (91%), Linux 2.6.32 (91%), Crestron XPanel control system (90%), Linux 5.0 - 5.3 (89%), Linux 5.4 (89%), ASUS RT-N56U WAP (Linux 3.4) (87%), Linux 3.1 (87%)
NoexactOSmatchesforhost (test conditionsnon-ideal).OSandServicedetectionperformed.Pleasereportanyincorrectresultsathttps://nmap.org/submit/.Nmap done: 1 IP address (1 host up) scanned in 74.49 seconds
Port 80
Let's open it with jadx-gui. With the manifest we know that we can install in an Android from API 21 to API 30. <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>
We need to launch burp and set it to intercept traffic from the avd. You can check my documentation on Android here to see how to set this up.
We need to change our /etc/hosts file to be able to reach it 10.10.11.148 routerspace.htb
Once our hosts file is modified here is what happens in burp
If we send this to the repeater and try command injection we can actually execute commands on the server
So we have a user paul
We can event grab the user flag this way
We have an .ssh folder in the home but it does not have a key
Let's get a reverse shell. I tried multiple command and was not successful to get a shell. It seems like there is a protection block of some sort.
The other option would be to generate a secret key and write it in the .ssh folder of Paul as we have access to it.
ssh-keygen we generate and ssh key I will name mine routerspace_rsa
So now we need to write it in the ssh folder using burp. We will have to escape double quotes for the command to actually work.
We can cat it to make sure it worked
Now we should be able to log in with ssh using it. So I made a typo in for the filename make sure you name it authorized_keys, I modified it with mv.
ssh -i routerspace_rsa paul@10.10.11.148 now you should be able to login with ssh
Privilege escalation
Let's get linpeas wget https://github.com/carlospolop/PEASS-ng/releases/download/20230205/linpeas_linux_amd64
We will need to use scp because of the restrictions we had previously here is an example on scp scp FILE-TO-SEND user@ip:/path/to/folder so in my case scp -i routerspace_rsa linpeas_linux_amd64 paul@10.10.11.148:/home/paul (we need to specify the key)
chmod +x linpeas_linux_amd64 from the target we make our file executable
./linpeas_linux_amd64 we can run it
Interesting output
So here is what we could investigate from our linpeas output
VulnerabletoCVE-2021-3560# This one shows up as a 95% PE vector# It is also worth checking the other CVEs found by linpeas[+] [CVE-2022-2586] nft_object UAFDetails:https://www.openwall.com/lists/oss-security/2022/08/29/5Exposure:probableTags: [ ubuntu=(20.04) ]{kernel:5.12.13}DownloadURL:https://www.openwall.com/lists/oss-security/2022/08/29/5/1Comments:kernel.unprivileged_userns_clone=1required (to obtainCAP_NET_ADMIN)[+] [CVE-2021-4034] PwnKitDetails:https://www.qualys.com/2022/01/25/cve-2021-4034/pwnkit.txtExposure:probableTags: [ ubuntu=10|11|12|13|14|15|16|17|18|19|20|21],debian=7|8|9|10|11,fedora,manjaroDownloadURL:https://codeload.github.com/berdav/CVE-2021-4034/zip/main[+] [CVE-2021-3156] sudo Baron SameditDetails:https://www.qualys.com/2021/01/26/cve-2021-3156/baron-samedit-heap-based-overflow-sudo.txtExposure:probableTags:mint=19,[ubuntu=18|20],debian=10DownloadURL:https://codeload.github.com/blasty/CVE-2021-3156/zip/main[+] [CVE-2021-3156] sudo Baron Samedit 2Details:https://www.qualys.com/2021/01/26/cve-2021-3156/baron-samedit-heap-based-overflow-sudo.txtExposure:probableTags:centos=6|7|8,[ubuntu=14|16|17|18|19|20],debian=9|10DownloadURL:https://codeload.github.com/worawit/CVE-2021-3156/zip/main[+] [CVE-2021-22555] Netfilter heap out-of-bounds writeDetails:https://google.github.io/security-research/pocs/linux/cve-2021-22555/writeup.htmlExposure:probableTags: [ ubuntu=20.04]{kernel:5.8.0-*}DownloadURL:https://raw.githubusercontent.com/google/security-research/master/pocs/linux/cve-2021-22555/exploit.cext-url:https://raw.githubusercontent.com/bcoles/kernel-exploits/master/CVE-2021-22555/exploit.cComments:ip_tableskernelmodulemustbeloaded[+] [CVE-2022-32250] nft_object UAF (NFT_MSG_NEWSET) Details: https://research.nccgroup.com/2022/09/01/settlers-of-netlink-exploiting-a-limited-uaf-in-nf_tables-cve-2022-32250/
https://blog.theori.io/research/CVE-2022-32250-linux-kernel-lpe-2022/Exposure:lessprobableTags:ubuntu=(22.04){kernel:5.15.0-27-generic}DownloadURL:https://raw.githubusercontent.com/theori-io/CVE-2022-32250-exploit/main/exp.cComments:kernel.unprivileged_userns_clone=1required (to obtainCAP_NET_ADMIN)[+] [CVE-2017-5618] setuid screen v4.5.0 LPEDetails:https://seclists.org/oss-sec/2017/q1/184Exposure:lessprobableDownloadURL:https://www.exploit-db.com/download/https://www.exploit-db.com/exploits/41154╔══════════╣UnixSocketsListening╚https://book.hacktricks.xyz/linux-hardening/privilege-escalation#sockets/home/paul/.pm2/pub.sock└─(ReadWrite)/home/paul/.pm2/rpc.sock└─(ReadWrite)╔══════════╣Searchinguncommonpasswdfiles (splunk)passwdfile:/etc/pam.d/passwdpasswdfile:/etc/passwdpasswdfile:/usr/share/bash-completion/completions/passwdpasswdfile:/usr/share/lintian/overrides/passwd
The polkit CVE will not work because it needs Gnome-Control-Center which we do not have here.
Linpeas also mentions CVE-2021-3156. Let's get try with the poc from linepeas. Here are the steps.
No luck with this exploit, let's try another one and if it does not work we will try another CVE