root🥷hassans-sec:~#

Hacking....

View on GitHub

Nmap scan report for 10.10.144.47
Host is up (0.18s latency).
Not shown: 995 closed tcp ports (conn-refused)
PORT     STATE    SERVICE     VERSION
139/tcp  open     netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP)
445/tcp  open     netbios-ssn Samba smbd 4.7.6-Ubuntu (workgroup: WORKGROUP)
8080/tcp open     http        Apache httpd 2.4.29 ((Ubuntu))
|_http-title: Apache2 Ubuntu Default Page: It works
|_http-server-header: Apache/2.4.29 (Ubuntu)
8082/tcp open     http        Node.js Express framework
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
9071/tcp filtered unknown
Service Info: Host: INCOGNITO

Host script results:
| smb-security-mode: 
|   account_used: guest
|   authentication_level: user
|   challenge_response: supported
|_  message_signing: disabled (dangerous, but default)
|_clock-skew: mean: 2s, deviation: 0s, median: 2s
| smb2-time: 
|   date: 2024-06-02T21:27:53
|_  start_date: N/A
|_nbstat: NetBIOS name: INCOGNITO, NetBIOS user: <unknown>, NetBIOS MAC: <unknown> (unknown)
| smb-os-discovery: 
|   OS: Windows 6.1 (Samba 4.7.6-Ubuntu)
|   Computer name: incognito
|   NetBIOS computer name: INCOGNITO\x00
|   Domain name: \x00
|   FQDN: incognito
|_  System time: 2024-06-02T21:27:53+00:00
| smb2-security-mode: 
|   3:1:1: 
|_    Message signing enabled but not required

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 34.01 seconds
❯ ffuf -u "http://10.10.144.47:8080/FUZZ" -w /usr/share/dirb/wordlists/common.txt -fc 403

        /'___\  /'___\           /'___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

       v2.1.0-dev
________________________________________________

 :: Method           : GET
 :: URL              : http://10.10.144.47:8080/FUZZ
 :: Wordlist         : FUZZ: /usr/share/dirb/wordlists/common.txt
 :: Follow redirects : false
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200-299,301,302,307,401,403,405,500
 :: Filter           : Response status: 403
________________________________________________

                        [Status: 200, Size: 10918, Words: 3499, Lines: 376, Duration: 163ms]
dev                     [Status: 301, Size: 317, Words: 20, Lines: 10, Duration: 141ms]
index.html              [Status: 200, Size: 10918, Words: 3499, Lines: 376, Duration: 153ms]
index.php               [Status: 200, Size: 4, Words: 1, Lines: 1, Duration: 225ms]
:: Progress: [4614/4614] :: Job [1/1] :: 252 req/sec :: Duration: [0:00:21] :: Errors: 0 ::
❯ ffuf -u http://10.10.144.47:8080/dev/FUZZ -w /usr/share/dirb/wordlists/common.txt -fc 403 -e .txt,.php,.bak

        /'___\  /'___\           /'___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

       v2.1.0-dev
________________________________________________

 :: Method           : GET
 :: URL              : http://10.10.144.47:8080/dev/FUZZ
 :: Wordlist         : FUZZ: /usr/share/dirb/wordlists/common.txt
 :: Extensions       : .txt .php .bak 
 :: Follow redirects : false
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200-299,301,302,307,401,403,405,500
 :: Filter           : Response status: 403
________________________________________________

note.txt                [Status: 200, Size: 45, Words: 6, Lines: 2, Duration: 157ms]
:: Progress: [18456/18456] :: Job [1/1] :: 269 req/sec :: Duration: [0:01:23] :: Errors: 0 ::
❯ ffuf -u http://10.10.144.47:8082/FUZZ -w /usr/share/wordlists/dirb/common.txt -fc 403 -e .txt,.bak,.php

        /'___\  /'___\           /'___\       
       /\ \__/ /\ \__/  __  __  /\ \__/       
       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
         \ \_\   \ \_\  \ \____/  \ \_\       
          \/_/    \/_/   \/___/    \/_/       

       v2.1.0-dev
________________________________________________

 :: Method           : GET
 :: URL              : http://10.10.144.47:8082/FUZZ
 :: Wordlist         : FUZZ: /usr/share/wordlists/dirb/common.txt
 :: Extensions       : .txt .bak .php 
 :: Follow redirects : false
 :: Calibration      : false
 :: Timeout          : 10
 :: Threads          : 40
 :: Matcher          : Response status: 200-299,301,302,307,401,403,405,500
 :: Filter           : Response status: 403
________________________________________________

                        [Status: 200, Size: 11162, Words: 2014, Lines: 126, Duration: 178ms]
login                   [Status: 200, Size: 1605, Words: 352, Lines: 29, Duration: 153ms]
Login                   [Status: 200, Size: 1605, Words: 352, Lines: 29, Duration: 153ms]
static                  [Status: 301, Size: 179, Words: 7, Lines: 11, Duration: 159ms]
:: Progress: [18456/18456] :: Job [1/1] :: 280 req/sec :: Duration: [0:01:16] :: Errors: 0 ::
❯ smbclient  -L ////10.10.144.47 -N

It gaves us options to choose, after trying all the options, figured option 4 opens a vim editor, let’s try exploit vim to gain shell…

conclusion

What we’ve learned:

  1. Enumerating SMB
  2. Enumerating Hidden Directories and Files via FFUF
  3. Exploiting SQL Injection In Login Page
  4. Uploading PHP Webshell Via SMB
  5. Port Forwarding
  6. Password Spraying
  7. Vertical Privilege Escalation Via vim
  8. Horizontal Privilege Escalation Via Hijacking Tmux Session

Thanks For Reading 😉