Hi, these are the notes I took while watching the “Practical recon techniques for bug hunters & pen testers” talk given by Bharath Kumar on LevelUp 0x02 / 2018.
This talk is about some practical recon techniques for bug hunters & pentesters. It’s a continuation of Bharath’s talk about niche subdomain enumeration techniques.
Reconnaissance is the act of gathering preliminary data or intelligence on your target. The data is gathered in order to better plan for your attack. Reconnaissance can be performed actively or passively.
CT logs by design contain all the certificates issued by a CA for any given domain
They allow attackers to passively gather a lot of information about an organization’s infrastructure: domains including internal domains, subdomains, email addresses
CT logs can expose (in real time) HTTPS apps during their CMS (Wordpress, Joomla…) install process where the installer has no form of authentication
=> If you are fast enough, you could take over the server
This is a known attack technique
[Abusing Certificate Transparency or How to hack Web applications before installation.](https://media.defcon.org/DEF CON 25/DEF CON 25 presentations/DEFCON-25-Hanno-Boeck-Abusing-Certificate-Transparency-Logs.pdf) by Hanno Böck at Defcon 25
CSP HTTP headers allow devs to create a whitelist of sources of trusted content & instruct the browser to only execute or render resources from those sources
DNS zone transfer (misconfiguration rarely found today)
dig AXRF @ns1.insecuredns.com totallylegit.in
Authenticated Denial of Existence (RFC 7129)
In DNS, when clients query for a non-existent domain, the server must deny its existence. It’s harder to do in DNSSEC do to cryptographic signing. It can be done using NSEC or NSEC3 records
=> DNSSEC zone walking is the new zone transfer
If DNSSEC is enabled on your target & NSEC records are used you’ll get all the domains:
Install Ldnsutils on Kali/Debian/Ubuntu: sudo apt-get install ldnsutils
Try zone walking NSEC - LDNS
ldns-walk (part of ldnsutils) can be used to zone walk DNSSEC signed zone that uses NSEC
ldns-walk iana.org
ldns-walk @ns1insecuredns.com totallylegit.com
NSEC3 records are like NSEC records but provide a signed gap of hashes of domain names, to prevent zone enumeration or make it expensive
An attacker can still collect all the subdomain hashes & crack them offline using Nsec3walker & nsec3map
Example of zone walking NSEC3 protected zone :
# Detect if DNSSEC NSEC or NSEC3 is used
ldns-walk icann.org
# Collect NSEC3 hashes of a domain
$ ./collect insecuredns.com > insecuredns.com.collect
# Undo the hashing, expose the subdomain information
$ ./unhash insecuredns.com.collect > insecuredns.com.unhash
# Check the number of successfully cracked subdomain hashes
$ cat insecuredns.com.unhash | grep "icann" | wc -l
# List only the subdomain part from the unhashed data
$ cat icann.org.unhash | grep "icann" | awk '{print $2;}'
Few things that changed with the advent of APIs/Devops #
Storage
Authentication
API keys & token based authentication instead of username & password
Spaces finder is a tool to look for publicly accessible Digital Ocean Spaces using a wordlist, list all the accessible files on a public Space & download the files
It’s AWSBucketDump tweaked to work with DO Spaces, since Spaces API is interoperable with Amazon’s S3 API
# Extract subdomain names for a given domain from FDNS data
cat 20170417-fdns.json.gz | pigz -dc | grep "\.example\.com" | jq .name > example.com.domains.fdns
# Display first 15 subdomains from all the unique subdomains gathered
cat example.com.domains.fdns | grep "\.example\.com" | uniq | head -n 15
# Total number of unique subdomains enumerated
cat example.com.domains.fdns | grep "\.example\.com" | uniq | wc -l
These methods are slow. See HD Moore’s talk on how to do faster lookups