Active Information Gathering

Open ports on OSCP / HTB rarely occurs without purpose. Remember about them through whole exploitation. Some of them are useless at the first glance but with information found on other ports can become crucial to compromise the machine.

Manual benner checking

It is advised to check every port manually with nc.

nc <IP> <PORT>

Nmap

You should run nmap multiple times - sometimes it do not return all ports. Another way of making sure to get the correct output is setting the --max-delay flag.

Scan for open ports [TCP]

sudo nmap -sC -sV -p- <IP>
nmap -sV -p- -oA output -Pn -A -T4 <IP>
nmap -sV -p- -oA outputVuln -Pn --script vuln -T5 <IP>

Scan for open ports [UDP]

nmap -sU -A -p- -oA outputUDP <IP>

Run vuln scan

nmap <IP> -sV --script "vuln" -p<PORT>

Nmap script listing

Import NSE script

Move script to nmap script folder:

Update the nmap script database:

Run script:

(PowerShell NMAP alternative)

Windows port scanning

This is only for 1024 ports. You can change the range (this script is definietly not as fast as map).

Windows subtnetwork scanning

SMTP Enumeration (23, 465, 587)

Manual enumeration

Automatic enumeration

SNMP Enumeration (161, 162, 10161, 10162 / UDP)

Can be susceptible to IP spoofing and replay attacks.

SNMP protocols 1, 2, and 2c offer no traffic encryption, meaning that SNMP information and credentials can be easily intercepted over a local network (until SNMPv3).

It can be configured with default public and private community strings.

SNMP MIB Tree - SMTP database containing information related to the network management.

Values
Paremeters

1.3.6.1.2.1.25.1.6.0

System Processes

1.3.6.1.2.1.25.4.2.1.2

Running Programs

1.3.6.1.2.1.25.4.2.1.4

Processes Path

1.3.6.1.2.1.25.2.3.1.4

Storage Units

1.3.6.1.2.1.25.6.3.1.2

Software Name

1.3.6.1.4.1.77.1.2.25

User Accounts

1.3.6.1.2.1.6.13.1.3

TCP Local Ports

Scanning the network with onesixtyone (u can also just use nmap):

Querying for a MIB data:

Querying for parameters

DNS Enumeration (53)

You can use these commands also without providing the DNS IP

Banner grabbing

More information:

Zone transfer

Transfer DNS to another sercer.

Subdomain Enumeration

Whois Enumeration (43)

Basic information about a domain name.

FTP Enumeration (21)

It is advised to change from ASCII to binary mode to troubleshoot errors during file transfer

Upload files

Download files

NBT Enumeration (137)

You can grab NetBIOS names - it can be useful in other areas of the hacking process.

SMB Enumeration (139, 445)

ClockSKEW error? Synchronize time with DC using:

sudo ntpdate <DC_IP>

You can grab a lot of information from SMB.

Enumerate Users, Groups and Logged on Users

You can spray usernames as passwords when you provide users.txt file in -p parameter with --no-bruteforce and --continue-on-success.

Enumerate shares (alternative)

Sometimes crackmapexec does not return truthful output - it is advised to use other tools.

Connect to share

Download everything from share

Mount share (listing bypass, can search for hidden files)

Umount old mount:

Mount to kali's /mnt folder:

MSSQL

Crackmapexec user check:

Crackmapexec modules enumeration:

Log in through impacket:

NFS Enumeration (2049)

Show all mounts

Mount folder

LDAP (389, 636, 3268, 3269)

Ldapsearch:

Sample command

WEB (80, 443)

Information Gathering

Oracle TNS Listener (1521, 1522-1529)

Download the tool from here: https://github.com/quentinhardy/odat/releases/

Enumeration and exploitation

Last updated