Latest / CyberCode Academy / Course 3 - Mastering Nuclei for Bug Bounty | Episode 3: Scanning Lists, Metrics, Template Writing, and Proxying
Transcript
- 0:00Speaker 1: Welcome back to the deep dive. So today we're really
- 0:03Speaker 1: moving past just scanning one thing at a time. We're
- 0:06Speaker 1: scaling up.
- 0:07Speaker 2: That's right. We're talking about industrial grade security assessment. Think
- 0:11Speaker 2: high volume professional stuff.
- 0:13Speaker 1: Exactly if you've been doing manual checks. This is like
- 0:16Speaker 1: upgrading from I don't know, binoculars to a full satellite overview.
- 0:20Speaker 2: Yeah, satellite system that can validate everything almost in real time.
- 0:24Speaker 1: We're looking at unlocking the advanced side of things, specifically
- 0:28Speaker 1: with the Nuclei scanning engine, really getting into scaling and
- 0:31Speaker 1: customization m hm.
- 0:33Speaker 2: And our mission really is practical. We want to show
- 0:36Speaker 2: you how to build those massive target lists fast, how
- 0:39Speaker 2: to actually customize the scan logic, and importantly, how to
- 0:43Speaker 2: integrate all this with the tools professionals use for analysis.
- 0:46Speaker 1: Right, it's not just running a default scan, it's about
- 0:49Speaker 1: building a whole pipeline automated inventory, vulnerability detection, the.
- 0:53Speaker 2: Works exactly, building that efficient pipeline.
- 0:56Speaker 1: And this is well, it's essential if you're dealing with
- 0:58Speaker 1: large environments like think bug bounty programs, big enterprise networks
- 1:03Speaker 1: where things change constantly.
- 1:05Speaker 2: Yeah, if your asset list is huge or always shifting,
- 1:08Speaker 2: you need this kind of approach.
- 1:10Speaker 1: It's how you get that massive scale, but also that
- 1:12Speaker 1: really granular control right.
- 1:14Speaker 2: Precisely, so you don't miss vulnerabilities just because they're hidden
- 1:18Speaker 2: away on some forgotten subdomain.
- 1:20Speaker 1: Okay, so let's start with that scaling challenge. YEA. Preparing
- 1:23Speaker 1: the input nuclei is great, but it needs help, right.
- 1:27Speaker 1: It can't just guess all the live machines for say
- 1:30Speaker 1: EXAMPLECORP dot Com.
- 1:31Speaker 2: No, absolutely not. It needs a specific list, a validated list.
- 1:35Speaker 2: And crucially, each target needs the right protocol to find
- 1:39Speaker 2: HGTP or HTTPS.
- 1:41Speaker 1: So you can't just dump a domain name in there.
- 1:42Speaker 2: Nope, you need what we call a preparation pipeline. Step
- 1:45Speaker 2: one is discovery, finding the potential assets, and for that
- 1:49Speaker 2: a tool like subfinder is perfect.
- 1:50Speaker 1: Subfinder okay, and that does passive enumeration, you said, that's
- 1:53Speaker 1: the key.
- 1:54Speaker 2: Passive. It doesn't actively ping or probe the target's network,
- 1:58Speaker 2: so it's quiet, very quiet groups public data sources, things
- 2:01Speaker 2: like certificate transparency logs, DNS records, you know, various online databases.
- 2:06Speaker 2: It build an initial raw list from that, and.
- 2:09Speaker 1: The advantage there is speed in self.
- 2:12Speaker 2: Both you can pull together potentially thousands of subdomains in
- 2:16Speaker 2: just seconds without raising any alarms at the target organization.
- 2:19Speaker 1: Wow, okay, like running it on nmap dot org you
- 2:22Speaker 1: found what thirty five subdomains super quick?
- 2:25Speaker 2: Yeah, under six seconds. Then you just save that raw
- 2:28Speaker 2: list to a file let's call it raw subs dot
- 2:29Speaker 2: TXTU or something.
- 2:31Speaker 1: But you mentioned raw and potential. These lists aren't guaranteed
- 2:34Speaker 1: to be live, right, especially with passive collection exactly.
- 2:38Speaker 2: That's the catch with passive data. It can be out
- 2:40Speaker 2: of date. You might get hosts that don't exist anymore,
- 2:42Speaker 2: or old entries. You need validations, especially if you're.
- 2:45Speaker 1: Dealing with like thousands of domains, you'll hit errors, timeouts, right.
- 2:49Speaker 2: And that's where step two comes in. HTTPX it's designed
- 2:52Speaker 2: for this. It takes that raw list, maybe from our
- 2:54Speaker 2: raw subs dot txt file using the dashel flag, and
- 2:58Speaker 2: HTTPX actively probes each one to see if it's actually
- 3:02Speaker 2: live and listening on HTTP or hdtps ah.
- 3:05Speaker 1: So it does the protocol check.
- 3:06Speaker 2: Too, Yes, that's vital. It automatically figures out if it's
- 3:09Speaker 2: HGTP or HGTPS and adds it so the output is
- 3:12Speaker 2: perfectly formatted for NUCLEI cleans up the list.
- 3:15Speaker 1: So subfinder finds the universe. HTTPX confirms what's actually real
- 3:19Speaker 1: and reachable in that universe.
- 3:20Speaker 2: Couldn't have said it better myself. It prunes, verifies, and formats.
- 3:24Speaker 2: So if subfinder gave us thirty five, maybe HTTPX confirms
- 3:28Speaker 2: thirty four are live. We save that list, say live
- 3:32Speaker 2: subs dot txt.
- 3:34Speaker 1: Okay, clean list ready? How do we feed that into
- 3:37Speaker 1: Nuclei efficiently?
- 3:38Speaker 2: Two main ways. Generally, you can use standard input you know, piping.
- 3:42Speaker 2: Just catlivesubs dot txt and pipe it straight into the
- 3:45Speaker 2: Nuclei command right.
- 3:46Speaker 1: Useful if you're chaining tools together.
- 3:47Speaker 2: Exactly or probably more common for just this step, use
- 3:51Speaker 2: Nuclei's own list flag dashel and just point it to
- 3:54Speaker 2: the file Nuclei dashell livesubs dot txt. Then you add
- 3:58Speaker 2: whatever template you want to run, like a maybe an
- 4:00Speaker 2: Enginx detection template.
- 4:01Speaker 1: Got it so dashell with the filepath simple enough, and
- 4:05Speaker 1: that lets you hit potentially thousands of verified targets instantly.
- 4:08Speaker 2: Okay, so you've got your targets flowing. Now you need
- 4:10Speaker 2: to think about the tool itself. Operational stuff. First up, maintenance,
- 4:13Speaker 2: keep the scanner updated.
- 4:14Speaker 1: That sounds basic, but why is it so critical what's
- 4:17Speaker 1: the real risk of skipping updates.
- 4:19Speaker 2: For a bit Oh, the risk is huge, Honestly, it's
- 4:21Speaker 2: almost existential for a security tool. The threat landscape changes
- 4:26Speaker 2: well daily, hourly.
- 4:28Speaker 1: Sometimes, new vulnerabilities pop up all the time, all.
- 4:31Speaker 2: The time, zero days. New cvees get published and the
- 4:34Speaker 2: community responds incredibly fast, releasing detection templates sometimes within hours.
- 4:40Speaker 2: If your Nuclei isn't updated, you're blind to those new threats,
- 4:43Speaker 2: completely blind. You could be missing critical vulnerabilities that attackers
- 4:47Speaker 2: are actively exploiting right then and there. Running NUCLEI update
- 4:51Speaker 2: is non negotiable. It pulls down the latest logic bug
- 4:54Speaker 2: fixes everything, okay.
- 4:56Speaker 1: Point taken. Updates are crucial now when you are running
- 4:58Speaker 1: a scan, especially big one thousands of targets, you need
- 5:02Speaker 1: to know what's going on right, what is it working?
- 5:04Speaker 1: Is it stuck?
- 5:05Speaker 2: Absolutely? Visibility is key for large operations, and that's where
- 5:08Speaker 2: the new metrics flag comes in. It's incredibly useful in numetris.
- 5:12Speaker 1: What does that do?
- 5:12Speaker 2: It spins up a small web server while nuclear is running,
- 5:15Speaker 2: usually on local host portent nine zero nine two. You
- 5:17Speaker 2: just open that in your browser local host line zero.
- 5:19Speaker 1: Nine two metrics and it shows you stats.
- 5:23Speaker 2: Yeah, but detailed stats, real time data. You see how
- 5:26Speaker 2: long the scan's been running. Crucially, any errors encountered, how
- 5:30Speaker 2: many hosts are currently being scanned? Okay, total requests sent out,
- 5:34Speaker 2: the number of templates that loaded. It gives you a
- 5:36Speaker 2: proper dashboard into the scans health and progress.
- 5:40Speaker 1: It's not just a progress bar, it's actual diagnostic info exactly.
- 5:43Speaker 2: It's for troubleshooting on the fly. I remember one time,
- 5:46Speaker 2: scanning maybe ten thousand domains. Looked at the metrics early
- 5:51Speaker 2: on saw requests per second where basically zero airrors were climbing.
- 5:56Speaker 2: Oh yeah, turns out I'd forgotten a specific proxy setting
- 5:59Speaker 2: needed for that that environment. The metrics told me immediately
- 6:02Speaker 2: something was wrong, saved me potentially hours maybe days of
- 6:06Speaker 2: a useless scan. Fixed it restarted, good to go. That's
- 6:09Speaker 2: the real value.
- 6:10Speaker 1: All right, let's shift gears to customization. This feels like
- 6:13Speaker 1: where the real pro wark happens. Why does security folks
- 6:16Speaker 1: need to write their own Nucleari templates.
- 6:18Speaker 2: Well, because discovery doesn't stop. You might find a completely
- 6:23Speaker 2: new vulnerability, maybe a zero day or some weird logic
- 6:26Speaker 2: flaw specific to an application.
- 6:28Speaker 1: You're testing something that doesn't have a public template yeh, exactly.
- 6:31Speaker 2: Or maybe the public ones aren't quite right for your
- 6:33Speaker 2: specific case. When you find something novel, you need to
- 6:37Speaker 2: be able to scan your entire ACID inventory for it
- 6:40Speaker 2: quickly and reliably. That means writing a custom template.
- 6:45Speaker 1: Okay, so how does that work? What's in a template file?
- 6:47Speaker 2: It starts at the basics, the metadata. There's a mandatory
- 6:50Speaker 2: informational block right at the.
- 6:52Speaker 1: Top, infoblock, got it? What's in there?
- 6:55Speaker 2: Key stuff, A unique ID for the template, like a name.
- 6:59Speaker 2: Then an infosection with things like the display name, the author,
- 7:02Speaker 2: maybe your team name, severity.
- 7:04Speaker 1: Severity like critical high medium, yeah.
- 7:07Speaker 2: Critical high, medium low, or just info. Also tags for
- 7:10Speaker 2: categorizing it like tech detection or creeve whatever, a clear
- 7:14Speaker 2: description of what it checks for is vital, and.
- 7:17Speaker 1: A reference section two like where you found out about
- 7:19Speaker 1: the vulnerability.
- 7:20Speaker 2: Definitely links to blog posts, advisories, your own research notes.
- 7:23Speaker 2: It grounds the template in evidence.
- 7:25Speaker 1: Okay, so that's the who, what? Why? What about the how?
- 7:28Speaker 1: The actual check?
- 7:29Speaker 2: That's the request block. This is where you define the
- 7:32Speaker 2: network interaction. You specify the HTTP method, get T post
- 7:36Speaker 2: two whatever is needed. You can control redirects things.
- 7:39Speaker 1: Like that, and this is where you tell it what
- 7:42Speaker 1: you arel path to hit.
- 7:43Speaker 2: Yes, but it's dynamic since the template doesn't know the
- 7:46Speaker 2: target beforehand. It uses dynamic variables as placeholders.
- 7:50Speaker 1: AH placeholders like what.
- 7:52Speaker 2: Common ones are base url, which grabs the whole input URL.
- 7:56Speaker 2: A root 'rele just gets the scheme in domain like
- 7:58Speaker 2: https dot example, host name gets the host in port
- 8:02Speaker 2: host gets only the host name.
- 8:04Speaker 1: Okay, So you can build the request path very.
- 8:06Speaker 2: Precisely exactly, and port for the port number if you
- 8:09Speaker 2: need to target a specific file or directory path like
- 8:11Speaker 2: admin or config dot TXD.
- 8:13Speaker 1: So you combine these to build the exact request needed
- 8:16Speaker 1: for the vulnerability. Right.
- 8:17Speaker 2: And if you run Nuclei in verbose mode using Rovifi,
- 8:20Speaker 2: you can actually see how these variables get resolved into
- 8:22Speaker 2: the final URLs being requested. Super helpful for debugging.
- 8:26Speaker 1: Okay, request scent. But how does Nuclei know if the
- 8:30Speaker 1: response means it found the vulnerability? Can't just be a
- 8:34Speaker 1: two hundred ok status right?
- 8:35Speaker 2: Absolutely not. That's probably the most critical part the matcher's block.
- 8:40Speaker 2: This is where you define the success criteria the logic.
- 8:43Speaker 1: So this tells Nuclei what to look for in the
- 8:45Speaker 1: reply precisely.
- 8:46Speaker 2: You can create quite complex conditions. For example, you might
- 8:49Speaker 2: need the HTTP status code to be say four to
- 8:53Speaker 2: oh three forbidden a D. You need the response body
- 8:56Speaker 2: to contain a specific error message like access denied by internal.
- 9:00Speaker 1: Policy, So multiple conditions. You can use and D logic.
- 9:03Speaker 2: Yes, and D logic or logic. You can match on
- 9:06Speaker 2: status codes, header values, content types, specific strings or patterns
- 9:10Speaker 2: in the body using regular expressions or rejects.
- 9:13Speaker 1: Rejects matching two powerful.
- 9:15Speaker 2: Very so you're not just checking if a page exists.
- 9:17Speaker 2: You're checking if it exists and behaves in a very
- 9:20Speaker 2: specific way that indicates the vulnerability as present. If all
- 9:23Speaker 2: your matcher conditions are met, then Nuclei reports of finding.
- 9:26Speaker 1: That makes sense. That's how you avoid false positives. Yeah,
- 9:29Speaker 1: what about pulling data out?
- 9:31Speaker 2: Good point. There's also an extractor's block. If the response
- 9:34Speaker 2: contains useful info like a specific token, an internal IP,
- 9:39Speaker 2: or a software version number that confirms the vone, you
- 9:42Speaker 2: can define extractors to pull that specific piece of data
- 9:45Speaker 2: out and include it in the finding report. Provides concrete proof. Now,
- 9:49Speaker 2: even with really well written custom templates, sometimes you need
- 9:54Speaker 2: well even deeper insight. You need to see the raw
- 9:57Speaker 2: request exactly as Nuclei sends it.
- 10:00Speaker 1: Why would you need that if the template is working.
- 10:03Speaker 2: Maybe you're dealing with a super complex vulnerability. We are
- 10:06Speaker 2: headers involved, maybe timing issues, or perhaps the server response
- 10:10Speaker 2: is subtly different than expected and you need to investigate
- 10:13Speaker 2: why your matcher isn't quite hitting.
- 10:15Speaker 1: Okay, like forensic level debugging of the request itself exactly.
- 10:18Speaker 2: And for that you integrate Nuclei with an intercepting proxy,
- 10:21Speaker 2: most commonly BURP suite.
- 10:23Speaker 1: Right burp sweet, So you wrote Nucleis traffic through burp.
- 10:26Speaker 2: Yep, it's pretty sure forward to set up. First, make
- 10:29Speaker 2: sure BURP is listening as a proxy, say on port
- 10:31Speaker 2: eighty a one on your local machine.
- 10:33Speaker 1: Okay, standard BURP setup.
- 10:35Speaker 2: Then when you run your Nuclei scan, you just add
- 10:37Speaker 2: the dexter's proxy flag telling it where BURP is listening,
- 10:40Speaker 2: something like next proxy http dot one two seven dot
- 10:44Speaker 2: zero point one point eight zero eight one.
- 10:46Speaker 1: Simple flag and the payoff.
- 10:48Speaker 2: The payoff is immediate visibility in BURP. Every single HTTP
- 10:53Speaker 2: request that Nuclei makes gets captured right there in broops
- 10:56Speaker 2: http history tab.
- 10:57Speaker 1: Ah, so you see the exact det or pst the
- 11:02Speaker 1: target hosts, all the header's nuclei constructed based on the
- 11:05Speaker 1: template and variable.
- 11:06Speaker 2: Scale everything, everything, and the beauty is you can then
- 11:09Speaker 2: just right click that request in BURP, send it over
- 11:12Speaker 2: to the repeater.
- 11:12Speaker 1: Tool and start tinkering with it manually.
- 11:14Speaker 2: Exactly modify headers, change parameters, resend it, analyze response interactively,
- 11:19Speaker 2: all without having to stop your main nuclei scan or
- 11:21Speaker 2: constantly edit the template file. It's that perfect blend of
- 11:24Speaker 2: automation speed and manual precision when you need it.
- 11:27Speaker 1: So let's pull this all together. We've really covered a
- 11:29Speaker 1: lot of ground today, the whole professional workflow.
- 11:31Speaker 2: Yeah, we started with just needing targets for a single domain.
- 11:34Speaker 1: Right and showed how to use subfinder and httpx to
- 11:37Speaker 1: build a reliable, validated list of potentially thousands of live
- 11:41Speaker 1: hosts scaling the input. Then we looked at keeping the
- 11:44Speaker 1: tools sharp with updates and getting that crucial real time
- 11:47Speaker 1: feedback using the metrics.
- 11:49Speaker 2: Server visibility during the STAN. Then we dove into customizing
- 11:54Speaker 2: the logic itself, building templates, understanding the info block, request block,
- 11:58Speaker 2: those vital dynamic variables.
- 12:00Speaker 1: And especially the matchres defining those precise conditions for what
- 12:04Speaker 1: counts as a finding.
- 12:05Speaker 2: Absolutely critical and finally integrating with tools like boop suite,
- 12:09Speaker 2: using the proxy flag for that deep dive forensic analysis
- 12:13Speaker 2: when needed.
- 12:13Speaker 1: It really is a complete methodology moving from basic scans
- 12:17Speaker 1: to targeted, high impact, high volume security assessment.
- 12:21Speaker 2: That's the goal. Now here's something for you, the listener,
- 12:23Speaker 2: to think about. Little review exercise.
- 12:25Speaker 1: Maybe okay, lay it honest.
- 12:27Speaker 2: Imagine you've just found a brand new, totally custom vulnerability
- 12:31Speaker 2: nobody else knows about yet, and you need to scan
- 12:34Speaker 2: let's say, ten thousand domains for it.
- 12:37Speaker 1: Urgently, high pressure situation.
- 12:39Speaker 2: Very now, thinking about everything we discussed, subdomain enumeration and validation,
- 12:44Speaker 2: writing the templates, conditional matchers, using scan metrics for visibility,
- 12:49Speaker 2: or setting up proxy integration. Which two of those would
- 12:53Speaker 2: you prioritize getting right first to ensure maximum speed and
- 12:57Speaker 2: maximum detection accuracy right out of the gate. And critically
- 13:00Speaker 2: why those two hm hmm?
- 13:02Speaker 1: Interesting? Where do you get the biggest bang for your
- 13:04Speaker 1: buck initially in that scenario speed and accuracy exactly?
- 13:09Speaker 2: Think about the workflow and where the bottlenecks or biggest
- 13:12Speaker 2: risks are at the start of such a large critical scan.
- 13:16Speaker 1: That's a great question to chew on. Definitely makes you
- 13:18Speaker 1: think strategically about applying these techniques. Thanks for walking us
- 13:20Speaker 1: through all that.
- 13:21Speaker 2: My pleasure. It's powerful stuff when you use correctly. Until
- 13:24Speaker 2: next time, Thanks
- 13:25Speaker 1: For diving deep with us today.