SMTP (25)

User enumeration

nmap --script smtp-enum-users.nse -p 25,465,587 <IP>

Automated recon script

python3 smtp_script.py <username> <IP>
Script:
#!/usr/bin/python 
import socket 
import sys 

if len(sys.argv) != 3:
        print("Usage: smtp_user_enum <username> <target_ip>") 
        sys.exit(0) 

# Create a Socket 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 

# Connect to the Server 
ip = sys.argv[2] 

connect = s.connect((ip,25)) 
# Receive the banner 

banner = s.recv(1024) 
print(banner) 

# VRFY a user 
user = (sys.argv[1]).encode() 

s.send(b'VRFY ' + user + b'\r\n') 
result = s.recv(1024) 
print(result) 

# Close the socket 
s.close() 

Phishing attack to get a foothold

Preparation

body.txt
config.Library-ms
automatic_configuration.lnk

Exploit

  • Goal: Target user receive the email, and and executes the .library-ms file. Upon execution, the target machine will fetch the Powercat binary from our Kali machine, and initiate a reverse shell with us. Giving us initial foothold onto the target machine

Last updated