Enumerating Esoteric Attack Surfaces by Jann Moon
Enumerating Esoteric Attack Surfaces by Jann Moon
Enumerating Esoteric Attack Surfaces by Jann Moon
Chapters
Preparing for Battle_________________________________________________ 4
Required and Recommended Prerequisites_________________________ 8
Scopes and Strategies_______________________________________________ 11
Continuous Recon__________________________________________________ 14
Acquisitions_________________________________________________________17
ASN (Autonomous Service Numbers)_______________________________ 23
Reverse Whois_____________________________________________________ 29
Ports_______________________________________________________________ 40
Third-Party Services________________________________________________ 47
Dorks_______________________________________________________________ 57
Subdomains________________________________________________________ 71
Certificates_________________________________________________________ 80
Passive Subdomain Enumeration Tools____________________________ 89
Active Subdomain Enumeration Tactics____________________________97
VHOSTS____________________________________________________________102
Permutation_______________________________________________________ 114
Content Discovery_________________________________________________ 123
Spidering For Endpoints___________________________________________ 132
Endpoints from JavaScript Files___________________________________ 138
Fuzzing with Wordlists____________________________________________ 163
Connections Through Analytics Tags,_____________________________ 173
Uncovering Cloud-Based Assets___________________________________ 174
Miscellaneous Tips ________________________________________________ 179
4
Hey there,
Thanks for checking out my book on expanding esoteric attack
surfaces for penetration testers, bug bounty hunters and OSINT
aggressors. None of the content in this book should be too punishing
in terms of difficulty, even if you are not the most seasoned gladiator of
the cyber realm. However, for this tome to serve as your faithful
companion in any effective manner, you should know some basic
things before starting or you'll have a less than ideal experience.
can often flip the IP to a new one easily and circumvent any bans
that your targets try to catch you with.
- The amount of bandwidth you can blast at your targets from your
home PC can’t even compare to these cloud boxes. Even on the
cheapest plan with any provider, I could blatantly abuse tons of
targets with senseless nuclei scans, brute force endpoints, assault
servers with port scans and fingerprint them continuously and
still never use more than 6% of my monthly allotted bandwidth.
- Your cloud box is easily accessible from any computer, granting
you access to all your notes, output from tools, firing off new scans
and more. You can even check it from your phone, and yes, even
while driving!! Do you think the top hunters have time to solely
focus on driving at any point in the day? Highly doubtful. If you
want to be the best, start valuing performance above your
personal safety.
- Getting comfortable with cloud services is definitely a skill
relevant to most IT jobs. Plus, setting up various tools and services
can expose you to things like port forwarding, configuring servers
and further advance your Linux terminal knowledge.
Usually, lots of these cloud providers offer you a fat stack of cash to
incentivize you to forfeit your payment information, so be careful about
running up resources past the cash bonus date. For example, they
might wave 300$ in your face, but it will vanish after 30 days, regardless
of how much or how little you use. Unlike a couple powerhouse service
providers I’ve had business dealings with in the past, Digital Ocean has
never launched a multi-hundred dollar bill out of the darkness at me
8
If you’d like to try out Digital Ocean with a free 200$ credit and help
me out a little bit, here is my referral link:
https://m.do.co/c/d129eb1d821b
Thank you! If you need any help setting up SSH, adding and mounting
additional memory after spinning up your box or figuring out any of
the nuances interwoven throughout this provider’s available services,
please don’t hesitate to ask (preferably your cloud provider but I guess
you can ask me too).
It is highly advisable that you use Linux for your engagements. Debian
and Ubuntu are dependable, though you can bypass manually
exhuming many popular tools from Github by using an offensive
cybersecurity focused distro like Kali Linux or Parrot (Security Edition).
Pentesting distros like Blackarch and Athena OS are very neat, but you
must accept your fate as an unchained soul, thrashing alone in the
bottom of the ocean and any issues you come across will probably need
to be fixed by yourself, the free-spirited commander that decided they
were clever enough to end up at the same finish line as everyone else,
though with many more fancy tools, handsome Desktop environment
and whatever else you gain from taking this lonely, hostile road.
9
Finally, in my Linux host, I always run as the “root” user. Since I am way
too busy to type “sudo” all the time (even with my alias of “s”) and I am
way too smart to break anything by accident, I recommend you
become confident, fearless and value your time and become the actual
owner of the piece of technology that YOU bought. Don’t let anyone
tell you how to run your Linux sessions, unless they are offering you
absolute power without regret or restraint (like I am, right now). So you
won’t see much of “sudo” in this book, because I am a super user from
the second I touch the keyboard and you should become a leader, by
following this advice.
Note: At the time of this writing (January 2024), the current version of
Python is 3.12. There is a surprisingly high amount of scripts that are
broken and won’t run with this version, so I generally install and run
Python tools with `python3.11` to avoid this error. You can try with 3.12
but if the tool is vomiting error messages across your terminal, this is
the first thing I would try to do to fix it. This includes running setup via
`python3.11 setup.py install` and `python3.11 -m pip install -r
requirements.txt`.
11
any imaginary boundaries being set for the people you hire to do
“attack simulation”. Yet each self-imposed limit punches holes into the
realism and by transitive property, value, in accurately evaluating the
security readiness against mean and clever bastards in the wild.
Throughout social engineering, physical attacks and supply chain
exploitation attacks that permeate the threat landscape, it's clear that
there’s plenty of attack surface for an organization to try to secure,
without it imposing further restrictions on hunters and penetration
testers.
Very liberal scopes give the hunter the ability to perform “Horizontal
Domain Enumeration”, instead of the vertical kind that is synonymous
with wildcard domain scopes.
- Vertical Domain Scopes: Includes subdomains of a target and will
ideally be clearly defined as a “wildcard scope”, with a syntax that
looks like “*.domain.com”, or occasionally “domain.com”. The latter,
if the program owner is either a moron or prefers being
13
If you are hunting on a target with a really impressive, loose, broad and
inclusive mega-blanket style scope, discovering esoteric resources that
are ripe with vulnerabilities ready to be harvested will be far more likely.
With an extra juicy, thick and prominent scope, where all assets tied to
an organization, umbrella, family or trademark; certain recon
techniques can be used to find esoteric and neglected assets usually
less hardened than the proprietary prizewinners and the
triple-reinforced front entrance to the stronghold. These techniques
are…
- Horizontal Domain Enumeration
- CIDR Enumeration
14
Continuous Recon
Once you enumerate the various assets (IP ranges, subdomains, JS files,
subsidiaries, etc..), a crucial technique to remain two-shakes of a lamb’s
tail ahead of your competition is to utilize your enumeration techniques
over time, comparing your new data to discover changes and prioritize
15
You must fill out the configuration file for the tool to work. If you install
it the way above, you can find it in your home folder at
“$HOME/.config/notify/provider-config.yaml”. If you downloaded the
executable from the “Releases” section on Github, you need to
download or copy-n-paste the contents of the file and put it in the
expected folder. You can be notified through Discord, Slack, Telegram,
SMTP, Googlechat, Microsoft Teams or any custom webhook you prefer.
As you can imagine, there are all kinds of ways to alert yourself as soon
as your framework discovers a vulnerability, when your blind XSS server
16
gets a succulent request or when that person you like leaves your
message on “read”.
To pipe your tool output into Notify, that’s exactly what you do.
To save your output to a file, then have notify query it, you can run the
below.
When the scope says something very brief like “All assets owned by
[ORGANIZATION]” for their scope, I get very excited. It produced a
strong feeling that tells me I should put on some sunglasses and start
kicking out the windows in my home, because I’m about to find some
bounties and upgrade them anyways. With enough initiative and
courage, this sentiment will resonate with you as well.
17
Acquisitions
Let’s punch it into full actionable and useful information mode here,
because most of us know what acquisitions are (it is when a company
buys another company and then it falls into its cavernous wide scope).
Sometimes, companies include some whiny disclaimer in their policy
that says you can’t test a vulnerability for the first 90 days that the
acquisition becomes public (if you think you might cut ahead of the
curve, explore the new acquisition before the probation period, maybe
you accidentally send a few curious requests around and wait to report
them, I’d probably advise you to check out the plethora of other
programs, as you don’t want to tip them off early and have them catch
it in their logs and fix it).
- Newsletters. Sign up for these when you see them and link them
to an email address used for OSINT and recon. These newsletters
sometimes send unique endpoints to surveys or whatever that
can’t be found through spidering or search engines.
- Miscellaneous sources. including press releases, industry analyst
reports, stock market announcements, job postings or anything
19
- https://intellizence.com/insights/merger-and-acquisition/largest-
merger-acquisition-deals/
- https://www.owler.com
- https://www.crunchbase.com/discover/acquisitions
- https://github.com/themarkib/google-acquisitions
- https://news.mergerlinks.com/
This next one is succulent but will likely dry up before the 2nd edition of
this book. It is a paid source of data but can be circumvented by
tricksters as clever as ourselves. There is a seven day trial you can sign
up for but we need access beyond next weekend and don’t want to
surrender our email address as we are too busy for the account
verification process.
site:mergr.com “targetorganization.com”
While it won’t allow you to see the full list containing the latest
chronologically listed mergers and acquisitions, I searched for the most
recent acquisition and it did appear, so we know that Google is quick to
parse each update into its search results.
Finally, I got this method from the very skilled Jason Haddix (@Jhaddix).
OCCRP follows 414 million public entities and they parse and allow you
to access various datasets involving these entities. To get to work, visit
the following URL, register and search for your organization’s name on
the front page.
https://aleph.occrp.org
You’ll likely get a bunch of hits, some unrelated, but look out for a
dataset called “US SEC (CorpWatch)” and click on the company name
(not “US SEC (CorpWatch)”. Head over to the “Assets and Shares” tab
and fatten your dataset.
Through his recon, Zseano estimated that the target was struggling to
boost their financial standing as they edged closer to the date where
their quarterly report was due to be released. Underperforming
financial reports send a strong signal to insecure stockholders and they
begin to psychologically torment themselves until they are actively
deciding to cut their losses, shoveling their money bank into the banks
and hedge funds. A mastermind like Zseano can look at a situation like
this and translate his findings into something valuable and actionable.
Knowing that the target organization would be desperate for a boost in
revenue as soon as possible, certain safety procedures in the software
development lifecycle would descend in importance, as pushing the
new features that could generate revenue to the clients would be the
top priority.
22
He pulled the pages from the target and compared the code base to
prior data, discovering the hastily implemented features and getting to
testing. The features were dropped to generate revenue as he
predicted and he started testing the payment feature with “dev-mode”
test cards (for example, 4111 1111 1111 1111), experimenting with different
countries and banks, until discovering the right combo and accessing
an alternate payment system. This system did accept the test card and
he was able to run as many ads as he wanted to for free on the testing
domain. The lesson here is that a deep and thorough mindset for
recon, coupled with continuous discovery, can lead you to an
unexpected vulnerability. Once he cleverly positioned himself towards
attack surfaces likely to crumble, the path towards exploitation could be
followed logically for a hunter with a solid understanding of
foundational hacking techniques.
23
Starting our recon with a wide net and then falling into more
obscure and esoteric crevices to find the hidden treasures seems like a
logical approach, so ASN enumeration seems like a logical place to start.
If your target has a powerful enough internet presence that they
register blocks of IP numbers to host their many domains and web
services and they host the content on their own servers (rather than
using a CDN like Cloudflare or cloud hosting, like AWS, Azure or GCP),
they likely have registered their own ASN. You should always check the
owner of the ASN or the IP ranges within it, if it belongs to a cloud or
CDN provider, there will be no point scanning the IPs within it and it
may even be illegal. Owning your own servers and ASNs has become
less common since cloud providers have become commonplace,
however, if you find an ASN and verify that your target is responsible for
the number and its subsequent IP ranges, all is good.This can be very
helpful to us, because we can set our sights on a block of IP addresses
and comfortably perform active recon on them, as we know they are
definitely owned by the organization.
24
ASNs exist so that BGP (Border Gateway Protocol) can identify how
data travels throughout the internet. ASNs benefit organizations by
allowing them to define and implement their own routing policies. This
means they can control how data flows in and out of their networks,
optimize various performance features, implement security measures
or otherwise manage traffic. Depending on geographical region, ASNs
are managed by regional internet registries (RIRs) like ARIN (American
Registry for Internet Numbers), RIPE NCC (Réseaux IP Européens
Network Coordination Centre), APNIC (Asia-Pacific Network Information
Centre). It is also important to note that an organization may possess
more than one ASN, if they want to connect to multiple ISPs, have
backups or any other esoteric reason.
Sometimes you may be lucky and have the ASN defined for you in your
scope from the organization itself but other times you may need to do a
tiny bit of work (really, it really is not much). Once you go straight for
the ASN and begin parsing the organization’s assets, you can find direct
IPs that allow you to bypass WAFs, plenty of leaky SSL certs and various
hidden hosts and services.
You can grab the ASN from searching for the organization or the ASN
on https://bgp.he.net.
You can also query whois data, which is a database of domain owners,
their addresses, their e-mail contact and their names. You can do this
via querying whois via the terminal, as seen below.
25
go install github.com/harleo/asnip@latest
asnip -t <IP or Domain> -p
iv. Using nitefood’s very useful tool asn. Though the other tools are
concise and follow Linux’s “do one thing and do it well” credence, this
tool overwhelmingly makes up for the void of creativity present when it
came time to name it. Beyond just ASN, the tool delivers organization
26
curl "https://raw.githubusercontent.com/nitefood/asn/master/asn"
> /usr/bin/asn && chmod 0755 /usr/bin/asn
asn [target]
go install github.com/projectdiscvoery/asnmap/cmd/asnmap@latest
asnmap -a ASN
asnmap -i IP
asnmap -d DOMAIN
asnmap -org ORGANIZATION_NAME
asnmap -f FILE_CONTAINING_TARGETS.txt
Once you have the ASN, you can then search for it on Shodan, Censys,
Fofa, Zoomeye and other similar services (more on those later). Below is
the syntax shown through some example queries.
If absolutely everything is falling apart, here are two more places to get
ASN and IP range information.
28
https://asnlookup.com
https://ipv4info.com
29
Reverse Whois
[snip…]
Then pull the second column only with choose (or awk if you hate
yourself).
Run the tool with the -k flag for API key and -d for target domain.
You can also query the tool directly using the syntax below. Options for
the mode parameter are domains, email, organization.
curl https://api.whoxy.com/?key=xxxxx&reverse=whois
&keyword=babyfat&mode=domains
Assuming you have your target’s valid ASN, you can pull the IP ranges
under it via the search function on https://bgp.he.net or through the
mxtoolbox site here: https://mxtoolbox.com/SuperTool.aspx
Choose “ASN Lookup”, type in your target’s ASN via the format “AS9999”
and you will be gifted the IP or CIDR ranges.
There is also a barebones command you can fire off to get your ASN and
its associated IP ranges. 1
An alternative way to find these ranges that will most likely always be
available, is to use the hacker security blanket known as nmap. This
tool will be explained in further depth in the “Ports” and
“Fingerprinting” sections of this sacred tome, since nmap’s extensible
and adaptable scripting language capabilities are capable of wearing
quite a few hats. There is an Nmap script to find IP ranges that belong
to an ASN that
https://nmap.org/nsedoc/scripts/targets-asn.html
Clean up the output from the above nmap result, take all the IPs in a file
and then run version scanning on them or masscan on them.
1
Barebones, as in you could close your eyes and point at any random, hairless, newborn Linux
distro and you should still be able to pull off the command, because “whois”, “grep” and
“uniq” are (or at least, should be) standard to all of them. If you ever use an unfamiliar Linux
distro and one of those tools responds with an error, you should use your OSINT skills to find
the developer and humiliate him, in the same way that he shamed us both when he made
the choices he made.
33
Once you have a list of CIDRs, you want to turn them into a list of IP
addresses that are hosting servers or services that you can investigate
and destroy. I like to use a tool called prips, to expand CIDRs into a list
of all IP addresses belonging to it.
Otherwise, you can get this version from Go, that is not the exact same
tool, but it does the same thing.
go install github.com/imusabkhan/prips@latest
prips 10.10.10.0/24
Save this list as it is, for fuzzing VHOSTs later on. To do something
interesting with this list right now, we can feed them into a tool that
does reverse DNS lookups. As DNS servers normally work by feeding
them a hostname (which is easier for users to remember) and the DNS
server will return the IP address, so your browser can find the content it
34
wants. Reverse DNS works in much the same and opposite way, I think
you get it.
A no-nonsense or funny business tool that does this, is charismatic
Hakluke’s tool, hakrevdns, available at
https://github.com/hakluke/hakrevdns
You can funnel your IP straight from prips, as seen below.
You can also set specific DNS resolvers for hakrevdns, which will
produce some subtle differences in results. Currently, the best and
most updated lists can be found here:
https://github.com/trickest/resolvers
After running hakrevdns, you may notice that the output may not be
ideal for piping to another tool. You will also probably want a list of just
IP addresses that hit hosts and there are a couple ways to do this, but
one will accelerate your race to the arthritis finish line at a significantly
faster rate.
Just for historical accuracy, here is the way that makes your bones
tingle.
Output:
165.26.210.227
165.26.210.229
35
165.26.210.253
165.26.211.3 (and so on…)
OK, some of you will probably say that awk has a lot of other uses and it
is very versatile but I’ve been lucky enough to live during an era where I
can find other tools to fulfill those uses and avoid the deep dive into
awk that many Linux users likely drowned in. Educated hunters of the
modern age will be pleased to discover an alternative tool called
“choose” can produce an identical output at a faster speed, available as
a pre-compiled binary for Linux at
https://github.com/theryangeary/choose/releases/
The charming syntax can be seen in action below:
Choose can predict how you are trying to parse the data that you feed
it and the number corresponds with which section you want it to
output. The count begins at 0, like almost everything else in
programming except for awk. To grab the last field, use “choose -1” (and
“choose -2” for the second-to-last field and so on). You can also signify
which field separator to use with the “-f [field_seperator]” syntax or
output multiple fields like below.
Slapping around IPs until they leak juicy tidbits must be a specialty for
Hakluke, because he has yet another method of expanding attack
36
go install github.com/hakluke/hakip2host@latest
And use it much the same as his other tools that punch IP addresses.
Output:
DNS-PTR] 173.0.84.23 new-creditcenter.paypal.com.
[DNS-PTR] 173.0.84.11 slc-a-origin-www-1.paypal.com.
[SSL-CN] 173.0.84.67 api.paypal.com
[SSL-SAN] 173.0.84.76 svcs.paypal.com
If you wanted to create a file with just the subdomains, you could do so
like this.
37
Let’s push our recon further to try to bypass reverse proxies that may be
protecting the origin IP of a domain. Allowing you to target the content
directly through the IP in your browser, bypasses WAFs, load balancers
and some other protections that your target organization has
outsourced to third-party vendors to protect their assets. While you can
report the origin IP discovery as a vulnerability, it is somewhat low in
severity, and the organization’s goons will likely say something smug
and predictable like “So what if you can get the origin IP? It is so secure
that we don’t even need the WAFs protection, unless you can prove
otherwise?”, so it is ideal to find another vulnerability like an XSS or
SSRF to chain it to. Anyways, Hakluke has a tool for this purpose called
hakoriginfinder. It works by sending a request to the IP address and
the target host, then comparing the response for similarity using the
Levenshtein algorithm.
Install it via:
38
go install github.com/hakluke/hakoriginfinder@latest
Then serve up prips with your CIDR range and set the -h flag with the
host you want to test for with hakoriginfinder.
You can also parse the data to ignore all the “NOMATCH” results and
remove the “MATCH” word on the remaining output, so you are left with
the more pipe-ready “protocol://IP_Address:Port” syntax.
You can also use a tool like imAyrix’s cut-cdn, to remove IPs that are
protected by WAFs and load balancers or hosted on cloud providers.
Since they host multiple unrelated domains on various ports, doing any
kind of scanning will be out of scope, get you blocked by the provider
and disappoint you when you think you found something overflowing
with vulnerabilities, but find out that it actually belongs to a Mongolian
basket-weaving forum and they are not interested in paying you for
your hard work. Even with the WAF’s protection, you can still look for
39
First, it's a good habit to update both the cloud providers (-ua flag) then
the ranges (-ur) to have accurate data. Skipping this step and hunting
on a target that isn’t in scope makes you feel like a badass when you
find a vulnerability and can’t turn it in (or dumb-ass, smooth brain,
whatever your inner bully tells you after you fail things).
And here, a few web-based tools that serve up similar information, just
in case the world descends into some kind of hell spiral and Github is
tortured out of existence.
https://centralops.net/co/domaindossier.aspx
https://toolbox.googleapps.com/apps/dig/
40
Ports
Across each IP address, there exists 65,535 possible ports for services to
run on. Although you can run almost any service on any port, services
generally have default ports and many tools will parse them based on
these expected ports. For example, web servers generally run on port
80 for HTTP and port 443 for HTTPS, while you will occasionally see
servers running on 8080,8443,8001,5000 or any other port. At this
stage, we need to have either a CIDR or a list of IP addresses so we can
fire off requests at their ports to see if we can find a service that your
target probably doesn’t want wide open to the public, some outdated
software that your target has neglected to update for some time or just
more attack surface to wage war against in later steps.
First, since we may have a pretty chunky list of IP addresses to test and
65,535 ports for each one, we want a tool that is fast and violent without
sacrificing too much accuracy (without sacrificing any accuracy, ideally).
A long-time staple for penetration testers, hunters, people that like to
have the ability to send 10 million packets per second (like me) and
people that need to scan the entire internet within a few minutes (not
really me), is a tool by robertdavidgraham called masscan. Now this is
41
I should also mention that the output is pretty disgusting, to the extent
that I learned how to use jq to parse JSON, rather than have it burn my
corneas ever again.
Armed with our list of open ports, we need to find out what is actually
running on them and whether the answer to that question deserves
further inquiry, probing and punching. Nmap has been a long staple in
the hacking and infosec community and is usually what is running on
the screen if you ever see someone “hacking” in a movie. With nmap,
you are able to check for open ports on local and remote networks,
check for live hosts and even do a good bit of service enumeration.
Through the use of scripts, nmap has been extended to be able to brute
force logins, perform user enumeration, check for CVEs and anything
else there is a script for. Many hackers run nmap as their first
42
You may likely have nmap on your box already, but if not, then install it
via:
mv ./vulners.nse /usr/share/nmap/scripts/vulners.nse
nmap --script-updatedb
Nmap has a vast dune of possible arguments for doing all kinds of
wonky things, but I’ll list the ones most relevant to the type of person
this book is for.
-A : Unlike popular opinion, this “A” does not stand for “all”, but rather
“aggressive”. This flag enables OS detection, version detection, script
scanning, and traceroute
-sV : Attempt to enumerate services running on open ports and their
versions.
-T4 : You can enter between 1 to 5 to signify the speed that nmap will
fire off packets. The default is 3 and I’ll nudge it up a bit if I can get away
with it, occasionally using “2” if the WAF is very finicky and abrasive to
my requests.
--script [script or category] : To specify which types of scripts you want
to run against your target, you can either list them individually or use
preset bundles of scripts by writing “auth”, “vuln”, “intrusive”,
“discovery”, “exploit”, “fuzzer” and a few more.
You can find all their names and descriptions here:
https://nmap.org/nsedoc/categories/
I mentioned earlier in the book that recon (nor any workflow in hacking)
should be looked at as a linear checklist. While having a methodology,
being organized and following your plan will help you significantly
avoid wasting time, becoming overwhelmed, performing redundant
work and forgetting to look for certain things, an attack plan that is
44
Another alternative you can use, with a good amount of speed, as well
as accuracy, is projectdiscovery’s “naabu”. It incorporates nmap but it is
often wonky so I’d just use it for port scanning and then do a separate
nmap scan that you can fine-tune the scanning and the output. Grab a
compiled version from:
https://github.com/projectdiscovery/naabu/releases
go install -v
github.com/projectdiscovery/naabu/v2/cmd/naabu@latest
Using it is fairly simple, read the docs if you want a deep dive but I don’t
think anything will surprise you much.
For the best overall output, my favorite tool for port scanning has been
Rustscan. Some people say they’ve had issues with this tool’s accuracy
but I think they’re haters and losers because I’ve never experienced this.
Get the tool from the releases, because tools written in Rust are
45
dpkg -i rustscan_1.10.0_amd64.deb
You can use additional flags to set the rate of scanning and decide
which ports to scan, but the speed is very commendable and you want
to scan all of the ports, which is the default. It will also automatically
funnel its results into nmap with some basic values, but to set your own,
use two consecutive dashes (--) and follow them with the nmap flags
you want to use, like below.
After you find all the open ports for your target’s hosts, you can then do
some research into fingerprinting the service further (later in this book),
looking for CVEs and known exploits(maybe in the next book) and
46
trying to figure out some clever way to bury it (don’t actually DoS it or
otherwise take it offline).
47
Third-Party Services
Shodan
48
Known lovingly as the hacker’s search engine, Shodan scans the entire
range of possible IP addresses and their top ports, making the
information searchable by service, product, OS, country, keyword and
more. While most don’t utilize it to its full potential, some have been
very successful and used Shodan to discover well paying vulnerabilities
(check out talks by OrwaGodfather for Shodan mastery techniques).
There is benefit to using the web interface, as opposed to just the
terminal package, unlike most tools. You can certainly use Shodan to
search for domains, IP addresses or keywords but probably the best
filters to use with Shodan are the following:
Ssl.cert.subject.CN:”overlord.com”
"ssl:Swinegames Inc."
If you get tons of results, you can filter them via negative filters by
adding something like:
-http.status:”403”
https://www.shodan.io/search/filters
The command line tool also has its uses and can be installed
via the following command.
To perform a search:
One interesting way to search for new attack targets via Shodan is
through Google Analytics tags. You can often find it within the content
of a sites main Javascript file (typically app.js or main.js) or sometimes
within the HTML code. It will look something like: GTM-TL2KT9H or
UA-1592615
You can search the body of server front pages for this Google Analytics
code via this filter:
http.html:'ua-1592615'
You can also use Shodan to scan its database by favicon hashes.
Favicons are the tiny 16 x 16 pixel image icons that show up next to each
tab in your browser, serving as an insignia to the organization or if not
specifically defined, sometimes the framework that the site is running
50
on. Anyways, there are tools that exist that create a hash of a site’s
favicon and then you can search that hash value across Shodan to find
other related domains and subdomains.
One such tool is MurMurHash by Viralmaniar. To install and run the tool,
follow below.
python3.11 MurMurHash.py
The tool will ask you to enter the URL for the favicon you want (just
enter the main URL, not necessarily the endpoint of the favicon.ico
image file). If a valid favicon is confirmed, you’ll receive a favicon hash in
the form of a 10-digit number, that you will then copy into the following
Shodan filter. The example below uses the favicon for Spring Boot, for
which Shodan will list all of them across the internet.
http.favicon.hash:116323821
You could also use the command-line version of Shodan as well, like so:
Another excellent tool that gives you some quick details about your
target quickly is Shodan’s own nrich. Since it is written in Rust, it works
really well and really quickly but can also cause despondency to those
who try to compile it themselves. For those who have in investment in
retaining their own mental health, you can grab a release for all
platforms here:
https://gitlab.com/shodan-public/nrich/-/releases
https://mr-koanti.github.io/shodan
https://www.osintme.com/index.php/2021/01/16/ultimate-osint-with-sho
dan-100-great-shodan-queries/
https://github.com/jakejarvis/awesome-shodan-queries
https://community.turgensec.com/shodan-pentesting-guide/
CENSYS
One way to use Censys is to try to expose origin IPs for servers that are
protected by Cloudflare or another provider. To do this, use the search
to look for your target domain. Then, look to the left column under
ASNs. Try to find the ones that belong to your organization and you will
be left with IPs that are generally unprotected by WAFs and are ripe for
heavy port scans.
53
There are also other similar services that are definitely worth checking
out on your own. Zoomeye.org, quake.360.net and Fofa.io are a bit
tough to navigate and register for as they are in Chinese but if you can
find an API key on Github, I strongly recommend using it in your tools.
Services based in the greatest country in the world include
viz.greynoise.io, hunter.how, onyphe.io and app.netlas.io.
Some even list the CVEs that the server is vulnerable to, check it out on
netlas.io.
But you already probably knew about Shodan and Censys, right? All of
us have spent more nights than we’d care to admit watching
middle-aged Russian women working in a Siberian post office or found
some offshore vessel and pressed all the buttons we could find until
some alarms started ringing. So let’s dig a little deeper into some
places that the normie bounty hunters won’t even consider looking
into.
FULLHUNT.IO
This domain is pretty awesome and even beats Shodan and Censys in
presentation and depth of data, just not the breadth of data available.
Signing up is quicker than it takes a cat’s whisker to twitch and then we
54
can start piling on the queries. It matches most of the search operators
available in Shodan and Censys, while simplifying the ones that Censys
constructs in its own convoluted way and transforms them into the way
a rational human would expect them to appear.
growth investing in more probes and scanners. Anyways, this site looks
HOT. Don’t take my word for it, feast your eyeballs below!
If you look closely above, you can see that they grant you just two
miserable results before tormenting you with the rest of your queried
data, albeit smudged and out of focus conspicuously on the sections
that you really want to read. I’m hoping these cruel business practices
change someday, either by the warming of their hearts, by legislation or
by violent force, as I don’t know any other services that use Google
Analytics, GTM tags and Facebook tokens to discover related hosts. I
almost always end up checking those manually when I am parsing and
deobfuscating the JavaScript files but this is a quick and visually clean
way to get this info.
57
Dorks
Using Dorks for your recon is one of the easiest and most rewarding
victories you can enjoy. Dorks are filters you can employ into your
Google, Bing or other search engine searches to find vulnerable things
that should probably not be indexed (and unprotected). You can find
some shocking shit with these and there are way too many to go over
so I’ll drop some sweet and nasty ones and their general category of
usage below.
site:*.ladyboys.com
site:*.ladyboys.com -site:www.ladyboys.com
-site:forum.ladyboys.com
58
Next, you can find sensitive documents for your target organization
using the following dorks (replace Neurolink with your target
organization, obviously).
site:docs.google.com/spreadsheets "Neurolink"
site:groups.google.com "Neurolink"
You can also use it to find self-hosted bug bounty programs that aren’t
part of the majors (H1, Bugcrowd, Intigriti) and will have significantly
less competition. You can find a good list here:
59
https://github.com/sushiwushi/bug-bounty-dorks/blob/master/d
orks.txt
You can also run through some dorks with some great tools. A
common issue is Google will slap you with a CAPTCHA and mess up
your whole firestorm of requests against its servers but there are some
workarounds that clever people have discovered. One great tool that
doesn’t suffer from this issue is dwisiswant0’s go-dork at which can be
installed through Go via:
You can run via the following syntax, with -q being your dork or query
and -p being the amount of pages the tool will pull from:
go-dork -q "intext:'jira'" -p 5
As you can see in the image, you don’t need to remember the operator
syntax or much else, as you can pull from a list of over 7,000 pre-built
queries, neatly organized into categories of variable juiciness. You can
also build your own with the “builder” feature, which will hold your hand
very tightly so you can’t make any mistakes.
Here’s a technique that may help you find the final piece of attack
surface that danced through every other technique you used and
remained hidden. Essentially, it is just a regex search for the domain
name, though you will still need to manually verify that the asset is truly
owned by your target organization. While this could be accomplished
via a google dork like “site:*target*.com”, there is a much cleaner way
that will automatically deduplicate apex domains.
https://search.dnslytics.com/search?q=name:+*REPLACE_ME*&d=domains
You can also use DNSlytics “name” operator and utilize their “domains”
search feature using the syntax found below.
name: *KEYWORD*
For example, if I wanted to target any sources about a small Japanese island that
once had a bustling Mitsubishi coal mine, that eventually shuttered its doors in
the 1970’s, cleared all inhabitants from the island and became an powerful
example of literal and metaphoric societal decay through its haunting remnants
of brutalist architecture, I’d replace “KEYWORD” above with “hasima-island”.
In the case that your target has a lengthy history (particularly of web
activity), it will likely have inconsistencies between apex domains across
parameters like registrars, IP spaces and many more due to the many
various people making various decisions over various time periods and
locations. Due to the shifting needs of an organization and the unique
footprint it weaves across the web, there will never be a perfect solution
to the issue of horizontal domain enumeration. This is not only an
exciting and liberating challenge, but it also creates an opportunity to
63
Dorks can also be against Github to find leaky repos made by forgetful
employees of the targets you are looking for. There’s a lot of tools that
tackle these tasks but since there are a lot of random blobs of numbers
and letters through GIthub, there are a lot of false positives that show
you meaningless information. In my experiments, at least, I haven’t
produced nearly as much interesting or relevant data as when I’ve done
manual investigations and parsed through the code myself. Also, tools
won’t pick up on things that might interest you, such as secret
subdomains, links to private documentation, weird syntaxes that spell
out usernames or passwords and otherwise cool things that won’t be
caught in the filters used by the tool. Tools also can’t understand
context, so something that may not be sensitive via a relevant dork
could still spell out directions to the treasures hidden beneath the
surface. To build your own dorks, here are the most relevant Github
filters:
● filename:FILENAME to search for specific filenames. For example,
the “config.php” file that stores MySQL passwords for Wordpress
sites. You can also do a search like “filename:.php” to search for
all PHP files. Some other interesting ones to search for are
“passwords.txt”, “private.key”, “id_rsa”,
“config.yaml”, “backup.sql”, “dump.db”, “debug.log”,
“error.log”, “credit_card_numbers.csv”,
64
based on the information you find, but it sets a good starting off point
and allows you to progress to the next step instead of getting stuck and
losing faith in reality. So here’s a general outline of things to look for
against your target.
1. Start off the recon by searching for your target domain alone
“drillerkiller.com” (also try sub.drillerkiller.com and drillerkiller,
depending on how many results you’re given). A helpful filter you
can use at this stage is “NOT”, to filter out results that are not
helpful. If you have a domain that produced a billion results, you
can cull the useless ones like so:
Yeah, it works better when you don’t add the “.com” on the NOT
ones for whatever bizarre reason.
disappear after they update their git repo after removing them
from the new version.
3. If you have a ton of results that would be too ridiculous to parse
through, you can chop down results via using keywords, such as
“Jenkins”, “oauth”, “JDBC”, “credentials”, “config”, “pass”,
“secret” and whatever else you think will yield some nice fruits.
I’d also recommend searching for whatever language you see your
target using that is not accessible, such as PHP, C#, Python, Java
or Ruby. Bash can also be a good one to look for, as you may find
start-up scripts or environmental secrets hidden within the code.
4. Next, you can enumerate the employees of your target
organization through finding them on LinkedIn or Twitter.
Oftentimes, employees don’t list their company affiliation on their
Github pages but will be much more open to doing so on
LinkedIn or other social networks.
5. Search in your site’s source code for terms like “github” and
“gitlab” and you might find links to hidden repositories. This can
be done easily within Burp Suite under the “Target” tab or if you
have downloaded all the pages, you can grep through them that
way.
- Always test your discovered secrets to see if they are still valid.
They’re not really worth much if its an expired login, however, you
could still try to brute force some common passwords under the
username, discover username naming contexts or try some
67
- You can also use wildcards like “*.domain.*” in case they have a
“.net” and a “.com” and whatever else for a TLD. You can do this
EVEN if those other TLDs are not in scope (just make sure they at
least belong to your target organization). If you find something
awesome and expresses measurable business impact or an
unacceptable amount of risk inherent without mitigation, then go
forth and write a good report that explains these things without
too much jargon. To the surprise of good samaritans (or VDP
lifers), they will many times accept your findings and reward you.
- Set your search results to “Recently Indexed” to get the most recent
results, for obvious reasons.
For tools that automate this process, the most popular tool is probably
Trufflehog by TruffleSecurity, which has been getting better and better
and continues to be updated pretty regularly. It is pretty helpful as it
scans through all of the past versions of a repository, which would be a
nightmare to do manually. You can grab a release here:
https://github.com/trufflesecurity/trufflehog/releases
One thing that hurts me physically when I use the entropy method is
an avalanche of false positives. I am really glad they eventually added
the feature to turn this off because a lot of useless, but random-looking
blobs like checksums, commit hashes referring to git submodules, file
hashes used for storing mega-files in git-lfs and git-annex and very
boring public keys) get swept up in the results in nauseating amounts.
Anyways, you can turn off entropy if its heuristics are also poisoning you
and you can use a search mode that uses regex instead, oftentimes for
better results.
Gitrob is also really cool and comes with a great interface to parse
through the data it finds. Since there’s a lot of false negatives in any
tools in this area (or even through manual exploration), this makes
crossing off the useless ones much easier and more enjoyable.
https://github.com/michenriksen/gitrob/releases
You’ll also need to designate a Github API token via this syntax. Place it
into the end of your .zshrc file or in your user’s .env file.
export GITROB_ACCESS_TOKEN=GITHUBTOKENHEREBOY
70
Jason Haddix also has an awesome script that will spit out a bunch of
links to Github searches with the dorks pre-ordained throughout them.
This beats typing them and can lead to some easy wins.
https://gist.github.com/jhaddix/1fb7ab2409ab579178d2a7995990
9b33
Here are some links to other resources or tools to aid in your conquest.
Lists of dorks
https://github.com/techgaun/github-dorks
https://github.com/random-robbie/keywords/blob/master/keywords.txt
Other Tools:
https://github.com/BishopFox/GitGot
https://github.com/Talkaboutcybersecurity/GitMonitor
https://github.com/michenriksen/gitrob
https://github.com/tillson/git-hound
https://github.com/kootenpv/gittyleaks
https://github.com/awslabs/git-secrets
https://git-secret.io/
71
Subdomains
I am almost certain you know what these are so we can just get to the
actionable and useful commands that act as the shiny coins on the
silver crumbly part of the scratch tickets that are an organization’s
attack surface. This will definitely be the part of recon that will yield the
most attack surface and as such, has the most techniques, tools and
competition involved. There are teams of people and proprietary
services that will probably always beat us in terms of endless
hammering to discover subdomains, so the secret to finding things that
others haven’t will come down to creative wordlists, obscure services,
making sure your API keys are filled out and anything creative or
non-automated that you can work out. Also, chaining unique
combinations of tools can produce results that others haven’t and
figuring out how the developers behind the domain think and what
shortcuts they may have taken, at the cost of security.
Shodan is better utilized for other purposes but you can still sometimes
get some cool subdomains from it. You can do it either through the
command line tool, mentioned earlier via:
You can also gather domains with a little more success and much
kinder output with the shosubgo tool by incogbyte. For whatever
reason, it sometimes pulls a few more subdomains than the regular
Shodan tool. It’s baffling but acceptable. It can be installed via:
go install github.com/incogbyte/shosubgo@latest
https://github.com/incogbyte/shosubgo/releases/
One other tool I’d like to mention here is wtfis by pirxthepilot. It uses a
handful more API keys than just Shodan but it promises to use as few as
possible of your monthly queries and tries to use the community/free
tiers as much as possible. You can find the repo at
https://github.com/pirxthepilot/wtfis or you can install it via python’s pip:
Usage is simpler than set-up, with the following syntax to find what you
want.
wtfis FQDN_OR_DOMAIN_OR_IP
The easiest way to get started is to search for your domain in the “Hosts”
database
You can also combine search terms with simple boolean operators.
You can also get a pythonic version of Censys for the command line.
Install it via:
To use this in a productive way, you’ll need to grab your pair of API keys
and enter them into the tool.
censys config
The simple way that the Censys command line tool provides a list of
subdomains these days is with the following simple syntax.
Since nothing can truly ever be free, Censys leaves us with a torturous
output that is not compatible with any tools that exist today. So clean
her up gently like this.
To search by organization name, you can get a fat JSON file with a lot of
information, including ASN, IP, open ports and their associated services,
certificate hashes and some more stuff that isn’t super important for
what you’re probably doing.
76
Similarly, you can get Censys to filter out non-living subdomains and IPs
through the following command.
Finally, Shrewdeye has one very awesome feature that every hunter
would be using if they knew about it. Under “Surface Monitor”, you can
drop a list of wildcard domains that you are tracking and receive an
email notifying you when anything new shows up. I’m sure many of
you had a tool, bash script or cron job that was supposed to do exactly
this but somehow it disappeared and you didn’t really care too much to
fix it. Well, now you can truly set it and forget it for free. Enjoy this
feature and don’t tell too many people about it, because once they start
hitting their monthly email limits, they may not be so recklessly liberal
with the availability of these tools.
Here’s a list of some one-liners you can use to query various third-party
passive subdomain enumeration services or slap them all into a bash
78
script. These are all public and available to anonymous access, so you
won’t need to sign up or use an API key.
curl -s
"https://riddler.io/search/exportcsv?q=pld:YOURDOMAINHERE.CO
M" | grep -Po "(([\w.-]*)\.([\w]*)\.([A-z]))\w+" | sort -u |
tee riddler.txt
curl -sk
"http://web.archive.org/cdx/search/cdx?url=*.$domain&output=
txt&fl=original&collapse=urlkey&page=" | awk -F/
'{gsub(/:.*/, "", $3); print $3}' | sort -u | tee
waybacksubs.txt
JLDC
curl -s <https://rapiddns.io/subdomain/example.com?full=1>
The penultimate source for search engines that may pique your interest
and lead to the nuclear devastation of your target organization was put
together by edoardott in the form of
awesome-hacker-search-engines. You could do all your recon in the
browser and if you find some way to rip through a good chunk of these
with automation, scraping and scripting, then god bless your heart (and
please share it with me). There are untold hidden treasures lurking here
and the best of you will discover them. Heed this warning with sincerity
: be careful with this link, it is quite easy to open 666 tabs and spend all
afternoon here.
https://github.com/edoardottt/awesome-hacker-search-engines
80
Certificates
subdomains to parse out that haven’t existed for a decade, but that’s
nothing we aren’t dealing with every minute in this game.
It would be remiss not to mention crt.sh first. You can view the site in
your browser and use the search function (which accepts wildcards
using a “%”, like %.kindboys.com) or query it directly using the syntax
below (with your own domain as a value, obviously).
https://crt.sh/?q=onlyfans.com
curl -s https://crt.sh/\?q\=%25.onlyfans.com\&output\=json |
jq . | grep 'name_value' | awk '{print $2}' | sed -e
's/"//g'| sed -e 's/,//g' | awk '{gsub(/\\n/,"\n")}1' |
sort -u
You can also use Censys, which claims to hold the largest collection of
certificates at over 5 billion certificates logged. Pro accounts are
marketed to organization’s for monitoring their own resources, so the
free account gets you total access to their data.
82
443.https.tls.certificate.parsed.subject.common_name:poundto
wn.com
[443.https.tls.certificate.parsed.extensions.subject_alt_nam
e.dns_names:[fromdariver2daC.com] ]
A tool that does a lot of special stuff under the hood and presents you
with a nice list of IP addresses coupled with their open ports, ready for
further investigation, is projectdiscovery’s uncover. You can conjure the
binary yourself via the method below, which will also set you up with a
default config file in the expected location. Otherwise, you will have to
create it yourself if you go to their releases page, and there’s a lukewarm
chance something will go very wrong (the location it should be found
at is $HOME/.config/uncover/provider-config.yaml though).
go install -v
github.com/projectdiscovery/uncover/cmd/uncover@latest
Uncover works by giving it a query and it will work its mysterious magic
and give you some endpoints; their usefulness ranging across a broad
83
spectrum of value and their origin highly confounding. You’ll want to fill
out as many API keys as you can for this tool, as most of these providers
will not return anything without them. By default, it checks Shodan,
but also has the ability to find hidden attack surface assets through
Fofa, Censys, Zoomeye, Hunter, Quake, Netlas, CriminalIP, PublicWWW
and HunterHow.
Specify your provider or providers with the -e flag and your query with
the -q flag. Queries can be any variety of things from domains,
technologies (i.e. “Jira”, “Nginx”), organizations or even a file with a list of
dorks or subdomains.
uncover -q 'tay-k47.com' -e
shodan,censys,fofa,quake,hunter,zoomeye,netlas,criminalip
You can even use it for passive port finding via the third party services it
queries (not including an engine defaults to Shodan).
Finally, a hyperfast and direct way to chop up, flip and serve
subdomains from a TLS certificate is glebarez’s cero tool. Embodies the
Linux ideals of doing one thing really well and produces results ready
for any pipe you decide to send them through.
go install github.com/glebarez/cero@latest
84
This tool takes domains, IPs, IPv6, CIDR ranges and even non-HTTP
protocol targets as inputs and fires back like an overactive chain gun
shooting the shields off an organization’s attack surface.
cero whitecastle.com
The output will show only the newly discovered subs. You could
also utilize this by piping it to a file and setting it as a cron job, so
you could see which subdomains were newly discovered, or
routing it directly to notify.
hosting all their content on one server, most modern websites pull their
resources across cloud providers, image hosting services, content
delivery networks and official Javascript libraries, in an effort to deliver
content faster through the parallelization capabilities of browsers.
Setting the CSP header to trusted locations is commonly
misconfigured, in addition to some “trusted” services offering anyone
the ability to host arbitrary code, can make the CSP a minor
inconvenience for many malicious actors. However, this is a book about
recon and the assets often listed in the CSP headers can illuminate
more assets that serve to increase our opportunities for finding
vulnerabilities against our target.
Let’s get straight to the point with a tool that gets us there quickly -
0xbharath’s tool domains-from-csp. Without flexing your head too
hard, I’m sure you understand that it does a thing and spits out
domains from the CSP. Install it via the following instructions:
cd domains-from-csp
The tool takes a full URL as its first argument for input and lovingly add
“-r” to resolve the output as well.
You can also directly pull the contents of the CSP header using curl, for
double-checking or integrating into your automation scripts.
Our good boy here also has another tool that compliments and reflects
the prior script. 0xbharath’s assets-from-spf earns its namesake and
delivers exactly what we deserve, some assets from our target’s SPF
(Sender’s Policy Framework). Prepare your terminals, my friends.
git clonehttps://github.com/0xbharath/assets-from-spf
cd assets-from-spf
Fire it off with this simple syntax (add an -a flag if you want ASN
included in the output as well).
One other field that can help you find subdomains, as well as
associated domains for your target (lovingly referred to as horizontal
enumeration by some), is the “Subject Alternative Name” (SAN) field.
This field allows domain owners to add multiple hosts on a single SSL
certificate, so they are generally filled with locations where the domain’s
content is hosted and other domains owned by the same organization.
go install github.com/projectdiscovery/tlsx/cmd/tlsx@latest
There’s more features than nightmares that geniuses like myself suffer
through in a week, but to fulfill our most common recon needs you can
pull relevant SAN data and common name (CN) data via the -san and
-cn flags.
To restrict the output to a list of domains, you can add the -resp-only
only. You can make a cool chain with dnsx to resolve your output and
filter out invalid locations, followed by httpx, to add some more
information, like the site’s title, server type, basic technology and status
code.
https://ui.ctsearch.entrust.com/ui/ctsearchui
89
This service is neat because you can visually see if the certificate is
under a cloud CDN immediately and you can focus on culling the
weakest gazelles in the herd. This service is also known for being a big
snitch, listing off which WAF is being used and other details without
even being pressed too hard! This isn’t even dry snitching, there’s no
plea deal on the table, entrust.com isn’t even charged with anything!!
Absolutely mind-boggling snitching we are witnessing here, just
absolutely disgusting stuff.
And here’s just a few more resources if you aren’t satisfied or feeling
physically ill. Maybe some services are slacking on keeping these
updated and organized, so be proactive and find a favorite you can
trust.
https://developers.facebook.com/tools/ct/
https://google.com/transparencyreport/https/ct/
https://github.com/projectdiscovery/subfinder/releases/
Install via Go, the preferred method for the privileged ones like
ourselves.
go install -v
github.com/projectdiscovery/subfinder/v2/cmd/subfinder@lates
t
Usage should look like the command below. Don’t forget to use a
freshly updated list of resolvers and use the -all and -recursive flags for
maximum output.
deflower the config file with as many API keys as possible, as it will
deliver tenfold the results compared to a virgin copy of the tool. The
default location that amass will search for your config file is
“$HOME/.config/amass/config/config.ini”, in case something is
wonky on your end and you need to fix it.
Definitely make it your goal to find ‘em all, the free ones, at least. It will
literally triple your output here.
https://github.com/Findomain/Findomain/releases/
If you want to be a unstoppable madman, you can also add --pscan for
additional port scanning, -s for screenshots
Shifting gears a little bit, this next tool parses all Github repositories to
uncover mentions of subdomains related to your target. This brilliant
piece of code is known as github-subdomains by gwen001, who has
enriched my toolkit with many awesome tools based on clever ideas
93
that fulfilled needs I didn’t know existed. Install the tool via the
following command:
go install github.com/gwen001/github-subdomains@latest
This tool requires you to have an active Github API token, either in a file
(listing one per line, if you have more than one to use) or via set in your
Linux environment. You can set it for your current session via the
following syntax.
export GITHUB_TOKEN=token1,token2...
Gwen001 also has another similar tool, although it returns much less
output. Albeit, it is mentioned here because in the chance that it finds
something, it will likely be the only tool with that finding and we are
going for total uncompromising comprehensiveness of our recon
methodology. It does the same thing as the Github one above, but
targets Gitlab instead.
go install github.com/gwen001/gitlab-subdomains@latest
Add your Gitlab API tokens (or steal them) and run it with the same
syntax as above.
Listed ahead are some lesser known tools that consistently add
something new to my automated script of around twenty different
94
subdomain enumeration tools. The past few are obviously great but
since everyone knows about them, they won’t uncover the most
obscure paths that you are likely seeking. I have spent countless hours
grinding through Github tools with a seldom few stars to present you
with this information. Let’s fucking go.
https://github.com/hueristiq/xsubfind3r/releases/
Or do it yourself.
go install -v
github.com/hueristiq/xsubfind3r/cmd/xsubfind3r@latest
Installing the tool through this method has the added benefit of
automatically creating a config file for API keys, which is an absolute
necessity if you want to have self-respect while doing these things. If
you grab the binary on its own, you will want to head to Github and
grab the config file, place it in the default location of
“$HOME/.config/xsubfind3r/config.yaml”. The majority of them have
free tiers, although there are a couple that cost money, like intelx.io and
some that are special and elusive, like chaos.projectdiscovery.io (invite
95
only, from the clever demons on the project discovery team). Signing
up for these doesn’t take long and it will probably double the amount of
results you get from using the tool. For API keys that aren’t easily
attained, you can try to steal them from people that accidentally posted
them online.
Free tier:
curl 'https://tls.bufferover.run/dns?q=.YOURDOMAINHERE.com'
-H 'x-api-key: <your api key here>'
Paid Tier
curl
“https://bufferover-run-tls.p.rapidapi.com/ipv4/dns?q=.YOURDO
MAINHERE.com” -H “x-rapidapi-host:
bufferover-run-tls.p.rapidapi.com” -H “x-rapidapi-key:
YOUR_FREE_KEY_HERE”
host=$1
97
techniques to do things that no one has ever done before to create new
dynamic options for potential subdomains (or at least, not published it
openly and indexed it into a search engine), we want freshly
enumerated results or we want to test (and uncover) a naming pattern
we have noticed our results from the passive subdomain testing. .The
main reason, of course, is to increase our attack surface and find things
that have been intentionally obscured, ignorantly forgotten or
otherwise. These barren wastelands that once served packets en masse
to the world tend to be more likely to serve strange and ugly
custom-code projects from decades ago, sites that grab your attention
for their painfully low-resolution graphics or almost hateful use of colors,
in a way that deeply wounds people who enjoy seeing contrast when
they read and subjects the color blind to virulently inequitable access to
information. As with any path you take, but significantly more evident in
cybersecurity fields,
First, let’s talk about zone transfers. Simply put, this occurs when the
data (domain names, IP addresses and more) from one DNS server’s
zone is copied onto another, secondary DNS server. Utilizing the zone
walking technique can uncover hidden or forgotten subdomains,
internal targets without official DNS routing and shed heavenly light
onto the infrastructure of your target.
The following tools come with every Linux system (and Windows) that
I’ve tried so you should have them. If not, I will pray for you.
With dig:
99
With host:
host -t ns zonetransfer.me
With nslookup:
Amass has also been mentioned previously in this book, but here is how
to really push it to the pavement.
These flags will also show you the source of where the subdomain was
pulled from, the IP that each subdomain is connected to, perform brute
forcing of subdomains and also perform alterations on them. Amass is
pretty great as it keeps a database of findings and hit tons of APIs but it
isn’t the fastest bruteforcer.
For bruteforcing subdomains, the best tool I’ve found yet is puredns by
d3mondev. Besides being really fast, it does a couple other cool things
like removing all the unusable characters from your wordlist and
switching everything to lowercase, detects wildcards, built on top of
massdns to query a stupid amount of resolvers and then validates the
final results instead of spewing crap all over your screen. The validation
process is actually a DOUBLE validation from trusted resolvers, so it
avoids all those poisoned ones out there looking to do bad stuff to good
people.
https://github.com/d3mondev/puredns/releases/
go install github.com/d3mondev/puredns/v2@latest
You can also get a really good list of resolvers via this command:
wget
https://raw.githubusercontent.com/trickest/resolvers/main/re
solvers.txt
If you need good and massive wordlists to feed into this tool, look no
further than the links below.
https://wordlists-cdn.assetnote.io/data/manual/best-dns-wordlist.txt
Next, n0kovo created this wordlist by scanning the entirety of the IPv4
space across the world and pulling all the subdomain names from every
TLS certificate in existence. It performs quite well and is around 3
million entries long.
https://github.com/n0kovo/n0kovo_subdomains/blob/main/n0kovo
_subdomains_huge.txt
If you need a smaller wordlist for shorter sessions or not using a VPS like
you should. You can try this good one by six2dez, at about 100,000
entries long.
102
https://gist.github.com/six2dez/a307a04a222fab5a57466c51e156
9acf/raw
VHOSTS
addresses for each domain they own and the associated work involved
with the continental internet registries that reign over them.
one just sucks and the developer should be punished and stripped of
any respect. So, let’s say you find an IP within your target’s owned IP
range and want to test it yourself to see what it’s hosting (generally, port
80 is a redirect to 443 so I jump right to it, but you know, be as thorough
as you feel comfortable with). At the time of this writing, Caterpillar Inc.
is a public program on HackerOne with a wicked huge scope, so feel
free to punch their assets as hard as you want until that changes (FAIR
USAGE and SAFE HAVEN).
nslookup 165.26.57.0
The output from nslookup gives us the green light to probe further.
However, we get served with a 404 when we try to check the site.
curl -i -k https://aemha-intweb.cat.com
We can try messing around with things here in a few ways. We can try
to pull the URL by using its real IP address and see if we get a different
response. This will help us to verify that the server is storing multiple
sets of content and using information from the request to decide where
to send the client.
curl -i -k https://165.26.57.0
pragma: no-cache
content-type: text/html
This is one spot that many pentesters arrive at and believe they have
exhausted their options on this endpoint. You can continue probing
this with a nice list of potential subdomains that you can insert into the
host header and check the responses for differences compared to
requesting the IP on its own, as well as deviations from responses sent
to the subdomain you are trying to resolve.
So you can automate this a manual way with some bash scripting or
use a handful of tools, though I have gotten varied results, so I make
sure to use a few tools, double check any positives and manipulate a
few things in the requests to see if I can get something interesting to
return. Still using the same IP address in the examples above, I added
my specified host header into the request.
106
Output:
HTTP/1.1 200 OK
curl -i -k signs.cat.com
Output:
Server: rdwr
Content-Type: text/html
nslookup signs.cat.com
Output:
Address: 66.22.73.126
curl -k -v terminal.ecorp.cat.com
Output:
* Closing connection
Is it really unresolvable?
108
nslookup terminal.ecorp.cat.com
Output:
Server: 108.61.10.10
Address: 108.61.10.10#53
curl -i -k https://165.26.57.0 -H
"Host: terminal.ecorp.cat.com"
Output:
HTTP/1.1 200 OK
x-frame-options: SAMEORIGIN
accept-ranges: bytes
go install -v github.com/wdahlenburg/VhostFinder@latest
110
Absolutely include the -verify flag in every scan. Finally, if you have
multiple domains belonging to a target and you want to fuzz a list of
subdomains across them, you can do the following.
https://github.com/tomnomnom/unfurl/releases/
go install github.com/tomnomnom/unfurl@latest
Unfurl gets daily use from me, along with Tom’s other tools like anew,
urinteresting, httprobe, gf and more; many of which will make a quick
appearance in this tome.
Jobert Abma, co-founder of HackerOne has a neat tool for this that has
existed for a while and can be found here:
https://github.com/jobertabma/virtual-host-discovery
go install github.com/hakluke/hakfindinternaldomains
Permutation
Once you have a decent list of subdomains for your target, another
technique we can use to uncover esoteric attack vectors is the
mutation, contortion and disfigurement of current subdomains. Since
there’s a gang of tools and they possess some differences in how they
vomit forth wild and twisted perversions of your current list, I think it is
worth checking out a bunch of them and writing an automation script
that will chew and mangle your current list via each tool. Though their
internals are varied, their purpose and output is fairly similar, so I won’t
spend too long talking about them and just hit you with the parts you
need to start ripping and resolving your guys.
api.wrinkles.org
skinbags.wrinkles.org
shame.wrinkles.org
115
dev
morbid
420
Gotator, a tool that brags about being able to stuff over a million
mutated subdomains within two seconds is written in Go (which is
good) and is a staple in every recon session I’ve done for a while now.
And also, so are the rest of these tools I’m going to show you, because
they are all in a script together for maximum attack surface expansion
madness.
go install -v github.com/Josue87/gotator@latest
116
The one-liner above is pretty good, but here is what the arguments
mean if you want to experiment with them yourself.
-md Uses input from your subdomains file and includes it in the
permutations, so dev.api.boiledalive.com would churn out
dev-api.api.boiledalive.com, api.dev.api.boiledalive.com and more.
Next, let's rip through a tool called ripgen, another tool that creates
permutations. My simple one-liner for using this tool can be seen below.
go install github.com/subfinder/goaltdns@latest
Since a lot of these permutation files have massive output and I’m
definitely not trying to keep a massive list of 5 million fake domains
making my laptop heavier by stinking up my hard drive, you should
118
avoid even letting these touch down in a file, instead opting to pipe
them directly into a DNS resolver and saving only the valid subdomains
you discover.
Assuming you already have a big, stinky and bloated file of fake
subdomains, you can use the hyper-fast puredns by d3mondev to start
cracking them open.
119
Now you can drill through these bad boys, save the valid ones it spits
out and delete all these big, nasty files that serve you no purpose
anymore.
You can also pipe the permutation tool’s output directly into puredns,
so all those hideous subdomains never need to touch your hard drive.
go install -v
github.com/projectdiscovery/dnsx/cmd/dnsx@latest
https://github.com/projectdiscovery/dnsx/releases/
Finally, you can knock out both brute forcing domains and permuting
at the same time, you can check out bp0lr’s tool dmut.
go install github.com/bp0lr/dmut@latest
subdomains. You can use this built-in feature to invoke a fresh rotation
of them that saves to ~/.dmut/resolvers.txt via the following
command:
dmut --update-dnslist
If something goes wrong for whatever reason, you can always access
the files it pulls here: https://github.com/bp0lr/dmut-resolvers
And if those ever stop their continuous rotation of fresh resolvers, this
seems like a pretty solid bet for the time being:
https://github.com/trickest/resolvers
capsized. Essentially, you will be more likely to find an easy meal with
less than typical effort. Some strong signifiers include visually dated
web sites (you’ll know when you see it, the lack of web fonts, color
palettes that make your tummy hurt , CSS only capable of creating
rectangles everywhere and the corners on text boxes are so sharp your
screen’s pixels unalive themselves trying to render them), ancient
messages found in the site’s footers (“All Rights Reserved 2002”) or
outdated authenticated methods (any 401 status codes). Old
frameworks are likely not updated and may have CVEs that have been
festering in their bones for many years. If you see functionality that has
many opportunities for lots of tests, such as registration, password reset,
logins, file uploads and an abundance of customizable content, that
subdomain elevates itself on the priorities list. After many successful
years of hunting, zseano likes to target very large organizations that
likely have many teams, oftentimes in internationally different locations.
If these diverse teams are writing code in separate places, at separate
times and there is some functionality that merges these two code
bases, the lack of communication and incongruent work practices will
likely produce pieces that don’t fit perfectly together.
Content Discovery
For whatever purpose, these benevolent actors spy on everyone all the
time and release the data to anyone that wants to see it. They are
usually eternally growing, with some even storing the same page over
and over across arbitrary time periods, like archive.org.
go install github.com/tomnomnom/waybackurls@latest
125
Usage is quite simple and ready for pipe travel, just throw whatever
domains you want at it.
From the list in the image above, you can use wget or curl to pull any or
all versions. A quick bash loop to accomplish this could be:
Essentially, you’d just pipe the output right into concurl and be done
with it (the -c flag means concurrent download streams, which
126
shouldn’t be set too high in this situation, as archive.org does give out
some short IP blocks, though they are fairly generous with their server
limits)
To pull just URLs (otherwise, the default will pull URLs and responses):
The URLs will be automatically saved into the folder that waymore was
download to, under ./results/domain.com/. It’s important to be
aware of how much content your target has as it can be an
unreasonable amount of hammering against the API providers and
your own machine (for example, Twitter.com would pull 28 million
pages of content). You can remedy this situation and come out with
something that doesn’t put you on suicide watch a few different ways.
- You can use -l [integer] to limit the amount of responses that are
saved. The default is 5,000, while 0 means unlimited (as in, all of
them). A positive number of 500 would download the first 500
results, while entering -500 would download the 500 most recent
results.
- You can use the -ci [h/d/m] flag for designating preferred capture
intervals to hourly, daily or monthly. For example, if set to
monthly, it would only download one response per month,
regardless of how many versions are saved on archive.org.
- You can use -mc [status-code] to only download responses that
match a certain status code, i.e. 200 for valid responses.
- You can use the -ko flag, followed by a regex value that the
response must match in order to be stored. For example, to pull
only the JS files, you would type “-ko ‘\.js(\?|$)’” as an
argument.
128
There’s even more ways to limit the potential avalanche of results this
tool can suffocate you with, such as limiting the CommonCrawl
databases it will parse, setting limits on beginning and end dates (no
data before 1997 will likely still be available on any server in its
unchanged form) and more. It’s an incredibly valuable and deep tool
and I highly suggest you check out and alter the config.yml file that
comes with it to really customize the data output you’re looking for.
Ok, there is one place that waymore doesn’t pull URLs from and that is
across all Github repos. Fortunately, there’s an app for that, gwen001’s
github-endpoints. As with his subdomain extracting tool, set-up some
Github API tokens into a file, one-per-line and you are good to go.
go install github.com/gwen001/github-endpoints@latest
Also, this tool is great when you need a super fast list of URLs and has
been a staple in my arsenal so it would fill me with a feeling of
incompleteness if I didn’t mention it; gau by lc.
go install github.com/lc/gau/v2/cmd/gau@latest
The syntax is simple, though I always include a couple flags to filter crap
out of my results.
129
Install it via:
go install -v
github.com/hueristiq/xurlfind3r/cmd/xurlfind3r@latest
130
This tool also has the ability to take a list of domains as an input (-l
list.txt) , can parse a domain’s robots.txt files from the Wayback
Machine (--parse-wayback-robots) and even the source files of past
versions (--parse-wayback-source). You can also filter by regex, for
example, to pull only JavaScript files from the output.
paramspider -d boltthrower.com
Your output is automatically saved and parameter values are filled with
“FUZZ” as a default. If you want to swap the value for something else
use the -p [FUZZ-value alternate] syntax. A potential use could be
dropping in a XSS payload and then piping it to httpx with a matching
131
response regex to only see the URLs that reflect your payload for your
output.
paramspider -d 20buckspin.com
-p %00%00%00%00%00%00<script>alert(313313313)</script> |
httpx -silent -mr 313313313
Those few tools combined should get you a sweet set of scraped URLs
to start the endpoint enumeration game with. Combing through
online resources is only part of it and there’s plenty of hunters that just
run “waybackurls domain.com” and nothing else. That is not the way.
Alienvault.com:
curl -s
"https://otx.alienvault.com/api/v1/indicators/domain/domain.
com/url_list?limit=100&page=1" | grep -o '"hostname":
*"[^"]*' | sed 's/"hostname": "//' | sort -u
Archive.org:
curl -s
"http://web.archive.org/cdx/search/cdx?url=*.domain.com/*&ou
tput=text&fl=original&collapse=urlkey" | sed -e
's_https*://__' -e "s/\/.*//" | sort -u
132
Commoncrawl:
Part two of the endpoint expansion saga will discuss the well-known art
of spidering. Spidering works in much of the way that search engine
bots index the internet; you feed it a page and the spider extracts all the
links from it. Then each of those links is visited and the subsequent
page is scanned for links. You repeat this until you discover the entire
internet or run out of new places to look. This is generally done
automatically, though doing some of it manually can give you a much
better understanding of the functionality and organization of the web
app you are testing.
For very basic smooth brain manual spidering, I like to use a browser
add-on called “Link Gopher” that spits out a swath of links inherent to
your current page.
Chrome:
https://chromewebstore.google.com/detail/link-gopher/bpjdkodgnbfalg
ghnbeggfbfjpcfamkf?pli=1
133
Firefox: https://addons.mozilla.org/en-US/firefox/addon/link-gopher/
person I’ve heard really go into this so I’ll just briefly touch upon it so
you can catch a buzz and go to the source for the full dose.
1. Turn on Burp Suite, open up your proxied browser and collect all
the requests and whatever they happen to suck up along with
them. (Don’t discriminate or scope gatekeep!)
2. Turn off passive scanning, we’re just sucking up buttloads of
endpoints here. For scope, turn on advanced mode (regex) and
just use the keyword to filter endpoints (for example, just do
meatballs instead of meatballs.io).
3. Spider yourself as much as you can across your target domain and
then spider all the wonky hosts you picked up (with the spider
feature, not manually this time). You can also highlight all the
hosts that are in scope and send them to one of the spidering
tools I’m mentioning in a couple shakes of a lamb’s tail (katana,
gospider, hakrawler).
4. You can also highlight anything that looks relevant and right click
to “Copy Links in Selected Items”.
135
To export all this data, you can hit “Engagement Tools” > “Analyze
Target” or save the output as an HTML file. Honestly, there isn’t a super
clean way to interpolate the data from this into your current
methodology or plans for automation but you can end up with a ton of
extra places to look, which is awesome if you have a huge scope.
Now, let’s get into spidering with tools. There have been a couple
classic spiders for years but recently, projectdiscovery’s katana has been
my go-to champion that was immediately integrated into my scripts.
Here she is, fellas.
go install
github.com/projectdiscovery/katana/cmd/katana@latest
136
katana -u https://moronbrothers.org
But I hope you are far and above this type of behavior by this stage of
the book. If not, I guess you can just live in the hell that you created for
yourself and when you’re ready to pull yourself out of it, do that and
send me a message to let me know how you did it.
You can also set its spidering strategy, tighten and loosen scopes and
some more wild features. This tool is still pretty fresh so I’m sure it will
have consistent additions of new features but this is a very righteous
origin story. There’s other great tools in this lane as well, like Gospider
by jaeles-project and hakrawler by hakluke, both of which I used
extensively for years and had no issues with. After doing some test runs
against katana, the results were fairly close but katana edged ahead.
I’m going to assume it's because of the features that other crawlers
don’t have, like integrating the Javascript parsing capabilities of jsluice
to conjure and feed itself new potential endpoints, the experimental
form-filling capabilities and the flexible headless crawling that hasn’t be
challenged or even imitated in the current offensive web crawlers
landscape. The ingenuity and execution of some of you human beings
never ceases to amaze me. Well, we live in a society.
138
something like httpx or fff to weed out all of the bad endpoints (cat
urls-gathered.txt | httpx -mc 200,302), though I think katana
should’ve done all of that if you feed the third-party lists to it as your
input. Once you have this list, you can pull all the JS files from it with
the following command.
To make sure that none slipped through the cracks of reality or ended
up somewhere chaotic, I like to run my URL guys through a tool called
getJS by 003random. Install away, my friends.
go install github.com/003random/getJS@latest
You feed it your URLs and it will extract all the JavaScript files within
them for you.
The --complete flag will make the tool print full URLs rather than the
paths, --resolve ensures that only valid, accessible endpoints are output
and --insecure will allow the tool to work in spite of some potentially
grotesque certificate upkeep habits on your target’s side. I’d also
recommend that you don’t be too exclusionary at any stage in the JS
enumeration segment with cutting out URLs that don’t appear to be in
scope. Many times, organizations host JavaScript files on CDNs, cloud
hosting services, Google Analytics and more, yet they are still unique
files specific to your target, rather than a generic JS library file that is
shared across the entire internet (there are those also, and they will
140
bloat your data and waste your time, but you cannot sacrifice some
good boys just because of this).
After spending considerable time and effort into finding and separating
our JavaScript files, let’s get to choppin’. This is an area where the more
time you spend staring at these walls of (often hideous) code, the more
rewarded you will be. It's OK if you don’t want to do that, because
there’s another path with less rewards, however, it is presented with less
required suffering. You can use tools to pull the obvious things out, but
it's likely a handful of talented young hunters have already spun the
141
block on these endpoints before you even got invited to the program.
Let’s break down some methods for parsing these guys.
- More endpoints. You can grep for basic slashes “/”, protocols
“https://” or parts of paths like “/api” or “/users”. API calls
will often be connected to HTTP methods (“POST”, “GET” or
simply the word “method”) or connected to strings like
“send(“ and “api”. Endpoints sometimes mention the
headers required in the request for a successful response, so
you can also grep for strings like “Content-Type”,
“setRequestHeader” and “.headers”. Finally, searching the
JS file for your target’s domain name can point you towards
hidden subdomains and endpoints too.
- Parameters. Javascript files will often describe how an
endpoint should be interacted with and what parameters
are needed for a successful API call. Grep for strings like
“parameter” and “getParameter()”, or even specific
parameters connected to vulnerabilities, like “return=”,
“redirect” or “url=”. You can also add “var “ and then test
the name of the variable against any relevant endpoints with
various injection vulnerabilities.
- Leaky treasures such as API keys, tokens, secrets and
credentials. You can use various tools or grep for these
yourself with terms like “secret”, “admin”, “token”,
“passw”, “debug” and more.
143
- First, a simple one-liner that will pull the very obvious endpoints
from your JS file.
-e "\e[1;33m$url\n\e[1;32m$vars"; done
Of course, you can replace assetfinder and gau with “cat urls.txt” or
something similar if you already have a good list to work with.
go install -v github.com/kacakb/jsfinder@latest
go install github.com/0xsha/GoLinkFinder@latest
- EndExt by SirBugs is one I really like for its purity and simplicity. Clone the
repo and then build the go script into an executable file.
146
go build main.go
mv main /usr/local/bin/endext
Now you can run it from anywhere via:
endext -l js_files_urls.txt
You just feed it a list of JS endpoints and it sends out a list of nicely
formatted links
- xnLinkFinder by xnl-h4ck3r
(https://github.com/xnl-h4ck3r/xnLinkFinder)
Probably the most intense tool for finding URLs and has the
fattest output as well. Clone the repo and install via python3. The
most basic usage is as follows:
Both the -i flag (followed by a list of JS URLs) and -sf flag (followed
by in-scope domain) are required.
You can also insert a Burp Suite save file.
The -sp flag is for scope prefix, to remove all the trash that browser
proxies absorb from all over the internet and -inc will include the
input links in the output as well.
147
- Jsluice by bishopfox
This tool appears to have made a quick rise in many bug hunter’s
toolkits and from a look at its impressive code, it is pretty deep,
versatile and quite impressive at catching weird edge cases or
unique JS attributes and parsing them successfully.
Installation is done through go:
go install github.com/BishopFox/jsluice/cmd/jsluice@latest
It has multiple modes but the most useful for me is the URL
extraction one. Syntax can be seen below:
There is a lot more information you can parse through via the
official Github page (https://github.com/BishopFox/jsluice), as well
as a series of blog posts beginning on the BishopFox blog.
https://bishopfox.com/blog/jsluice-javascript-technical-deep-dive
148
- jsleak by byt3hx
A quick tool to easily insert into your automation is the simple and
effective jsleak, install as below:
go install github.com/channyein1337/jsleak@latest
It can be used to pull links via -l (extract the superior full URLs with
-e instead) and secrets via -s.
go install -v
github.com/edoardottt/cariddi/cmd/cariddi@latest
I like to max out the tool to its ultimate effectiveness, which can
make a large domain take quite a while, as it crawls, parses and
crunches endlessly. The key to ultimate power with cariddi is the
following:
The -oh flag saves the output as a nice HTML file, -rua uses a
random user agent to avoid being banned by some servers, -e for
juicy endpoints, -s for secrets, -err for hunting for error messages,
-info for interesting information and -c for concurrency, set to a
vindictive and cruel level of 200 simultaneous palm strikes to the
target server.
set it up myself by altering the script and it was still messy (due to
my failures, not KathanP19’s). While in the repo’s folder, enter:
The -r and -o flags create the report and include all findings in an
automatically generated output directory, while -l points at your
target list. This one does pretty much everything you would ever
want your JS punching toolset to accomplish.
Since you made it this far, I’ll toss you some info on a tool that can make
you very lazy but I think you’ve earned it. Scripthunter by robre
combines and automates multiple JS hunting tools and features into a
simple and direct bash script for you to blast your targets with. Clone
the repo at https://github.com/robre/scripthunter and make sure you
have the required tools it needs to run (or not, you’ll discover they are
missing extremely quickly). This is a sweet tool that pulls JS files from a
few third-party URL stockpilers, then does a bit of spidering, a bit of
151
fuzzing and some analysis. The fact it uses custom wordlists already
goes beyond 90% of hunters and the way it absorbs data, digests it and
creates more data to feed itself with is reminiscent of my spirit animal,
the ouroboros, so I am naturally drawn to its magnetic energy.
Clone the repo and run the tool with this simple syntax:
./scripthunter.sh https://voidwanderer.com
One drawback to this tool (and all automated tools) is an issue that is
known as the “Christmas Lights Conundrum”. With some cheaper
brands of Christmas lights, when one bulb breaks, all the following
bulbs decide to unalive themselves too. Similarly, automated
methodologies and frameworks have the potential for something to be
a tiny bit wonky with your target and it derails one portion of your chain,
causing everything after it to wither and die. For example, the
spidering portion might not know how to parse some weird technology
on the first URL it tries, decides it's done and feeds an empty output to
the next tool, continuing this sad chain of passing empty data all the
way to your text editor where you excitedly awaited some interesting
results. When you have the benefit of doing this work one bloated
pipe-heavy terminal command at a time, you can catch these unique
intricacies and adapt to them immediately, saving yourself from being a
detective that follows the trail of empty text files backwards to where it
all went wrong in your bash script.
152
You should check if the API key you found is still valid before you report
a useless and expired (or worse, intentionally public and harmless) key
to spare yourself time and humiliation. There’s a great repo called
keyhacks (https://github.com/streaak/keyhacks) by streaak, that is
essentially a cheatsheet for tons of different API keys and checking their
validity, typically with a quick curl request. There’s also an interactive
version here (https://github.com/gwen001/keyhacks.sh) by gwen001 that
is nice to have ready to fire off in your arsenal.
If you find a Google Maps API key, I’d recommend you enter it into
ozguralp’s gmapapiscanner, which will tell you the various methods
the key can be abused or not. Unfortunately, reporting this vulnerability
is hit-or-miss depending on the program, I have seen people get decent
bounties and I have also reported it, with a thicc report that clearly
shows examples of me burning through $3 of credits in seconds but
they didn’t find it too worrying. There’s been some changes to the
terms, usage and settings in the past few years by Google, that has
changed how some programs view the business impact of the bug. It
can definitely be abused to waste money, burn through monthly credits
and barricade customers from using the Google Maps functionality in a
web app. This isn’t too important if it's just the mini-map on the
153
“Contact Us” page but for a rideshare or food delivery application that
incorporates it heavily in their workflow, a denial of service to the map
integration could be tragic.
Elucidating these bad boys is now trivial through this feature in Chrome
browsers and I’ve never seen any hunters mention it.
https://sokra.github.io/source-map-visualization
unmap ./app.js.map
The tool will output a list of URLs extracted from the source map,
although it is slightly silly because they will be prepended with your
current directory.
`'"’¯\_(ツ)_/¯`"’
155
For example, did you know that Google Docs is written in Java?
this. Maybe”.
The new developer let out a weak laugh that probably sounded like a
sigh. Now that the chronologic expectations involved in the passage of
time, all narrative restraint and divisions across literary genres had
seemingly been lost, he could gladly without a need for understanding
its purpose. His faith had never been stronger.
If you looked too quickly, you might have missed the part where it says
“100,000 URLs” but I didn’t and I got right to work preparing one by
combining lots of bounty platforms and parsing various scopes
together into a 100K megascope. So I’ll spare you the penance and let
you know that this sassy piece of code is very sensitive, dropping errors
that cannot be ignored if one of your 100,000 subdomains has a comma
in it or is prepended with “http”. It could just ignore that line and keep
it moving, but it forces you to go back into the file, edit it out and
resubmit, only to be fed where the next problematic line happens to be.
The best part was when I put that whole list together after 25 minutes
before it hit me with an error saying “Free users can only track 50
subdomains”. I had no choice but to do a 360 degree pirouette and
moonwalk away from my computer.
Overall, this tool is quite good, maybe the best at what it does, but
160
power like this doesn’t come without a price and I paid for it with a
double scoop of horror and anguish.
My great adoration for httpx reappears, as you can add the -td (or
--tech-detect parameter) and get a nice little blurb about your target’s
server, framework, CMS - though that is not this tools intended purpose
but it is useful when you’re feeling lazy or have a lot of info to parse
quickly. If you annihilate it with parameters like I always do, you get a
good starting point on its tech. Here’s a random, recent example below:
You can find my primitive and extremely based httpx script that
resolves, fingerprints, splits output into clean, pipe-ready files based on
status code and usage at the link below:
https://gist.github.com/scumdestroy/c95622e426f52ed497f1483926ffb4bb
whatweb -a 3 analogworship.com
Whatweb is a forgiving beast, you will make whether you include the
full URL or just the domain. You can also use -iL list-of-guys.txt to
fingerprint a list of domains or whatever you have in there.
go install
github.com/praetorian-inc/fingerprintx/cmd/fingerprintx@late
st
fingerprintx -t praetorian.com:80
fingerprintx -l input-file.txt
For reasons I don’t fully understand, I always gravitate towards this neat
little guy called webtech. You can install webtech through pip:
162
webtech --update-db
Then we keep our brains smooth and not risk reading a single word in
the README file, because its as easy as this:
webtech -u werewolf.fi
webtech --ul list-of-questionable-online-vendors.txt
If you’re into having more control than expected, you can add --rua for
random-user-agent or --user-agent “Broken Microwave, Made in
Germany 1939” to keep the WAFs on their toes. I’m sure most have
never faced a nearly century-old microwave, powered by the dreams of
men overtaken by occult power fantasies and focused that chaotic
energy into such an impressively engineered microwave.
163
path)
2. Use custom wordlists created by sourcing things related to your
target.
3. Use targeted wordlists based on fingerprinting your target’s
server, framework, technology, target industry (financial, medical,
tech). For example, after fingerprinting your target, you’d use an
Apache (server) wordlist, a Wordpress (CMS) wordlist, an API
wordlist and relevant language wordlist (PHP for Wordpress).
https://github.com/0xPugazh/fuzz4bounty
https://github.com/Karanxa/Bug-Bounty-Wordlists
https://github.com/berzerk0/Probable-Wordlists
https://github.com/trickest/wordlists
https://github.com/danielmiessler/SecLists
http://wordlists.assetnote.io/
https://github.com/six2dez/OneListForAll
If you grabbed all the above, you are probably set for life.
Just supplant them with your own creations.
Share them only after you have exhausted them on every
bounty program in existence though!
domain.com/assets/js/FUZZHERE.js or
domain.com/static/js/FUZZHERE.js.
● Documents (xls,xlsx,doc,docx,pdf,…). Again, default or custom
wordlists work best here with the extension flag added. You can
then take it further by scanning for more details with exiftool
(“exiftool -a weakdoc.docx”). There is also metagoofil by
opsdisk (https://github.com/opsdisk/metagoodfil) that automates
some of this process for you through dorking but you’ll need to set
up some proxies to choose this route because Google likes to
violently force feed anyone acting slightly suspicious with
Captchas.
repolist -u “https://github.com/octobercms/october” -o
octobercms_wordlist.txt
167
You can even pipe it into ffuf, to immediately use it as your wordlist..
If you want to trim some useless fat, you can stick to a certain branch (-b
BRANCH_HERE) or just directories (-d) or files (-f) exclusively.
There aren't too many hidden gems to guide you towards where hidden
parameters reside, as they can potentially hide in any endpoint. Using a
bit of deductive reasoning and experience, you’ll pick up a sense for
looking at the more interactive endpoints to target. There probably isn’t
much point to fuzzing every single blog entry for new parameters as
you’ll typically get the same useless results, but endpoints that involve
customizable features, ancient code and the usual horrorshow locations
that other vulnerabilities tend to reside are best. You always have the
option to be a madman and fuzz every endpoint too.
go install github.com/ImAyrix/fallparams@latest
https://github.com/Sh1Yo/x8/releases
x8 -u https://kvlt.fi/endpoint.php -w params.txt
169
The output of this tool is excellent as well, as it shows you how the
addition of the newly discovered parameter changes the
content-length of the response, the status code and whether the
parameter’s value is reflected as well.
arjun -u https://drakkar666.com/endpoint.php
Fuzzing Headers
Primarily used for finding bypasses to 401 and 403 status codes,
there are some neat tools that make this easier and also include some
bypasses that don’t involve fuzzing headers.
● https://github.com/gotr00t0day/forbiddenpass
● https://github.com/lobuhi/byp4xx
● Burp Suite’s 403 Bypasser Extension
admin:password
manager:secret
guest:guest
Administrator:changeme
Then you just need to base64 encode each line and use it as your
fuzzing wordlist in Intruder or ffuf. Put as many as you feel is
reasonable - generally mixing and matching 100 common usernames
to 100 common passwords will leave you with 10,000 requests. I’ll let
you decide if that’s OK to fire at your target, no judgments on my end.
No one should have to do this manually and if you don’t even want to
learn how to automate this process, that is totally fine too.. Probably not
the ideal attitude to hold in this field, but again ,no judgements.. Just
use this top secret script I made instead..
172
https://gist.github.com/scumdestroy/219ff280392dbab1923e4f6024d583
ee
Gather your users list and your password list and run it like this:
You can also try to search for the unique identifier, a public (or private)
API key you discovered on Google, Github, Gitlab or the aggregate code
harvesting search engines.
174
One service you can search directly for a Google Analytics tag is
SpyOnWeb (https://spyonweb.com/) and find related subdomains or
domains owned by the same organization.
This section will discuss a few ways you can leverage various tools and
services to discover hidden assets your target may be utilizing.
Sometimes, in bug bounty, these won’t be explicitly mentioned in the
scope details, however, if you find something that shows a gross
violation on user privacy or sensitive information that can be used to
damage an organization’s reputation, trust or digital assets, they will
generally reward you for providing this information to them.
The main providers of cloud assets are Amazon’s AWS, Google’s GCP
and Microsoft’s Azure and you can occasionally use dorks to find your
target’s cloud assets.
site:http://s3.amazonaws.com “target[.]com”
site:http://blob.core.windows.net “target[.]com”
site:http://googleapis.com “target[.]com”
site:http://drive.google.com “target[.]com”
175
You can also try these dorks without adding the “.com” suffix, just be
aware that not everything you find will be related to your target so use
your best judgment and an elevated form of common sense before you
hype yourself up for disappointment.
A killer service that is essentially a Shodan for cloud assets is Gray Hat
Warfare, who provide an impressive and extensive S3 bucket database
you can search at https://buckets.grayhatwarfare.com Using the free
version of the service shows you a fraction of the results and you’ll often
be teased with hundreds or thousands of locked bucket assets.
I’m sure your mind is thinking, “I’d like to download every IP address
belonging to a cloud provider and scan their entire range for hosted
content relevant to my interests”. Luckily, that is exactly what I’m about
to show you how to accomplish.
Once you have those saved to your local workspace, you can run
through them and extract whatever domain you are targeting with a
one-liner like this:
sort -u
You can also get a list of IP ranges from Amazon themselves, then use it
for your own processing to discover assets.
https://ip-ranges.amazonaws.com/ip-ranges.json
From here, you could pull all of the US based ranges used for hosting
with the following command.
jq -r '.prefixes[] | select(.service=="EC2") |
select(.region=="us-*-*") | .ip_prefix' < ip-ranges.json |
sort -u > us-aws-ranges.txt
Next, we can feed it to masscan and rip all of the “HTTPS” resources into
a neat file.
Finally, we can send it to a tool like tlsx and end up with our own list of
domains to query locally at our convenience and discretion.
With this list, we can now easily grep for our target organization from it.
177
There’s also various tools that will search S3 buckets for you, based on a
keyword. This is very similar to subdomain scanning and can end up
with some neat finds. Misconfigurations used to be viciously rampant
in this area, due to some very insecure default settings but a few years
ago, Amazon realized that many of their customers are smooth brains
and catered to them by changing this. Still, some people go out of their
way to make their assets insecure and there are still interesting things
being discovered here once in a while. There’s a lot of tools for fuzzing
the internet for S3 buckets, most of which are not in active
development since AWS increased their security standards, but I’ll note
a couple cool ones here.
Redhuntlabs’ “Bucketloot” is a few levels above the rest, with its ability
to scan through AWS, DigitalOcean, GCP and custom domain bucket
resources with a thick list of regexes that will alert you to interesting
and sensitive discoveries. You can get it at:
https://github.com/redhuntlabs/BucketLoot
Add the “-enumerate” flag if you want the tool to parse all the contents
of discovered buckets as well.
179
For this final section, I’ll drop some juicy recon lore that didn’t fit super
cleanly into any other section of the book. Thanks for reading this far
and I hope your baskets are filled with low hanging fruits for a long and
prosperous time.
- Not exactly sure where to fit this recon tip but I think it will be the
underdog golden goose for someone on some day, though I
haven’t figured out the specifics yet. If you were attuned to the
same vibrational frequencies as me, you’d know this thing will be
significant (just not in an overwhelming majority of scenarios). It’s
a search engine with a unique filter, called MillionShort
(https://millionshort.com/). It removes the first one million
commoner normie results from your search, because nobody is
browsing or subtractive-dorking their way to the contents found
on page 10,000. Maybe use this to find some very
common-sounding but actually very rare subdomains of
181
Check Acquisitions
- bgp.he.net
or autonomous_system.name:"ORGANIZATION"
- zoomeye asn:XXXXXX
- Fofa: asn="XXXX"
Reverse Whois
- whoxy.com/reverse-whois
- gwen001's "related-domains"
- asnmap -d domain.com
- ImAyrix's "cut-cdn"
Ports
- masscan
- nmap
184
- naabu
- rustscan
Shodan
- ssl.cert.subject.cn:"domain.com"
- ssl:"Organization Inc."
- http.favicon.hash:XXXXXXXX
- nrich
Censys
Nelas.io
Fullhunt.io
- http_favicon_hash:XXXXXXX
- domain:domain.com
Onyphe.io
Viz.Greynoise.io
Analyzeid.com
Dnslytics.com
185
Google Dorks
- site:domain.com -site:www.domain.com
Github Dorks
- Manual searching
Subdomains
Passive Discovery
Certificates
- crt.sh
186
- cero
- ui.ctsearch.entrust.com/ui/ctsearchui
ProjectDiscovery's "Uncover"
- Zone Transfers
- Brute Force
- Permutations
- VHOSTs
Content Discovery
- Spidering website
187
Fingerprinting
- General wordlists
- Fuzzing Parameters
- Misc Tips
RESOURCES
Hahwul https://www.hahwul.com/
“Hahwul” at Github, Twitter and Hackerone.
Jason Haddix
Jhaddix at Github, Twitter
https://www.youtube.com/c/jhaddix
Zseano https://bugbountyhunter.com
Zseano at Github, Twitter, Hackerone
https://www.youtube.com/c/zseano
https://zseano.medium.com/
hakluke https://hakluke.com/
Hakluke on Github, Twitter, Youtube and Medium
Harleo https://harleo.me/
Harleo at Github
_harleo at Twitter
Gwen001 https://offsec.tools/
https://10degres.net
190
Gwen001 at Github
Gwendallecoguic at Twitter
Trickest https://trickest.com
Trickest on Github
Trick3st on Twitter
Six2dez https://pentestbook.six2dez.com/
Six2dez on Github
Six2dez1 on Twitter
Six2dez_ on Hackerone
Dwisiswant0
Dwisiswant0 on Github, Twitter, Medium and Hackerone
Nahamsec https://nahamsec.com
Nahamsec at Github, Twitch and Twitter
https://www.youtube.com/@NahamSec
Tomnomnom https://tomnomnom.com/
Tomnomnom on Github and Twitter
Owasp-amass https://owasp.org/www-project-amass/
Owasp-amass at Github
Nitefood
Nitefood at Github
Imusabkhan
Imusabkhan at Github
Musab1995 on Twitter
https://www.youtube.com/musabkhan
https://medium.com/@imusabkhan
M4ll0k
M4ll0k on Github, Twitter, Bugcrowd and HackerOne.
KathanP19
KathanP19 on Github, Twitter and Medium
Xnl-h4ck3r
Xnl-h4ck3r on Github, Twitter and Youtube
191
Devanshbatham
Devanshbatham on Github
0xAsm0d3us on Twitter
ImAyrix
ImAyrix on Github and Twitter
Robertdavidgraham
Robertdavidgraham on Github
Vulnerscom https://vulners.com/
Vulnerscom on Github and Twitter
Viralmaniar
Viralmaniar on Github
ManiarViral on Twitter
Jakejarvis https://jarv.is/
Jakejarvis on Github and Twitter
Sushiwushi
Sushiwushi on Github
Sushiwushi2 on Twitter
https://sushiwushi.notion.site/Richie-s-Audit-Portfolio-ecac81e9bfcd4
6fc94ca8715d234f7d6
Trufflesecurity https://trufflesecurity.com
Trufflesecurity on Github
Trufflesec on Twitter
Michenriksen https://michenriksen.com/
Michenriksen on Github and Gitlab
Techgaun http://www.techgaun.com/
Techgaun on Github and Twitter
Bishopfox https://bishopfox.com
Bishopfox on Github and Twitter
Tillson https://tillsongalloway.com/
Tillson on Github
Kootenpv
Kootenpv on GIthub
192
Incogbyte https://rodnt.github.io/
Incogbyte on Github and Twitter
Pirxthepilot https://pirx.io/
Pirxthepilot on GIthub
Edoardottt https://edoardoottavianelli.it/
Edoardottt on Github
Glebarez https://t.me/glebarez
Glebarez on Github
Blegmore on Twitter
0xbharath https://www.disruptivelabs.in/
0xbharath on Github and Twitter
Hueristiq http://hueristiq.com/
Hueristiq0x00 on Twitter
ARPSyndicate https://www.arpsyndicate.io
ArpSyndicate on Github
D3mondev
D3mondev on Github and Twitter
Wdahlenburg https://wya.pl/
Wdahlenburg on Github
Wdahlenb on Twitter
N0kovo https://infosec.exchange/@n0kovo
N0kovo on Github and Twitter
Jobertabma https://hackerone.com
Jobertabma on Github and Twitter
Dariusztytko
Dariusztytko on Github and Twitter
Josue87
Josue87 on Github
JosueEncinar on Twitter
Vortexau http://www.vortex.id.au
Vortexau on Github and Twitter
Bp0lr https://www.micropay.com.ar/
Bp0lr on Github and Twitter
193
Jaeles-project https://jaeles-project.github.io/
0xDexter0us https://blog.dexter0us.com/
0xDexter0us on Github and Twitter
003random https://003random.com/
003random on GIthub
Rub003 on Twitter
Leddcode https://leddcode.github.io/
Kacakb https://github.com/kacakb
0xsha https://www.0xsha.io/
0xsha on Github and Twitter
Sirbugs
Sirbugs on Github
SirBagoza on Twitter
Byt3hx
Byt3hx on Github
Robre https://r0b.re/
Robre on Github
R0bre on Twitter
Streaak
Streaak on Github, Twitter, Bugcrowd and HackerOne
Shifty0g
Shifty0g on Github, Twitter and Bugcrowd
Karanxa
Karanxa on Github
ItsKaranxa on Twitter
Berzerk0
Berzerk0 on Github and Twitter
Danielmiessler https://danielmiessler.com/
Danielmiessler on Github and Twitter
194
Ademking https://ademkouki.site/
Ademking on Github
Kouki__adem on Twitter
Sh1Yo
Sh1yo on Github and Hackerone
Sh1yo_ on Twitter
S0md3v
S0md3v on Github, Twitter and Medium
Opsdisk https://opsdisk.com/
Opsdisk on Github and Twitter
0xPugal
0xPugal at Github and Twitter
Praetorian-inc https://www.praetorian.com/
Praetorian-inc on Github
Ndelphit
Ndelphit on Github
Delphit33 on Twitter
Whoareme on Hackerone
Lobuhi
Lobuhi on GIthub
Lobuhisec on Twtiter
SA7MON https://danthesalmon.com/
Sa7mon on Github
Redhuntlabs https://redhuntlabs.com/
Redhuntlabs on Github and Twitter
Gotr00t0day
Gotr00t0day on GIthub
195
Using all of this information with efficiency and creativity will make you
a recon professional with a bright future. Just remember to be patient,
be thorough, check assets over time with an automated method and
find some unique methodology that is effective for you.
If you’d like to send any questions, ideas, fix errors, pool resources for
glorious purpose, collaborate or otherwise, you can reach me at:
https://github.com/scumdestroy
https://scumdestroy.com