theHarvester Basics: Gather OSINT on Your Own Domain (Legally)
Every attack starts with reconnaissance — and the smartest attackers start without touching your systems at all. They collect what the internet already knows about you: employee emails, forgotten subdomains, old hostnames, leaked documents. This is called passive OSINT, and theHarvester is the classic free tool that automates it. Here is how to use it on your own domain, legally.
What Is theHarvester?
theHarvester is an open-source OSINT tool that queries public sources — search engines, certificate transparency logs, DNS records, Shodan and more — and gathers emails, subdomains, hosts, IPs and URLs linked to a domain. It comes preinstalled on Kali Linux, and it never sends a single packet to your target: everything it finds is already public.
Why It Matters for Defense
Run theHarvester against your own domain and you will see exactly what an attacker sees before they even knock on your door:
- Subdomains you forgot — old test servers, staging sites, dev panels left exposed.
- Employee emails — the raw material for phishing and credential-stuffing attacks.
- Hostnames and IPs — infrastructure you did not know was public.
Finding these first is the whole point of defensive OSINT: you cannot protect what you do not know exists.
Installing and Running It
On Kali, it is already there. Anywhere else:
git clone https://github.com/laramies/theHarvester.git
cd theHarvester
python3 -m pip install -r requirements/base.txt
A basic run against your own domain:
theHarvester -d example.com -b crtsh,bing,duckduckgo -l 500
What the flags mean:
- -d example.com — the domain you own and are checking.
- -b crtsh,bing,duckduckgo — the sources to query (crtsh = certificate transparency logs, a goldmine for subdomains).
- -l 500 — limit results to 500.
To save results to a file:
theHarvester -d example.com -b all -f results.html
Reading the Results
The output has three sections that matter:
- Emails — every address linked to the domain. If you find addresses of people who left years ago, or generic inboxes like admin@ or backup@, tighten them: those are prime phishing targets.
- Hosts / subdomains — compare this list against your own inventory. Anything you do not recognize is a finding, not a curiosity. A forgotten dev.example.com with no auth is how breaches start.
- IPs — check whether any point to servers you thought were internal.
Turn Findings Into Fixes
- Retire forgotten subdomains and remove dead DNS records.
- Enable email authentication (SPF, DKIM, DMARC) so spoofed mail from your domain gets rejected.
- Shrink your public footprint — fewer exposed services means fewer targets.
- Repeat monthly. New subdomains and emails appear constantly; OSINT is a habit, not a one-off.
The Golden Rule
Passive OSINT is legal because it only reads public information — but only run it against domains you own or have written permission to assess. theHarvester against your own domain is defense. The same tool against someone else’s domain, without permission, is the start of an attack. Only test systems you own or have written permission to test.



Comments
Post a Comment