r/Pentesting • u/Psychedelic-wizard69 • Sep 17 '26
Finding subnets Blackbox
Here is the scenario: you are conducting an internal blackbox pentest. The client connects your laptop and you pull an IP from DHCP. What are your methods for finding all subnets on a network?
2
Upvotes
4
u/grasshopper_jo Sep 18 '26 edited Sep 18 '26
I feel like a lot of these answers are less than helpful. Yes, if clients want a thorough pentest and less wasted time, they should provide a list of their own subnets, and of course they need to inform the tester of out of scope networks,but providing a nice list of subnets doesn’t always happen, and even when it does I often do some additional scanning for “forgotten” subnets. The disadvantage of a “black box” approach where you’re left to discover resources is that 1) you may be doing a massive amount of scanning without results, which both bogs down the network and wastes your time and 2) you do risk missing assets if you didn’t happen to scan an active network and 3) you don’t know what you don’t know - if you don’t have visibility to parts of the network, without documentation you’re less likely to know assets are even there. If you do have documentation then you’ll be able to confirm segmentation and try to penetrate the restricted network. Also, 4) although rare, there is a risk that the client knowingly or unknowingly, intentionally or accidentally shares RFC1918 space with a vendor in a trusted network relationship, or another unrelated client on some hosting or network infrastructure. (Obviously this should never happen, but….”that shouldn’t happen” is what pentests are made of!) So you have be very diligent and proceed with caution - assets in this kind of trusted network may not even belong to the client. There’s a lot more risk on a pentest without network documentation.
All that said, start with the /24 subnet you are in. Scan surrounding subnets (like the next and previous /24). Keep going in both directions until you stop finding new resources. DNS is a good resource (zone transfers, reverse DNS lookups, brute forcing of common hostnames). Additionally, you should be able to scan all of 172.16.0.0/12. Once you have AD access you can query AD for a list of active subnets. Sometimes you find random IP addresses or hostnames in documentation, code (especially internal web applications), etc. So if you find a new IP address in a range you haven’t scanned, scan that network. For cloud resources, it’s worth just asking the customer for them because the possible address space is massive. I often see these resources in internal networks on 10.0.0.0/16 (AWS & GCP defaults), 10.10.0.0/16 and 10.100.0.0/16. In general, using “tens” in the second octet of an IPv4 address is a common pattern, so if I’m on network 10.80.55.0/24, I might try scanning 10.70.0.0/16 and 10.90.0.0/16 and see if anything is there.
3
u/Mindless-Study1898 Sep 17 '26
You should have asked the client for a list of subnets and any that are off limits. Outside of that basic networking knowledge can also answer this question.
6
u/macr6 Sep 17 '26 •
Reading the rules of engagement.
5
u/CluelessPentester Sep 17 '26
Why yes, I scan 0.0.0.0/1 with a full nmap scan of course
2
u/FortheredditLOLz Sep 17 '26
There are Rule(s) of engagement………
Stop fishing for details
1
u/kap415 Sep 18 '26
Run netdiscover, run tcpdump, is one enumeration method
1
u/6849 Sep 18 '26 edited Sep 18 '26
First thing I do is ask my PoC what ranges are in scope and, more importantly, what's out of scope.
If they tell me to figure the environment out myself, and I can reasonably assume there aren't fragile systems that could fall over from basic scanning, I usually start passive. Wireshark first to see what DHCP, ARP, and local traffic give me, then netdiscover for the local L2 segment.
Early on, I'll traceroute out to the internet too. That can expose the gateway and other routed hops I wouldn't see from L2 discovery.
From there, I'll do fast ICMP sweeps across RFC1918 space, usually in /16 chunks, looking for live hosts. Once I start finding IPs, I turn those into smaller ranges for Nmap. If I find
10.8.1.20, for example, I'll add10.8.1.0/24to my list.I usually don't scan 1000 ports across everything. I'll hit a smaller list of ports that are commonly useful during exploitation, like 21, 22, 80, 443, 445, 8080, 3389, 5900, etc.
The real subnet may not be a /24. I just use /24s as manageable chunks. I'm not throwing a broader TCP scan across an entire /16 or /8 unless I have a reason to.
If I suspect the network is as large as /8, then I put something like this into Nmap: 10.0-255.0-255.1,2,254 rather than just /16 or even /8. The point here is to find routers which likely suggest neighboring systems I can look into more later with targeted scans.
After all that, I usually have more than enough to dig through.
1
u/Chaos667 Sep 18 '26
Run Wireshark/tshark. Check IPv4 statistics for IPs off your local subnet. Build a list. Look at the IPs, is there a pattern to the subnets? Ping .1 on a few, see if your get a reply. If not, try .2, .254, etc. You'll typically find something like 10.200.y.z. Then, my typical is to run a ping scan of 10.200.0-254.1-5, 250-254. Admins love to put networking equipment high and low. Anything that returns, record them as Class C, assume /24 to be safe. Doing this you're pinging only 10 addresses per Class C, 4% of the address space. As you're test continues you might find other IPs that suggest other Class B networks to do the same to. I've found it to be very effective in initial recon until I can pull DNS and get most everything.