Latest / CyberCode Academy / Course 8 - Penetration Testing OSINT Gathering with Recon-ng | Episode 3: Harvesting Data, Optimizing Contacts, Geolocation
Transcript
- 0:00Speaker 1: Have you ever wondered how someone could build a complete,
- 0:03Speaker 1: detailed digital blueprint of an organization. I mean they're hidden servers,
- 0:07Speaker 1: their employee contacts, the exact software they're running, all without
- 0:11Speaker 1: ever touching their internal network.
- 0:13Speaker 2: It sounds like something from a movie, but it's really
- 0:16Speaker 2: just a systematic process.
- 0:17Speaker 1: And that's what we're doing today, a deep dive into
- 0:20Speaker 1: exactly that digital reconnaissance. We're looking at how a structured
- 0:25Speaker 1: intelligence campaign can take these tiny public fragments of data,
- 0:29Speaker 1: you know, an email, a host name, and weave them
- 0:32Speaker 1: together right.
- 0:33Speaker 2: To form a surprisingly complete picture.
- 0:35Speaker 1: It feels it less like hacking and more like really
- 0:39Speaker 1: well organized detective work.
- 0:41Speaker 2: That is the crux of it. Our mission today is
- 0:43Speaker 2: to walk you through the key stages, and really this
- 0:46Speaker 2: work is ninety percent planning. The data you find in
- 0:49Speaker 2: that first hour completely dictates what you can do in
- 0:52Speaker 2: the second.
- 0:53Speaker 1: So we're covering the foundational steps, the methodology, not actually
- 0:55Speaker 1: running scans exactly.
- 0:57Speaker 2: We're showing the flow of information and what it can reveal.
- 1:00Speaker 1: Okay, so let's unpack this journey. Where do we begin?
- 1:02Speaker 2: You start by laying the foundation, establishing the.
- 1:05Speaker 1: Workspace a clean environment.
- 1:07Speaker 2: I assume a dedicated clean environment. You input your core target.
- 1:12Speaker 2: Let's just say, for example, a big domain like Globalcorp
- 1:14Speaker 2: dot com and maybe a basic company description.
- 1:18Speaker 1: The keyword there seems to be input it is.
- 1:21Speaker 2: The success of any of these automated campaigns is well,
- 1:24Speaker 2: it's directly proportional to the quality of the initial data
- 1:27Speaker 2: you feed it.
- 1:28Speaker 1: Got it? So target domain is loaded. What's the very first.
- 1:32Speaker 2: Action contact harvesting. The goal is to immediately start populating
- 1:36Speaker 2: our contact's database.
- 1:37Speaker 1: Table, and the traditional first stop would.
- 1:39Speaker 2: Be domain registration records, the whois data. That's your baseline.
- 1:45Speaker 1: But those whis records have become so hard to rely on,
- 1:48Speaker 1: right with all the privacy regulations. They're often anonymized.
- 1:51Speaker 2: Now absolutely, and that lack of reliability is precisely why
- 1:55Speaker 2: good reconnaissance is built on diversification.
- 1:57Speaker 1: So you don't just stop there.
- 1:58Speaker 2: Never meet supplement that whis search by running scans against
- 2:03Speaker 2: records associated with PGP encryption keys.
- 2:05Speaker 1: Oh, that's interesting. Why pgpkey specifically, what makes them such
- 2:09Speaker 1: a good source.
- 2:10Speaker 2: Well, pgpkey servers have been collecting data for decades. When
- 2:14Speaker 2: a developer or an admin sets up an encryption key,
- 2:17Speaker 2: they often link it to a corporate email to verify
- 2:20Speaker 2: who they are I see, And unlike the main whois database,
- 2:24Speaker 2: which gets scrubbed or hidden behind proxies, these PGP servers
- 2:29Speaker 2: often hold on to that historical data.
- 2:31Speaker 1: So you're finding old staff names, old email formats, things
- 2:37Speaker 1: that the current lookup would completely miss.
- 2:39Speaker 2: That's it exactly the company's own security practices from years ago.
- 2:43Speaker 2: Accidentally create a second historical list of contacts for us.
- 2:47Speaker 1: Wow. Okay, So once we have a raw list of people,
- 2:49Speaker 1: where do we go next?
- 2:50Speaker 2: We shift to the infrastructure itself. This is the next
- 2:53Speaker 2: big step in phase one host discovery.
- 2:56Speaker 1: We're looking for sub domains we are.
- 2:58Speaker 2: We're hunting for hosts because each one, whether it's dev
- 3:00Speaker 2: dot globalcorp dot com or admin dot globalcorp dot com,
- 3:04Speaker 2: that's a potential new door away past the main site's
- 3:07Speaker 2: front perimeter.
- 3:07Speaker 1: And for a huge global site, you could be looking
- 3:09Speaker 1: at dozens, maybe hundreds of.
- 3:11Speaker 2: These, oh easily. We use two main methods here. The
- 3:13Speaker 2: first is just straightforward webcrawling. You're basically running a specialized
- 3:18Speaker 2: search across the main target site. It finds every host
- 3:22Speaker 2: name that's actively linked somewhere on the site and saves
- 3:25Speaker 2: it to our host's table.
- 3:26Speaker 1: But the limitation there is pretty clear. If a subdomain
- 3:29Speaker 1: exists but isn't linked anywhere, you'll miss it.
- 3:32Speaker 2: You'll miss it completely. And that's where the second method
- 3:35Speaker 2: comes in, the brute force technique.
- 3:37Speaker 1: That name always sounds so dramatic, What does it actually
- 3:40Speaker 1: mean in this context?
- 3:41Speaker 2: In reconnaissance, brute force isn't about breaking down doors. It's
- 3:46Speaker 2: just about being exhaustive. Okay, Think of it like this.
- 3:49Speaker 2: You have a map of a neighborhood, and instead of
- 3:51Speaker 2: just looking for street signs, you check every single possible address.
- 3:56Speaker 2: You check for admin, road, test, street, development, alley.
- 3:59Speaker 1: So your check is a huge dictionary of common host
- 4:02Speaker 1: names like API, staging, mail, beta, to see if any
- 4:07Speaker 1: of them get a response.
- 4:07Speaker 2: Precisely, you run the passive crawl first for the low
- 4:10Speaker 2: hanging fruit, and then you run this exhaustive check to
- 4:13Speaker 2: find the hidden.
- 4:14Speaker 1: Or forgotten hosts depth over speed.
- 4:16Speaker 2: Always, and every new host goes into the table. Then,
- 4:20Speaker 2: just before we leave this phase, we run one last
- 4:23Speaker 2: check for what I call accidental leeks, meaning we scan
- 4:27Speaker 2: all the hosts we just found for commonly named files
- 4:29Speaker 2: that should never be public, things like site maps, PHP
- 4:33Speaker 2: info files, old test scripts.
- 4:35Speaker 1: And people really just leave those lying around.
- 4:37Speaker 2: It is astonishing how often you find critical configuration data
- 4:40Speaker 2: just sitting in a file someone forgot to delete.
- 4:43Speaker 1: Okay, so to recap, we've now populated our tables with
- 4:47Speaker 1: raw contacts and a huge list of subdomains. But we
- 4:50Speaker 1: hit a bottleneck, a big one. We might have a name,
- 4:52Speaker 1: but we don't have their current email address, which brings
- 4:55Speaker 1: us to phase two, data enrichment and the MANGLE module.
- 5:00Speaker 2: This step is critical because an email address is the
- 5:02Speaker 2: single most valuable piece of initial data you can have.
- 5:05Speaker 2: It's the key, the.
- 5:06Speaker 1: Key to authentication systems everywhere.
- 5:08Speaker 2: Right, and mangle doesn't scan the network, it just takes
- 5:11Speaker 2: the partial data we already have a first and last name,
- 5:14Speaker 2: and uses the domain to construct likely email addresses.
- 5:17Speaker 1: But how does it get past being just a simple guess.
- 5:20Speaker 1: Companies use so many different formats first name, dot last name,
- 5:24Speaker 1: first initial last name.
- 5:26Speaker 2: That's the intelligent part of the process. You have to
- 5:28Speaker 2: define a high confidence pattern.
- 5:30Speaker 1: So you need an educated guess.
- 5:31Speaker 2: You need one solid piece of evidence. Let's say through
- 5:34Speaker 2: our PGP scan we found one valid email address. Right,
- 5:39Speaker 2: Let's say it's JDA at Globalcorp. Dot com Okay, Well,
- 5:43Speaker 2: now we can establish that the company's internal policy is
- 5:46Speaker 2: likely first initial dot last name or FI.
- 5:51Speaker 1: Dot ln I see, and then mangle just apply that
- 5:54Speaker 1: pattern to every other name in our contact.
- 5:56Speaker 2: List and generates a high confidence list of possibilities. Based
- 5:59Speaker 2: on that one piece of evidence, you're dramatically increasing your
- 6:03Speaker 2: odds of finding a valid address.
- 6:04Speaker 1: So we've basically generated a list of plausible credentials exactly.
- 6:08Speaker 2: And now that we have this big list of newly
- 6:10Speaker 2: constructed email addresses, what's the first logical thing to do?
- 6:13Speaker 1: You check if they've already been compromised somewhere else.
- 6:16Speaker 2: Straight into vulnerability checks, we use services like the have
- 6:19Speaker 2: I been Pruned API? We push all those new emails
- 6:22Speaker 2: through the API to check them against databases of all
- 6:25Speaker 2: the massive credential leaks.
- 6:27Speaker 1: And you don't stop there.
- 6:28Speaker 2: We also extend the search to popular pacee sites.
- 6:32Speaker 1: Can you just clarify for our listener, what's the role
- 6:34Speaker 1: of a site like pacee to bin in all this?
- 6:37Speaker 2: Sure? Pastebin and similar sites are often like a public
- 6:40Speaker 2: bulletin board where attackers dump compromised data, you know, passwords, hashes,
- 6:46Speaker 2: database fragments. They dump it there to show off or
- 6:49Speaker 2: to trade it.
- 6:50Speaker 1: So checking pace to bin means you're looking at the
- 6:52Speaker 1: most recent data leaks, not just the big historical breaches.
- 6:55Speaker 2: That's it. It's the freshest pool of compromised data.
- 6:59Speaker 1: And if you get a positive hit, a matched email
- 7:01Speaker 1: and maybe a password hash, that goes straight into our
- 7:04Speaker 1: credentials table.
- 7:05Speaker 2: And that's the huge risk. You started with just a name,
- 7:08Speaker 2: then you intelligently guessed an email, and now that email
- 7:11Speaker 2: might unlock a real credential because the user reused a
- 7:14Speaker 2: password on some other site that got breached five years ago.
- 7:16Speaker 2: It's a massive finding.
- 7:18Speaker 1: That is fascinating. Okay, so we've identified the people, enriched
- 7:22Speaker 1: their data, found potential leaks. Now we move from the
- 7:25Speaker 1: human element to the physical landscape.
- 7:27Speaker 2: Phase three geolocation and mapping the stack.
- 7:32Speaker 1: Why is knowing the physical location of a server so important?
- 7:35Speaker 2: Physical location gives you context. It can point to regional
- 7:39Speaker 2: security policies or even which laws apply to the data.
- 7:42Speaker 2: We start simple with IP address resolution. We take a
- 7:46Speaker 2: host name from our host's table, say Staging dot Globalcorp
- 7:50Speaker 2: dot com, and resolve it's IP address.
- 7:53Speaker 1: And once we have the IP we use a geolocation service,
- 7:55Speaker 1: a GEIP lookup. What kind of detail are we talking
- 7:58Speaker 1: about here?
- 7:58Speaker 2: We can usually get it down to a specific data center,
- 8:01Speaker 2: maybe an Amazon EC two instance running in Ashburn, Virginia.
- 8:05Speaker 2: But here's a funny thing. Security services know this, so
- 8:08Speaker 2: major providers often intentionally publish slightly misleading coordinates.
- 8:13Speaker 1: What do you You.
- 8:13Speaker 2: Might resolve the address and the map shows the data
- 8:16Speaker 2: center located smack in the middle of a lake.
- 8:18Speaker 1: That's that's almost comical, an intentionally vague security measure.
- 8:22Speaker 2: It is, But the regional data is still incredibly useful.
- 8:25Speaker 2: And that geographical data, the latitude and longitude, has another use.
- 8:29Speaker 2: We can feed it into services like the showdown search engine.
- 8:32Speaker 1: And what does showdown do with that location data?
- 8:35Speaker 2: It lets you scope your search. If you know one
- 8:38Speaker 2: server is in a specific data center, you can tell
- 8:41Speaker 2: showdown to search for other related network results, other services,
- 8:45Speaker 2: other IP blocks within say a one kilometer radius.
- 8:49Speaker 1: So you're mapping the entire physical neighborhood of their infrastructure.
- 8:53Speaker 2: Getting the context.
- 8:53Speaker 1: Okay, we have the people, the coordinates, the nearby networks.
- 8:58Speaker 1: Now for the tech itself. This is where you said.
- 9:00Speaker 1: We find the deepest riches using a tool called builtwith.
- 9:04Speaker 2: And it really delivers built with surveys the target website
- 9:07Speaker 2: and catalogs every single piece of technology it uses.
- 9:10Speaker 1: For a basic site, I imagine that's the server, the OS.
- 9:13Speaker 2: Right, you'll see Apache, Ubuntu, maybe a WS infrastructure, Google Analytics,
- 9:18Speaker 2: the usual suspects. But for a massive global site, the
- 9:22Speaker 2: data yield just explodes.
- 9:24Speaker 1: Give me an example of the kind of hidden operational
- 9:26Speaker 1: intelligence they can find.
- 9:27Speaker 2: You'll run a scan and suddenly you have hundreds of items.
- 9:31Speaker 2: You'll find the specific admin contact info for their cloud services,
- 9:36Speaker 2: details on their content delivery networks, and critically, their business
- 9:41Speaker 2: optimization tools. You might discover, for example, they're running a
- 9:45Speaker 2: tool called mouseflow.
- 9:47Speaker 1: Wait, mouseflow, I know what that is.
- 9:49Speaker 2: See that's the key insight.
- 9:51Speaker 1: That's an audience measurement tool. It records visitor sessions, generates
- 9:55Speaker 1: heat maps of where people click exactly.
- 9:57Speaker 2: The fact that the target is running mouseflow tells you
- 10:00Speaker 2: they are actively tracking and recording what visitors do on
- 10:03Speaker 2: their site.
- 10:04Speaker 1: So I'm not just seeing their tech infrastructure. I'm finding
- 10:06Speaker 1: out they're literally recording my mouse movements. That feels like
- 10:10Speaker 1: a huge piece of information for them to be broadcasting.
- 10:13Speaker 2: It reviews not just what they're running, but how they're
- 10:16Speaker 2: running their business, how they're analyzing their customers. You'll also
- 10:20Speaker 2: see tools like optimizely for ab testing. When you finish
- 10:23Speaker 2: the scan, you have a complete actionable profile of their security,
- 10:27Speaker 2: their marketing, and their entire development.
- 10:29Speaker 1: Stack, all from public facing systems. That is an astonishing
- 10:33Speaker 1: amount of sensitive data to get just by looking carefully.
- 10:37Speaker 2: And if we boil it all down, it's really four
- 10:40Speaker 2: repeatable steps that build on each other.
- 10:42Speaker 1: First populating contacts and hosts using diverse sources like those pgpkeys.
- 10:47Speaker 2: Second, using a tool like mangle to intelligently guess and
- 10:50Speaker 2: validate emails based on company patterns.
- 10:52Speaker 1: Third, associating ips with a physical location and then searching
- 10:56Speaker 1: that physical area.
- 10:57Speaker 2: And finally profiling the entire technology and behavioral tracking stack
- 11:02Speaker 2: with a tool like Built.
- 11:03Speaker 1: With the sheer amount of information organizations broadcast not just
- 11:07Speaker 1: their software, but their location, their infrastructure, even the tools
- 11:10Speaker 1: they use to track you, it really highlights how much
- 11:13Speaker 1: is unknowingly available.
- 11:15Speaker 2: Most companies have their entire operational blueprint just sitting out
- 11:18Speaker 2: there for anyone systematic enough to look, which.
- 11:20Speaker 1: Brings up a good review question for you, our listener,
- 11:23Speaker 1: to think about.
- 11:24Speaker 2: If you only had a first name, a last name,
- 11:26Speaker 2: and a company domain. What's the key technique we discussed
- 11:29Speaker 2: today that you could use to increase your odds of
- 11:32Speaker 2: finding a valid email address, And more importantly, what one
- 11:36Speaker 2: piece of information would you need to define first before
- 11:39Speaker 2: that technique would even work.
- 11:41Speaker 1: Think about that pattern setting turning an educated guest into
- 11:45Speaker 1: a statistically probable credential. Thanks for joining us for this
- 11:47Speaker 1: deep dive