Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 4 min read

Auditing Your Own Free /48 with nmap: What Scanning IPv6 Really Takes

Disclosure up front: I run IPYE, a company that leases IP space. Most of this article is practical how-to; IPYE appears where a free /48, LOA, or ROA helps you try the work, with a short call to action at the end. Scann

Disclosure up front: I run IPYE, a company that leases IP space. Most of this article is practical how-to; IPYE appears where a free /48, LOA, or ROA helps you try the work, with a short call to action at the end.

Scanning an IPv4 /24 takes seconds. Scanning a single IPv6 /64 address by address would take longer than anyone has, and a /48 contains 65,536 of them. That changes how you audit your own network: you cannot sweep for forgotten hosts, so you have to start from what you know and use local discovery where you can. This article covers practical nmap audits of a network numbered from a free IPv6 /48 from IPYE, with 2001:db8:100::/48 as the example. Scan only address space you are responsible for. IPYE gives you the prefix to announce. What you put inside it, and what you leave open, is yours to check.

Start from a target list

Your target list comes from sources you already have:

  • Every AAAA record in your zones (dig axfr from your primary, or an export from your DNS provider).
  • The address plan or IPAM.
  • Router neighbour tables, which list every address that has recently talked on each LAN.

The neighbour table is the one people forget, and it finds the hosts nobody documented:

ip -6 neigh show | grep -o '^2001:db8:100:[^ ]*' | sort -u > from-neigh.txt
cat from-dns.txt from-plan.txt from-neigh.txt | sort -u > targets6.txt

On other platforms, the equivalent is show ipv6 neighbors or a similar command on the router.

Port scans from outside

Run the external scan from a host outside your network, so you see what the Internet sees:

nmap -6 -sS -Pn -p- --min-rate 500 -iL targets6.txt -oA ext-tcp
nmap -6 -sU -Pn --top-ports 50 -iL targets6.txt -oA ext-udp
  • -6 is required for IPv6 targets.
  • -sS is a SYN scan, which needs root.
  • -Pn skips host discovery. Many hosts drop echo requests, and you already know these addresses exist.
  • -p- scans all 65,535 TCP ports. It is slower, but it finds services on unusual ports that a top-ports scan misses.

UDP scanning is slow and ambiguous, because a silent port may be open or filtered. Keep it to the common ports and confirm anything surprising by hand.

Compare with the intended state

A scan is only useful if you know what should be open. Write the expected exposure down, one line per address and port, and compare. nmap's ndiff compares two scans and shows what changed:

ndiff ext-tcp-last-week.xml ext-tcp.xml

Run the external scan on a schedule and keep the XML files. A new open port that nobody approved is the finding you are looking for, and ndiff puts it on one line.

Local discovery with multicast

On a LAN segment, IPv6 multicast lets you find hosts without guessing addresses. nmap includes scripts for this:

nmap -6 --script targets-ipv6-multicast-echo \
     --script-args 'newtargets,interface=eth1' -sn
nmap -6 --script targets-ipv6-multicast-slaac \
     --script-args 'newtargets,interface=eth1' -sn

The first sends an echo request to the all-nodes multicast address ff02::1 and collects replies. The second provokes SLAAC hosts into revealing their addresses. Both need to run from a machine on the same link, and newtargets adds what they find to the scan. Add -sS -p 22,80,443 instead of -sn to scan them straight away.

Run these from each LAN or VLAN in turn. They are the closest thing to a sweep that IPv6 allows, and they routinely turn up printers, forgotten VMs and devices with SLAAC addresses nobody put in DNS.

What the audit usually finds

Common findings on IPv6 that IPv4 scans miss:

  • Services exposed only on IPv6. A firewall built for IPv4 with no matching IPv6 rules leaves everything open. This is the single most important thing to check.
  • Management interfaces on global addresses. IPMI, switch web interfaces and printers that picked up a SLAAC address and are now reachable from outside.
  • Listening on :: instead of a specific address. A service you meant to bind to the loopback or a private address listens on every address, including a global one.

Make hosts harder to find

Attackers face the same address space problem, so they rely on guessable addresses. Avoid making it easy:

  • Do not number every server ::1, ::2, ::3 in a subnet if it is reachable from outside. Low addresses are scanned first.
  • Remember that DNS reveals addresses. Do not publish AAAA records for hosts that do not need to be found.
  • Use stable privacy identifiers (RFC 7217) for clients instead of MAC-derived ones.

None of this replaces a firewall, but it raises the cost of finding what is behind it.

Keep the paperwork with the audit

An audit report is a good place to record the prefix's details: the origin ASN, the ROA, and where the LOA is kept. The LOA can be downloaded from the IPYE portal, and on a free /48 the ROA needs no work from you.

Do this next

Request a free /48, build your first target list from DNS, the plan and neighbour tables, and run an external full-port scan to compare with what you intended to expose. Questions: [email protected].

About IPYE

IPYE (https://ipye.com) leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. ASN and region changes apply automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS; WHOIS is editable on IPv6 /44 and larger. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. Claim your free /48: https://my.ipye.com/products/ipv6-rental. Questions: [email protected].

Disclosure: I run IPYE

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.