What Is Shodan?
Shodan is a search engine that continuously scans the public IPv4 (and increasingly IPv6) address space, fingerprints every responding service, and indexes the banners it collects. Where Google indexes web content, Shodan indexes the machines themselves — open ports, TLS certificates, SSH keys, SCADA controllers, webcams, databases, and everything in between.
For an offensive security practitioner, Shodan collapses hours of active scanning into a single query. You can map a target's external footprint without sending a packet to their network — critical when stealth matters or when scope only permits passive reconnaissance.
Core Search Filters
Shodan's filter syntax uses filter:value pairs you can chain together. Strings with spaces need quotes. Negate a filter with a leading -.
| Filter | Description | Example |
|---|---|---|
| port: | Match services on a specific TCP/UDP port | port:22 |
| hostname: | Match results whose hostname contains a string | hostname:example.com |
| net: | Restrict to a CIDR block | net:198.51.100.0/24 |
| os: | Match a specific operating system fingerprint | os:"Windows Server 2019" |
| country: | ISO 3166-1 alpha-2 country code | country:DE |
| city: | Restrict to a city | city:"Berlin" |
| org: | Match an organization name from WHOIS | org:"Acme Corp" |
| product: | Service product name detected in the banner | product:"nginx" |
| version: | Service version string | version:1.18.0 |
| ssl: | Match a string in the TLS certificate | ssl:"example.com" |
| ssl.cert.subject.cn: | Common Name in the certificate subject | ssl.cert.subject.cn:example.com |
| http.title: | HTTP page title | http.title:"index of /" |
| http.favicon.hash: | MurmurHash3 of the favicon — pivot across infra | http.favicon.hash:-1234567890 |
| vuln: | Match a CVE (paid tier) | vuln:CVE-2021-44228 |
| tag: | Pre-computed tag (e.g. compromised, ics, vpn) | tag:ics |
Combine filters to narrow the noise: net:198.51.100.0/24 port:443 ssl:"example.com" returns HTTPS endpoints in that block whose certificate references the target domain.
Infrastructure Discovery
Start broad, then narrow. The goal of the recon phase is to understand what a target owns before deciding what to probe.
Map a target's external surface
hostname:example.comssl:"example.com"ssl.cert.subject.cn:example.comorg:"Example Corporation"http.html:"example.com"ssl: is particularly powerful — TLS certificates often reveal infrastructure that isn't linked from the main site (staging, internal admin panels, mail gateways) because the certificate's Subject Alternative Names enumerate every hostname it covers.
Pivot across related hosts
http.favicon.hash:-1234567890http.html_hash:123456789ssl.cert.serial:"01:23:45:67:89:AB:CD:EF"Favicon hashes are a classic pivot: if a target self-hosts a custom admin panel, every instance of that panel anywhere on the internet shares the same favicon hash. One query and you find the rest of their fleet.
Finding Exposed Services
Once you know what a target owns, look for services that shouldn't be reachable from the public internet. These are the high-value findings in any external assessment.
Common exposed services
port:3389 hostname:example.com // exposed RDPport:5900 "VNC" -authentication // unauthenticated VNCproduct:"MongoDB" port:27017 // exposed MongoDBproduct:"Elasticsearch" port:9200 // open Elasticsearchport:6379 product:"Redis" // exposed Redishttp.title:"Jenkins" port:8080http.title:"Grafana"http.component:"kibana"# Combine with org filter to scope to your target
org:"Acme Corp" (port:3389 OR port:5900 OR port:23)Anything that returns a banner without authentication is fair game to flag in a report. A misconfigured Elasticsearch or Redis instance is usually a direct path to data exfiltration.
Hunting Known Vulnerabilities
Shodan tags services it can fingerprint as vulnerable to specific CVEs. The vuln: filter is paid-tier, but the same results are often reachable by querying the vulnerable version string directly.
Version-based hunting
product:"OpenSSH" version:"7.4"product:"Apache httpd" version:"2.4.49" // CVE-2021-41773product:"Microsoft Exchange" "15.2"tag:vpn product:"Fortinet"http.html:"log4j" port:443A version match is a hypothesis, not proof — confirm exploitability against scope before claiming an active vulnerability. Many banners lie because operators backport patches without bumping the displayed version.
Defensive Measures
If you're defending a perimeter, treat Shodan as part of your standard external monitoring. Search for your own organization weekly:
org:"Your Company"
ssl:"yourcompany.com"
hostname:yourcompany.com- Inventory everything Shodan sees. Anything indexed that you don't recognize is either shadow IT or an attacker's beachhead — investigate both.
- Close unintended ports at the edge. Management interfaces (SSH, RDP, database ports, Kubernetes API) should never be reachable from arbitrary source IPs.
- Mint dedicated certificates for internal infra. Don't list staging or admin hostnames in the SAN of your public certificate — it leaks your internal topology.
- Subscribe to Shodan Monitor. Get alerted the moment a new service in your IP space starts answering.
- Patch on the version Shodan sees, not the one you shipped. If banners advertise vulnerable versions, that's what attackers will target — even if you've backported the fix.
Legal & Ethical Considerations
Querying Shodan is passive — you're reading data Shodan already collected. That's almost always legal anywhere. Acting on what you find is a different question: connecting to an exposed service, even to confirm it's vulnerable, can violate computer misuse laws like the CFAA (US), the Computer Misuse Act (UK), or equivalent statutes elsewhere.
Stay inside an explicit scope: an authorized penetration test, your own infrastructure, or a bug bounty program with a published scope. When in doubt, report the exposure to the owner via an abuse contact and let them confirm.
Train your team on this, hands-on.
Hackshire is a CTF-based training platform for security teams. Real exposure hunting scenarios, built by offensive security experts. Opening December 2026.