External Network Penetration Testing

OSINT

Reconnaissance

Passive External Network Reconnaissance

Dorks

Google dorks

site:company.com -site:www.company.com
site:*.company.com

Bing dorks

site:company.com -site:www.company.com 
site:*.company.com

Pastebin
Certificate Transparency

Finding domain for a company using certificate transparency list (Domain Parser)

curl -s https://crt.sh/\?o\=Company\&output\=json > crt.txt
cat crt.txt | jq -r '.[].common_name' | DomainParser | sort -u

Exposed credentials and leaks (Flare, DarkWeb Agent, dehashed, breach-parse)
DNS history
ASN Lookups

https://bgp.he.net/dns/company.com#_ipinfo
Shodan ASN filter feature

Google search

ipinfo asn Company Name

Amass Intel module

amass intel -org CompanyName

TLSX : TLS Grabber

echo "144.178.0.0/10" | tlsx -san

Web Archive

Active External Network Reconnaissance

Subdomain enumeration

A (script)[https://github.com/appsecco/the-art-of-subdomain-enumeration/blob/master/san_subdomain_enum.py] to extract sub-domains from Subject Alternate Name(SAN) in X.509 certs - Source: https://github.com/appsecco/the-art-of-subdomain-enumeration

python3 san_subdomain_enum.py company.com

aiodnsbrute

aiodnsbrute -t 20 company.com -o csv -f subdomains -w ./subdomains-top1million-110000.txt

HTTP/HTTPS Screenshots
Web App Pentest Checklists
Subdomain takeover
Bypassing CloudFlare
NMAP

Scanning /24 IP range with UDP and TCP scan using SMB NSE script.

nmap -sU -sT -p U:137,139,T:22,21,80,443,139,445 --script=smb2-security-mode.nse 192.168.0.10/24

Recon-NG
User account enumeration

Against web app portal

Exposed documents - Metadata
Virtual Host
BGP Hijacking
Cloud enumeration

Exposed services - Protocols

HTTP/HTTPS
SMTP
DKIM / DMARC / SPF misconfiguration
SNMP
for i in $(cat onesixtyone/dict.txt); do echo -n "$i : "; snmpget -v 3 -u $i udp6:[IPv6] MIB_TO_FETCH; done
FTP
SSH
Databases (MySQL, MSSQL, Oracle, DB2, Postgre, MongoDB...)
Exposed storages
Scanning external target

Exploitation

RCE

RCE-as-a-feature (Jenkins, Serv-U, etc).
- https://github.com/p0dalirius/Awesome-RCE-techniques

Exposed source code or credentials

SAP

Lync

IIS specific checks

ASPNET_CLIENT Folder enumeration
- http://itdrafts.blogspot.com/2013/02/aspnetclient-folder-enumeration-and.html

IIS tilde character “~” Vulnerability/Feature
- Burp Suite Module IIS Tilde Enumeration - IIS-ShortName-Scanner

java -jar iis_shortname_scanner.jar 2 20 https://iiswebserver.com

Web vulnerabilities

SSL/TLS implementation

Default Credentials in use

Open SMTP Relay

DNS Zone Transfer

dig @your-ip -t axfr <TARGETDOMAIN.COM>  
nmap --script dns-zone-transfer.nse --script-args "dns-zone-transfer.domain=<TARGETDOMAIN.COM>" -Pn -p 53 <TARGET_IP>

VPN - IKE Aggressive Mode

Password spray

(o365, Azure, Citrix, RDP, VPN, OWA, etc)

General tool

The following plugins are currently supported:
- OWA - Outlook Web Access - EWS - Exchange Web Services - O365 - Office365 - O365Enum - Office365 User Enum (No Authentication Request) - MSOL - Microsoft Online - Okta - Okta Authentication Portal - FortinetVPN - Fortinet VPN Client - HTTPBrute - Generic HTTP Brute Methods (Basic/Digest/NTLM) - ADFS - Active Directory Federation Services - AzureSSO - Azure AD Seamless SSO Endpoint - GmailEnum - Gmail User Enumeration (No Authentication Request)

CheckPoint SSL VPN
O365

./trevorspray.py -e emails.txt --passwords "Winter2021!" --delay 15 --no-current-ip --ssh ubuntu@<IP> ubuntu2@<IP2> -k privkey.pem

OWA

Metasploit module : scanner/http/owa_login

Azure
IP rotation

Sometimes during password spraying or brute force attack attacker will need to rotate IP and geolocation to avoid being blocked.

2FA/MFA implementation issues

​ - MFASweep: Detect MFA for various Microsoft Servers
- Credsniper

Re-using valid credentials on alternate services
- Mailsniper

Resources

Attacking MS Exchange

FOREGENIX : Know your attack surfaces

Offensive OSINT

OSINT Resources

Pentest Check-List

Haax cheatsheet