If you’re in the trenches of IT analysis or cybersecurity, you know the threat landscape isn’t just about what’s happening inside your network. The connections your internal systems make to the outside world can be a significant, often overlooked, attack vector. Today, we’re diving into how you can extend your threat hunting beyond your perimeter using powerful open-source tools, specifically focusing on Shodan.
We’ll explore how to leverage Shodan to identify vulnerable external hosts that are actively communicating with systems within your network. Why is this crucial? Because, as we all know, trust relationships are everywhere. An external host your systems trust could be compromised, providing a backdoor right into your environment. Tracking vulnerabilities even “one hop out” is a vital part of a proactive threat hunting strategy.
Recently, CISA (Cybersecurity and Infrastructure Security Agency) released an advisory highlighting common CVEs exploited by People’s Republic of China (PRC) state-sponsored actors since 2020. This kind of intelligence is gold, but the real question is: how do you operationalize it? How do you take a list of CVEs and actively hunt for them in a way that’s relevant to your organization?
That’s where a tool like Shodan shines. It allows us to take this CISA report, or any similar threat intelligence, and see if our network is touching any external systems known to be vulnerable to these specific exploits.
Think about it: your firewall might allow traffic from a specific external IP because it’s a trusted partner, a cloud service, or a remote management interface. But what if that trusted external IP is running an unpatched, vulnerable service?
Identifying these vulnerable external touchpoints allows you to reassess those trust relationships. Maybe you need to implement stricter filtering, apply more scrutiny to traffic from that source, or alert the owner of the external asset.
Imagine you have a list of concerning CVEs. To manually check for exposure, you’d typically:
This process is incredibly time-consuming, especially for even medium-sized networks. What if you have thousands of external IP communications a day? And what if, after all that effort, the CVE isn’t even something Shodan tracks, or your specific network isn’t communicating with any vulnerable hosts for that CVE? It’s a prime candidate for burnout and missed threats.
For those unfamiliar, Shodan is a search engine for Internet-connected devices. You can search for specific IP addresses and get a wealth of information:
vuln:
filter in Shodan (requires a paid account for full functionality) to search directly for CVEs.For example, when we cross-referenced the CISA advisory’s 16 CVEs with Shodan, we found three that had a significant number of publicly vulnerable hosts:
These became our focus for a Shodan-based hunt, as Shodan had visibility into them. Other CVEs, while still important, might require different tools or approaches if Shodan doesn’t have data on them. It’s all about understanding your tools’ capabilities and limitations.
Because the manual process is so painful, we developed and open-sourced a tool called Shift to automate this exact workflow. We actually released it during our talk at the RSA conference.
You can find Shift on GitHub: https://github.com/Insane-Forensics/Shodan_SHIFT
Shift automates the search for vulnerable external hosts (based on CVEs you define) that are present in your PCAP files. Here’s how it works:
This automation makes it feasible to perform these checks regularly, even in larger environments.
Ready to give it a try? Here’s the rundown:
Prerequisites & Installation:
pip3 install -r requirements.txt
(we provide a python-requirements.txt
in the repo).Create Your CVE Definition File:
cves.txt
) containing a comma-separated list of the CVEs you want to hunt for.CVE-2021-22893,CVE-2020-5902,CVE-2019-19781
Gather Your PCAPs:
Run Shift:
Bash
python3 main.py --pcap <your_pcap_file.pcap> --cve-file <cves.txt> --shodan-key <YOUR_SHODAN_API_KEY> --csv <output_results.csv>
--json <output.json>
or ELK-specific arguments (check main.py --help
for details, including authentication for ELK).You’ll see terminal output as Shift extracts IPs, queries Shodan, and processes results. The output file (e.g., your CSV) will list the external IPs from your PCAP that Shodan identifies as having one of your specified CVEs.
Sample CSV Output:
Code snippet
IPAddress,CVE
198.51.100.10,CVE-2021-22893
203.0.113.25,CVE-2020-5902
With this output, you’ve successfully bridged the gap between general threat intelligence (like a CISA report) and specific, actionable insights for your network. You now have a list of internal communications to potentially compromised external hosts.
The next steps involve traditional incident response and analysis:
Proactive threat hunting means looking for trouble before it finds you. By leveraging external intelligence and tools like Shodan, automated by scripts like Shift, you can gain crucial visibility into risks that lie just beyond your network perimeter. We hope this approach and our open-source tool, Shift, prove valuable in your defensive efforts.
We’re always keen to hear your thoughts and experiences. If you try out Shift, have ideas for improvement, or other topics you’d like to see covered, please don’t hesitate to reach out!
Our products are designed to work with
you and keep your network protected.
Insane Cyber © All Rights Reserved 2025