Footprinting
Intro
information gathering using active (scans) and passive (use of third-party providers) methods.
Enumeration Mythology
![[enum-method33.png]]
Infrastructure Based Enumeration
Domain Information
passively gathering information to understand the company better.
getting first impression of its presence on the internet using their SSL certificate
another source to find more subdomains is crt.sh
1 | # output results in JSON format from crt.sh |
Shodan can be used to find devices and systems permanently connected to the internet
1 | for i in $(cat subdomainlist);do host $i | grep "has address" | grep inlanefreight.com | cut -d" " -f4 >> ip-addresses.txt;done |
see all available DNS records
1 | dig any inlanefreight.com |
Cloud Resources
1 | # ip lookup |
cloud storage can be found in DNS; During IP lookup, its possible to find an IP that belongs to cloud service
using google dorks we can find cloud storages using inurl:amazonaws.com intext:companyname for AWS and inurl:blob.core.windows.net intext:companyname for Azure
webpage source codes can also have mentions
domain.glass can tell us about the company’s infrastructure
GrayHatWarfare can do different searches, discover cloud storages, files and SSH keys
Staff
employees can be identified on business networks like Linkedin, Xing, etc
from job posts we can tell what technologies the company uses (Java, MySQL, Flask, etc)
from employee profile, we can get linked sites to personal projects, github page, etc
from technical employees profiles we can also get infrastructure and technology the company is likely using
Host Based Enumeration
FTP
FTP runs on application layer
for FTP connection, client & server establish channel through port 21 - client sends commands to server & the server returns status code - then participants establish data channel on port 20
- FTP can be in active and passive mode
- in active, when client establishes connection it also informs the server via which client side port the server can transmit the response (less secure because client has to open ports)
- in passive, the server announces a port through which the client can establish the data channel
TFTP
TFTP (Trivial FTP) is simpler than FTP, uses UDP instead of TCP and doesn’t require user authentication
most used FTP server on Linux distros is vsFTPd and config can be found in /etc/vsftpd.conf- some settings are predefined by default
Dangerous settings
anonymous_enable=YESanon_upload_enable=YESanon_mkdir_write_enable=YESno_anon_password=YESanon_root=/home/username/ftpwrite_enable=YES
Anonymous Login / Status / Detailed Output
1 | # anonymous login |
Footprinting
1 | # list nmap ftp scripts |
SMB
is a client-server protocol for sharing files, printers and other network resources for Windows system
Samba
an alternative implementation of SMB for Unix operating systems which uses the Common Internet File System (CIFS) network protocol
Default Configuration
default configuration can be found at /etc/samba/smb.conf
1 | cat /etc/samba/smb.conf | grep -v "#\|\;" |
Dangerous Settings
browseable = yesread only = nowritable = yesguest ok = yesenable privileges = yescreate mask = 0777directory mask = 0777logon script = script.shmagic script = script.shmagic output = script.out
SMBClient
1 | # list shares |
Footprinting
1 | sudo nmap 10.129.14.128 -sV -sC -p139,445 |
NFS
has the same purpose of SMB for Linux and Unix systems
the protocol has no authentication or authorization; instead RPC protocol is used for authentication and authorization is derived from file system information
most common authentication is via UNIX UID/GID and group memberships
/etc/exports contains a table of physical filesystems on an NFS server; it also contains examples of configuring NFS shares
Dangerous Settings
rwinsecurenohideno_root_squash
Footprinting
1 | sudo nmap 10.129.14.128 -p111,2049 -sV -sC |
DNS
- is used to resolve domain names to IP addresses
- types of DNS servers:
- DNS root server
- Authoritative name server
- Non-authoritative name server
- Caching server
- Forwarding server
- Resolver
- DNS queries are unencrypted by default but can be encrypted using DoT, DoH or DNSCrypt network protocol
- it stores information about services associated with the domain like mail server, etc
- different DNS records are used for DNS queries:
AReturns an IPv4 address of the requested domain as a result. AAAAReturns an IPv6 address of the requested domain. MXReturns the responsible mail servers as a result. NSReturns the DNS servers (nameservers) of the domain. TXTThis record can contain various information. CNAMEThis record serves as an alias for another domain name PTRThe PTR record works the other way around (reverse lookup). It converts IP addresses into valid domain names. SOAProvides information about the corresponding DNS zone and email address of the administrative contact.
all DNS servers work with 3 different types of config files:
- local DNS configuration files
- zone files
- reverse name resolution files
Bind9 server is often used on Linux based distros; the local config file
named.confis divided into:named.conf.local
named.conf.optionsnamed.conf.log
zones are divided into individual files and is used to describe a zone completely; found in
/etc/bind/db.domain.comreverse name resolution zone files are used for PTR records to map IP address to FQDN; found in
/etc/bind/db.10.129.14dangerous settings:
allow-queryallow-recursionallow-transferzone-statistics
Footprinting
1 | # query NS using specific DNS server with @ |
SMTP
Simple Mail Transfer Protocol is a protocol for sending emails; used between an email client and an outgoing server or between two SMTP servers
is often combined with IMAP or POP3 protocols
its unencrypted and transmits all data in plaintext and uses port 25
newer SMTP servers which are ESMTP are encrypted with SSL/TLS and use port 465 or 587; use AUTH PLAIN for authentication
mail workflow:
Client (MUA)➞Submission Agent (MSA)➞Open Relay (MTA) ➞Mail Delivery Agent (MDA) ➞ Mailbox (POP3/IMAP)default config can be found in
/etc/postfix/main.cfinteracting with an SMTP server:
1 | # connect to a server |
- dangerous settings:
- open relay config:
mynetworks = 0.0.0.0/0- the server can send fake emails and init communicaton between multiple parties; can also spoof an email and read it
- open relay config:
Footprinting
1 | # default nmap script includes smtp-commands |
IMAP / POP3
- Internet Message Access Protocol (IMAP) is used to access emails from a mail server; it allows online management of emails and supports folder structures
- Post Office Protocol (POP3) only provides listing, retrieving and deleting emails as function
- IMAP is unencrypted by default and uses port 143; can be encrypted with SSL/TLS on port 143 or 993
- dangerous settings:
auth_debugauth_debug_passwordsauth_verboseauth_verbose_passwordsauth_anonymous_username
Footprinting
- ports 110 and 995 are used by default for POP3, and ports 143 and 993 for IMAP; higher ports (993 and 995) use TLS/SSL
1 | sudo nmap 10.129.14.128 -sV -p110,143,993,995 -sC |