1 00:00:00,000 --> 00:00:01,840 Okay, thank you everyone. 2 00:00:01,840 --> 00:00:04,220 So let's start the talk. 3 00:00:04,400 --> 00:00:07,320 Hi, I'm Su Hao from Taiwan. 4 00:00:07,640 --> 00:00:17,880 This is my first time to present at DEF CON, and also my first time at DEF CON, and also my first time at Lagos, and not my first time in US. 5 00:00:18,760 --> 00:00:22,860 Okay, so thank you all for joining my session. 6 00:00:23,140 --> 00:00:31,440 So I'm excited to share some practical Red Team networking techniques with you today. 7 00:00:31,600 --> 00:00:35,160 So I guess we can get started. 8 00:00:37,130 --> 00:00:38,650 Okay. 9 00:00:39,250 --> 00:00:48,370 So now let me take you into a typical day in my IT life, seeing my intranet LDAP server log. 10 00:00:48,370 --> 00:00:51,490 And there's a login from Frank. 11 00:00:52,370 --> 00:00:55,850 And there's a login from Bob. 12 00:00:56,790 --> 00:01:02,950 And then, wow, there's an invalid login from a public IP, 9.9.9.9. 13 00:01:04,830 --> 00:01:09,110 And how and why this can happen? 14 00:01:09,110 --> 00:01:13,630 This is an intranet server without no destination NAT. 15 00:01:14,430 --> 00:01:19,670 So, okay, as an IT, I'll ban that bad IP. 16 00:01:21,190 --> 00:01:26,790 But a second later, there's another IP attacking my server again. 17 00:01:26,790 --> 00:01:28,990 So how is that possible? 18 00:01:28,990 --> 00:01:35,210 That someone can use a public IP address to attack our intranet server. 19 00:01:35,210 --> 00:01:39,530 This is a key point that we are going to discuss in this talk. 20 00:01:39,530 --> 00:01:47,050 This presentation will explore ways of lower-level network penetration through virus of internal protocol. 21 00:01:47,190 --> 00:01:58,910 This technique can be used for advanced Red Team exercise or can be blocked before they are abused by malicious attackers in your corporate networks. 22 00:01:58,930 --> 00:02:04,050 Before we dive into the details, let me briefly introduce myself. 23 00:02:04,310 --> 00:02:07,910 Hi, I'm Su Hao Tao from Taiwan. 24 00:02:07,910 --> 00:02:12,230 And I now is a Red Teamer Trade Researcher at Tremyco. 25 00:02:12,230 --> 00:02:18,230 And I graduated from Tsinghua University in Taiwan and a former HAC-SERC president. 26 00:02:18,230 --> 00:02:24,270 I love to play something with networks and network protocols. 27 00:02:24,270 --> 00:02:33,570 I started this research for fun and it turned out that it is of great importance to general network security. 28 00:02:33,630 --> 00:02:41,350 So I'm sharing my GitHub account here where you can find all the tools and materials of this research. 29 00:02:42,210 --> 00:02:45,010 So this is today's agenda. 30 00:02:45,010 --> 00:02:54,170 First, I will share some new Red Team techniques using IP spoofing and how we can use that for initial access. 31 00:02:54,170 --> 00:03:05,410 Then, I will reveal the nightmare of VXLAN, including internal hijacking and how buggy routing protocols can lead to IP hijacking and even domain compromise. 32 00:03:05,550 --> 00:03:10,930 And finally, I will wrap up with some key takeaways before we move on to the Q&A. 33 00:03:11,830 --> 00:03:19,910 So first, I want to talk about some spoofing source IP in the public network, also known as WAN. 34 00:03:20,790 --> 00:03:27,830 We all know that even in recent years, package spoofing is still possible on public networks. 35 00:03:27,930 --> 00:03:35,210 Please know that all the IP addresses are example IP addresses, not any common or public IPs. 36 00:03:35,210 --> 00:03:44,290 An attacker with the IP address 2.2.2.2 can send a DNS request with a source IP of 3.3.3.3. 37 00:03:44,290 --> 00:03:46,930 That does not belong to itself. 38 00:03:49,860 --> 00:04:00,720 And WAN.1.1 will receive the package and it has no way to verify whether the package is a spoofed package or a valid one. 39 00:04:00,720 --> 00:04:06,260 And it will send a DNS response to the 3.3.3.3. 40 00:04:07,020 --> 00:04:13,900 So the 3.3.3.3 will receive the DNS response with our making a request. 41 00:04:13,900 --> 00:04:17,660 This is a typical DDoS, DNS amplification attack. 42 00:04:17,660 --> 00:04:19,720 And it still works nowadays. 43 00:04:20,460 --> 00:04:25,200 Next, I want to dive into the company network infrastructure. 44 00:04:25,200 --> 00:04:32,340 How IT will block a computer from accessing the public network for security purposes. 45 00:04:32,340 --> 00:04:43,580 So, for the best practice, when a package is sent from a crucial server to a public IP, it will arrive to the firewall. 46 00:04:43,580 --> 00:04:46,160 And the firewall will drop the package. 47 00:04:47,040 --> 00:04:53,160 However, we see some IT just disabled the NAT mechanism on the router. 48 00:04:53,300 --> 00:04:58,360 So the package will still forward out to the wide area network. 49 00:04:58,360 --> 00:05:07,820 And the remote server will see and receive that package and see that source IP is not valid. 50 00:05:08,200 --> 00:05:12,560 So it will either drop that package or respond to an unknown address. 51 00:05:12,560 --> 00:05:15,200 And the client will not receive the message. 52 00:05:16,520 --> 00:05:20,180 So when your code is completed, it's a mess, but it still works. 53 00:05:20,180 --> 00:05:23,220 Because the client still does not receive any response. 54 00:05:23,220 --> 00:05:26,520 So the client is not connected to the internet. 55 00:05:27,420 --> 00:05:36,980 So, if we consider both situations together, what would happen if we spoofed a source IP address on the intranet? 56 00:05:38,220 --> 00:05:41,620 Imagine a rating scenario. 57 00:05:41,620 --> 00:05:48,540 The right attacker hacked a company's device, like .1, .3. 58 00:05:48,820 --> 00:05:53,880 It can create a tunnel between the C2 server and the compromised device. 59 00:05:53,880 --> 00:06:03,440 After that, it can create a DNS request through the tunnel, which source IP is the attacker public IP, which is 9.9.9.9. 60 00:06:04,600 --> 00:06:11,780 When the package arrives the compromised device, it will forward the package to the company intranet router. 61 00:06:14,160 --> 00:06:23,080 After the router will receive the package, it will look up its routing table and forward the package to the second victim. 62 00:06:25,220 --> 00:06:38,620 As we know, if there is no firewall for the second victim, .1, .2, the response package will send back to the attacker through the public intranet. 63 00:06:39,760 --> 00:06:47,460 Then, the attacker will receive the package, when there is no evidence that the package comes from .1, .3. 64 00:06:47,460 --> 00:06:57,580 The entire TCP or UDB string only shows the IP source, IP is 9.9.9, and IP source 192.168.1.2. 65 00:06:58,580 --> 00:07:00,980 So, why IR is hard? 66 00:07:00,980 --> 00:07:10,280 In typical lateral movement attacks, the attacker used the IP address for previous compromised machine to target to the next system. 67 00:07:10,280 --> 00:07:22,360 This means, when the alarm being triggered, an IR team could simply use network log to trace the attacker path from one compromised machine to the previous one. 68 00:07:23,700 --> 00:07:32,460 The IR team could find the relevant log on the previous compromised machine and identify the initial access point. 69 00:07:33,700 --> 00:07:38,600 And then, the IR team will shut down the entire attack chain step by step. 70 00:07:40,300 --> 00:07:47,520 However, when spoofing techniques are involved, the source IP in the log will not be the previous compromised machine. 71 00:07:48,540 --> 00:07:52,820 So, the IR team will not be able to find the attacker path. 72 00:07:52,820 --> 00:07:57,480 They could only see a public IP is attacking their domain controller. 73 00:07:58,940 --> 00:08:13,780 Thus, the previous compromised machine will not be caught even if the alarm has triggered and it can change to another public source IP to continue the attack chain if the source IP is banded. 74 00:08:15,860 --> 00:08:25,660 Overlooking the attack path, the malicious package source and destination IPs only shows 9.9.9.9 and private IP 192. 75 00:08:25,660 --> 00:08:31,940 Thus, no one will know the previous compromised machine is .1.3. 76 00:08:33,100 --> 00:08:41,140 On the other hand, the terminal IP is HTTP traffic with a source IP of 7.7.7.7. 77 00:08:41,320 --> 00:08:53,280 So, if the 9.9.9 is banded, the attacker can simply switch to another public IP and attack the same target or different target. 78 00:08:53,280 --> 00:09:02,020 The IR team would need to check every router for layer 2 port locks in order to identify the compromised machine. 79 00:09:02,260 --> 00:09:07,420 Also, the source MAC address can also be forged at the first hop. 80 00:09:10,800 --> 00:09:18,160 So, what if the ISP filter package with a private source IP address? 81 00:09:18,600 --> 00:09:25,040 We can use H.323 NAT pathway to enable a temporary destination NAT. 82 00:09:26,180 --> 00:09:33,380 The attacker can send a special package to 9.9.9.9, which is its C2 server. 83 00:09:34,000 --> 00:09:46,520 The NAT router will then create a temporary destination NAT rule for a private IP 1.3.4.4.5 and open to its public IP port 4.4.5. 84 00:09:47,260 --> 00:09:54,820 This allows attackers to access private IP 1.3 on port 4.4.5 via 9.9.9.9. 85 00:09:56,240 --> 00:09:58,860 So, here's a quick demo. 86 00:09:59,360 --> 00:10:04,440 We can see that DAW 241 has a web server at 8080. 87 00:10:04,440 --> 00:10:12,340 Initially, the attacker DAW 142 could not access the intranet web server via the public IP. 88 00:10:12,540 --> 00:10:23,320 After we create a server and send a H.323 package from the compromised machine, we receive a package from the victim routers. 89 00:10:23,320 --> 00:10:32,500 And we know that the router gives me a NAT port to connect to the intranet web server. 90 00:10:32,960 --> 00:10:39,620 Also, we can see that the weblog source IP is from a public IP rather than a private IP. 91 00:10:39,620 --> 00:10:43,520 So, let's create a breakpoint for the attack chain. 92 00:10:45,260 --> 00:10:56,240 Another method discovered by Jimmy Cai involves spoofing a fake TCP sync package from the compromised device. 93 00:10:56,300 --> 00:11:07,880 Using the next target IP as the source IP address, which is .1.3 for now, and sending it to the attacker's server. 94 00:11:07,880 --> 00:11:15,040 The SNAT mechanism can be abused as a destination NAT to connect an intranet service. 95 00:11:16,400 --> 00:11:20,120 So, this is a second quick demo. 96 00:11:20,940 --> 00:11:27,220 We can see that the device at .35 has a web server running at 8080. 97 00:11:27,220 --> 00:11:35,660 Initially, the attacker at .131 could not access the intranet web server via the public IP. 98 00:11:35,660 --> 00:11:48,360 After we spoof a sync, sync package from the compromised device, using the next target IP and the port as source, and send it to the attacker's server. 99 00:11:48,500 --> 00:12:00,040 The router will create a source destination NAT, but we can abuse this route as a de- uh, destination NAT. 100 00:12:00,040 --> 00:12:09,020 So, we can, the SNAT mechanism will allow us to connect to the intranet web server. 101 00:12:09,020 --> 00:12:16,720 Additionally, we can see that the web server log shows the source IP as a public IP, rather than the private one. 102 00:12:16,720 --> 00:12:20,300 So, this also creates a breakpoint in the attack chain. 103 00:12:26,100 --> 00:12:33,800 So, next, can we replace the tunnel with, uh, official VPN? 104 00:12:33,800 --> 00:12:36,740 The answer is yes, in some cases. 105 00:12:37,160 --> 00:12:43,010 There are many commercial SSL VPN solutions that can spoof the source IP from the client. 106 00:12:43,400 --> 00:12:52,140 As shown in the diagram, commercial SSL VPN like those discussed at CyberSec 2025 may allow this behavior. 107 00:12:52,660 --> 00:13:02,180 On the other hand, whether open source VPN solutions like WireGuard or OpenVPN are affected depends on their configuration. 108 00:13:04,640 --> 00:13:07,380 So, where's the initial access? 109 00:13:07,640 --> 00:13:12,080 Do we have a chance to do this without an initial foothold in intranet? 110 00:13:12,080 --> 00:13:15,060 Can we use any existing tunnel? 111 00:13:16,380 --> 00:13:18,520 The answer is yes. 112 00:13:18,520 --> 00:13:23,380 On the internet exchange, everyone is on the same layer 2 network. 113 00:13:23,420 --> 00:13:30,960 Attacker can set a private network range as the next hop to the router of the company you want to attack. 114 00:13:30,960 --> 00:13:38,700 Also, the second method, we can abuse an existing tunnel such as GRE, IPIP, or SIP tunnel. 115 00:13:38,700 --> 00:13:42,980 But again, a good firewall configuration could cause this fail. 116 00:13:43,840 --> 00:13:59,180 So, in the intranet exchange, if we compromise a router at an intranet exchange, or we can just rent an IXP VM to assess an intranet exchange. 117 00:13:59,180 --> 00:14:05,780 We can force a private subnet as the next hop to the victim company router. 118 00:14:05,780 --> 00:14:16,540 And then, we can create a connection using our own public IP as the source IP and a private subnet as a destination. 119 00:14:16,540 --> 00:14:34,800 The victim router will forward the package to its intranet via its routing table and the intranet target will respond to the attacker to its public IP because the package source IP is a public one. 120 00:14:36,060 --> 00:14:41,240 On the other hand, we can abuse existing tunnel like GRE. 121 00:14:41,560 --> 00:14:43,750 So first, what is a GRE? 122 00:14:45,330 --> 00:14:48,930 GRE is a stateless layer 3 tunnel. 123 00:14:49,090 --> 00:15:00,890 This is widely used because it is easy to set up by only setting its protocol GRE public IP and GRE interface IP and its routing table, which is the next hop. 124 00:15:02,350 --> 00:15:06,410 Nowadays, there are still a lot of companies that use GRE. 125 00:15:06,410 --> 00:15:10,330 Like Cloudflare, Magic Transcend, and its customer. 126 00:15:10,330 --> 00:15:14,630 They can choose between IPsec or GRE, and IPsec is safer. 127 00:15:15,350 --> 00:15:24,630 And AWS Transit Gateway also supports GRE tunnel, but sadly, it's used for internal networking only. 128 00:15:24,910 --> 00:15:35,490 Also, Security Week reports that APT groups like Salt Typhoon create GRE tunnels to collect traffic from compromised devices. 129 00:15:35,490 --> 00:15:39,930 Last, a lot of companies also use GRE tunnel, but we don't know. 130 00:15:41,650 --> 00:15:43,730 So how does GRE work? 131 00:15:44,010 --> 00:15:53,210 When a package wants to go through a GRE tunnel, the kernel will pack the packet with a GRE header and send it over the public internet. 132 00:15:53,690 --> 00:16:02,090 At the receiver side, the GRE packet is unpacked and the inner packet is forward according to its routing table. 133 00:16:02,090 --> 00:16:12,590 GRE is stateless and doesn't provide any encryption, which means it's possible for everyone can spoof a GRE packet via a public network. 134 00:16:13,710 --> 00:16:24,430 For example, a private IP 1.2 wants to send a packet to another site, .2.2. 135 00:16:24,430 --> 00:16:27,970 The packet will send to its default gateway. 136 00:16:29,770 --> 00:16:40,190 And because it is a GRE tunnel, the gateway router will add a GRE header to the packet and then send it through the public internet. 137 00:16:41,330 --> 00:16:52,170 After a GRE packet arrives at 2.2.2, it will remove the GRE header and forward the inner packet according to its routing table. 138 00:16:55,350 --> 00:16:59,790 And then the 2.2.2 receives the packet. 139 00:16:59,790 --> 00:17:05,410 And if it wants to respond to the packet, the vice versa. 140 00:17:06,230 --> 00:17:21,950 The packet will send back to its default gateway and add the GRE header and send back to the 1.1.1 router and remove the GRE header and send it back to the 1.2. 141 00:17:24,170 --> 00:17:30,170 So, how do we find a GRE tunnel? 142 00:17:30,630 --> 00:17:32,730 We can use OSINT techniques. 143 00:17:32,730 --> 00:17:42,390 For example, we can search for a net floor dashboard like a photo on Google and filter for GRE traffic. 144 00:17:42,770 --> 00:17:47,830 This way we can obtain the IP address on both ends of the tunnel. 145 00:17:48,170 --> 00:17:50,810 Other OSINT techniques can also help too. 146 00:17:53,130 --> 00:18:01,390 Also, we can use GRE spoofing techniques to scan for existing GRE tunnels. 147 00:18:01,770 --> 00:18:08,050 First, we can create a GRE tunnel using the command provided above. 148 00:18:08,930 --> 00:18:20,340 Then we can craft a GRE packet with a spoofed source IP address that does not belong to us and send it over the public network to the victim. 149 00:18:20,340 --> 00:18:37,520 If the victim has a GRE peer conflict with the GRE packet source IP, for example, 1.1.1, it will decapsulate the inner packet and process it according to its routing table and forward to the inner packet. 150 00:18:38,920 --> 00:18:47,540 So, we can create and send many packets with different source IP addresses to proof of the correct victim peer. 151 00:18:49,300 --> 00:18:57,520 If the victim does not recognize the source IP as a known peer, it will drop the packet. 152 00:18:58,220 --> 00:19:13,000 On the other hand, if the source IP matches one of the victim known peers, the victim will accept the GRE packet and forward the inner packet according to its routing table. 153 00:19:13,900 --> 00:19:20,400 For scanning purpose, we set the destination of the inner packet to the victim itself. 154 00:19:20,760 --> 00:19:33,400 So, the victim will immediately reply the inner packet with an ICMP response and send it back to the attacker. 155 00:19:33,400 --> 00:19:44,730 Then, we can identify the victim GRE internal peer IP address by its ID finder and sequence. 156 00:19:45,060 --> 00:20:01,610 We can encode the information into ICMP ID finder and sequence field, which together can represent all 255 to the part of four possible IPv4 addresses. 157 00:20:04,530 --> 00:20:07,790 We also create a scanner script on GitHub. 158 00:20:07,790 --> 00:20:16,950 As you can see, when a GRE source address matches the remote GRE peer address, we can get an ICMP reply. 159 00:20:25,410 --> 00:20:29,930 Then, we can put everything together to get an initial access. 160 00:20:30,970 --> 00:20:37,850 Let's imagine a scenario the victim 1.1.1 has a GRE internal with 2.2.2. 161 00:20:37,850 --> 00:20:45,590 An attacker can forge a GRE packet that appears to be sent from 2.2.2. 162 00:20:45,590 --> 00:20:55,050 The inner packet is a DNS request sent from the provider IP 3.3.3 to an internal network IP. 163 00:20:58,800 --> 00:21:08,940 When the packet arrives, the victim will trust and use the GRE packet because it can claim to come from 2.2.2.2. 164 00:21:08,940 --> 00:21:20,320 Then, the victim will unpack the GRE packet and discover that it contains a DNS request whose destination is a private network IP. 165 00:21:20,320 --> 00:21:29,240 The victim will then forward the packet to its company intranet based on its routing table. 166 00:21:32,810 --> 00:21:45,250 Then, when the internal DNS server receives the DNS packet, it will respond and send a reply through the public internet to the attacker server. 167 00:21:48,790 --> 00:21:56,070 Thus, the attacker can interact with services on the victim intranet, including those using the TCP protocol. 168 00:21:58,010 --> 00:22:00,110 We have created a demo lab. 169 00:22:00,110 --> 00:22:03,230 The architecture is illustrated in the diagram. 170 00:22:03,230 --> 00:22:09,430 We have a target router whose GRE peer is 1.1.1. 171 00:22:09,430 --> 00:22:15,290 And there is an intranet waste server whose public network is 1.2. 172 00:22:16,530 --> 00:22:26,470 The waste server is hosted on 1.2 and the server can access the public network via SNAT. 173 00:22:29,850 --> 00:22:38,910 On the other hand, the router has a GRE internal and it can directly access the intranet waste server. 174 00:22:39,070 --> 00:22:47,690 And also, he has a public IP and we can see that there is a GRE internal. 175 00:22:47,690 --> 00:22:51,070 The peer is 1.1.1.1. 176 00:22:51,070 --> 00:23:07,610 So, initially, the attacker at IP address .142 cannot access the private network 192.168.1.2. 177 00:23:07,610 --> 00:23:25,030 Then, the attacker can create a spoofed GRE internal via the command shown above to the victim router and directly send traffic to the private address 1.2 through the fake internal. 178 00:23:25,610 --> 00:23:31,670 Then, the attacker can direct access and interact with the internal waste server. 179 00:23:33,520 --> 00:23:46,020 Similarly, if the layer 2 internal like GRE tab, also, if we can leak the victim MAC address, we can also exploit this in the same way. 180 00:23:46,020 --> 00:23:50,940 It is common to use the SNMP protocol to obtain this. 181 00:23:52,700 --> 00:24:10,180 For a short TLDR summary, when a company does not configure its firewall and use database on encrypted internal, even if it is a legacy configuration, an attacker can exploit this internal for initial access to the intranet. 182 00:24:12,080 --> 00:24:17,780 So, then, we will reveal a nightmare of default configuration of VXLAN. 183 00:24:18,920 --> 00:24:20,860 So, what is a VXLAN? 184 00:24:21,860 --> 00:24:27,080 VXLAN is a stateless and unencrypted layer 2 internal. 185 00:24:27,980 --> 00:24:33,980 It packs layer 2 Ethernet frame into a layer 4 UDP packet. 186 00:24:34,680 --> 00:24:41,060 Each subnet is uniquely identified by a name called VNI. 187 00:24:43,020 --> 00:24:54,880 We can configure VXLAN internal similar to the GRE by giving the remote IP, local IP, and destination port and VNI. 188 00:24:54,880 --> 00:24:58,380 However, this configuration is vulnerable. 189 00:25:00,520 --> 00:25:07,980 Based on the previous configuration, set up a standard VXLAN peer is easy as usual. 190 00:25:08,680 --> 00:25:11,300 How about hijacking a VXLAN internal? 191 00:25:13,740 --> 00:25:16,420 Yes, here's the only difference. 192 00:25:16,420 --> 00:25:21,220 The only thing you have to change is your local IP argument. 193 00:25:22,600 --> 00:25:24,980 So, why does this happen? 194 00:25:24,980 --> 00:25:32,140 Does the Linux kernel doesn't check the source IP for VXLAN packet? 195 00:25:32,140 --> 00:25:40,140 How does it accept VXLAN packet with a valid VNI import even if the source IP is not configured? 196 00:25:42,690 --> 00:25:48,990 After looking at the Linux memo, you will see that this is a feature but not a bug. 197 00:25:49,630 --> 00:25:54,910 But this feature is insecure and it turned on by default. 198 00:25:55,250 --> 00:25:59,930 Before reporting, router OS couldn't turn this feature down. 199 00:25:59,930 --> 00:26:04,270 Now, you can change the setting to off but it's still on by default. 200 00:26:06,730 --> 00:26:11,990 So, what happens when learning is enabled in VXLAN? 201 00:26:13,670 --> 00:26:29,910 Normally, when a configured peer sends a VXLAN packet, the kernel will add its MAC address to the FDB, also known as forwarding database table, shown at the bottom on the slide. 202 00:26:30,710 --> 00:26:48,250 The next time a packet needed to be sent to the destination MAC address that is listed in the FDB table, the kernel will pack and send the packet to the remote location using the information from the FDB table. 203 00:26:53,650 --> 00:27:03,710 Similarly, when learning mode is enabled, any VXLAN packet with a valid VNI import will be added to the FDB table. 204 00:27:04,930 --> 00:27:11,290 Also, the remote IP could be any IP on the internet. 205 00:27:13,230 --> 00:27:25,510 Thus, an attacker 9.9.9.9 can create a VXLAN packet with a MAC address which is broadcast address FFFFF. 206 00:27:25,510 --> 00:27:30,890 And the Linux kernel will add this MAC address to the list. 207 00:27:31,930 --> 00:27:46,180 Then, when the kernel wants to send a broadcast package on the VXLAN interface, it will look up the FDB table and then send it to the attacker server, which is 9.9.9.9. 208 00:27:50,550 --> 00:27:55,790 So, we know how VXLAN works. 209 00:27:56,070 --> 00:28:01,250 How do we get the information that we can hijack a VXLAN? 210 00:28:01,250 --> 00:28:13,530 We know our own IP, but we don't know the victim's IP, or VNI, or VXLAN inner subnet. 211 00:28:13,770 --> 00:28:18,450 However, all this information can be obtained by a simple scan. 212 00:28:19,690 --> 00:28:26,190 An attacker can discover the victim IP port and VNI by sending numerous packets. 213 00:28:27,190 --> 00:28:33,590 So, let's focus on how to determine the VXLAN inner subnet range. 214 00:28:34,610 --> 00:28:46,810 We can gather information by sending a single VXLAN packet where both the source and destination MAC address are set to the broadcast address LAN. 215 00:28:46,850 --> 00:28:54,570 When an ARP request is sent from the VXLAN interface, they will also send a copy to the attacker. 216 00:28:57,540 --> 00:29:03,900 Another method involves sending a neighbor-discovered protocol packet. 217 00:29:03,900 --> 00:29:16,960 When a router always receives a broadcast neighbor-discovered protocol, NDP, message, it will respond to the broadcasting MAC address with its own IP and MAC address. 218 00:29:19,830 --> 00:29:26,210 Thus, we can send numerous VXLAN packets with different VNI and port configurations. 219 00:29:26,210 --> 00:29:37,230 Each contains an inner NDP packet where both the source and destination MAC address are set to the broadcast address. 220 00:29:40,840 --> 00:29:52,240 When the VNI and port matches the victim configuration, the victim device will add the attacker's IP to its FDB table. 221 00:29:53,160 --> 00:30:00,000 Then, the victim unpacks the VXLAN package and sees that it is an NDP request. 222 00:30:00,000 --> 00:30:08,180 The victim router replies to the NDP packet and tries to send a response to the broadcast MAC address. 223 00:30:08,180 --> 00:30:17,640 It checks the FDB table and finds that the destination is 9.9.9.9, which is the attacker IP. 224 00:30:19,380 --> 00:30:24,880 So, the router will send the packet to the attacker. 225 00:30:27,300 --> 00:30:31,260 Then, the attacker has everything to hijack the terminal. 226 00:30:34,250 --> 00:30:36,050 We create a scanner. 227 00:30:36,050 --> 00:30:41,790 We can discover the victim IP port and VNI by sending numerous packets. 228 00:30:41,790 --> 00:30:49,530 VXLAN has default ports 4789 and 8472, and VNI is usually smaller than 100. 229 00:30:49,530 --> 00:30:51,370 Here's a scanner link. 230 00:30:54,510 --> 00:31:03,690 We have also created a lab for VXLAN scanner demonstration, which includes a router and a web server. 231 00:31:05,230 --> 00:31:12,790 So, for demo, we can see that the scanner aims to scan the target at .200. 232 00:31:12,790 --> 00:31:17,690 The scanner sends numerous packets with different default ports and different VNIs. 233 00:31:17,690 --> 00:31:24,930 Later, we can receive an NDP reply with VNI 42 and port 8472. 234 00:31:24,930 --> 00:31:28,590 The inerts are made in 10.0.0.1. 235 00:31:28,590 --> 00:31:36,410 Then, by simplifying, we can simply create a VXLAN with the information above. 236 00:31:36,410 --> 00:31:40,990 We can direct access the VXLAN intranet server. 237 00:31:44,200 --> 00:31:49,060 We also scan for insecure VXLAN configuration worldwide. 238 00:31:49,060 --> 00:31:54,940 Usually, using VNI equals one and default ports. 239 00:31:55,240 --> 00:32:00,480 We found that more than 900 VXLAN endpoints respond to the scanner. 240 00:32:00,500 --> 00:32:05,980 Additionally, there are 4,000 IPs inside the VXLAN subnet. 241 00:32:05,980 --> 00:32:11,860 Some of these are public IPs, which means we can hijack public IPs. 242 00:32:12,700 --> 00:32:17,680 Additionally, some endpoints reply to numerous broadcast packets. 243 00:32:17,680 --> 00:32:23,800 Combined with the IP spoofing, this can lead to DDoS attack. 244 00:32:24,480 --> 00:32:32,200 Lastly, we see some VXLAN packets have source IPs that are private addresses. 245 00:32:32,820 --> 00:32:34,500 This raises a question. 246 00:32:34,500 --> 00:32:39,180 Why are the private addresses being used as a source IP on the VXLAN packet? 247 00:32:40,940 --> 00:32:46,460 So, if I use VXLAN in an encrypted terminal, am I safe? 248 00:32:48,320 --> 00:32:50,240 The answer is no. 249 00:32:51,120 --> 00:32:55,480 VXLAN still accepts packet traffic in different interfaces. 250 00:32:56,500 --> 00:33:06,340 So, if you have a public IP interface and also you create a VXLAN interface, it can be scanned and hijacked. 251 00:33:09,910 --> 00:33:18,230 For TLDR, we can hijack a VXLAN terminal using only 3 pieces of concept. 252 00:33:18,330 --> 00:33:23,230 The victim IP address, the VXLAN port, and the VNI. 253 00:33:24,070 --> 00:33:29,570 There is no need to know the peer IP and internal IP address. 254 00:33:29,570 --> 00:33:38,070 Furthermore, if your network is set up including a public IP address and VXLAN on any interface, it is highly vulnerable. 255 00:33:39,230 --> 00:33:45,150 So, what can hackers do after hijacking a VXLAN terminal? 256 00:33:46,910 --> 00:34:00,430 Not only can attackers gain initial access to the company intranet, but also they can hijack IP communication or perform a man-in-the-middle attack between the two sites. 257 00:34:00,430 --> 00:34:09,770 Additionally, attackers can target their two network services such as exporting RADVD to RCE vulnerabilities. 258 00:34:11,350 --> 00:34:16,170 Incident response is challenging because the source IP cannot be trusted. 259 00:34:16,170 --> 00:34:25,610 Moreover, these terminals often run routing protocols like BGP or OSPF. 260 00:34:25,610 --> 00:34:36,990 Attackers can hijack IPs that are even not transmissioning through that terminal, such as those of a domain controller or an EXXI server. 261 00:34:38,770 --> 00:34:41,730 So, what is a routing protocol? 262 00:34:42,330 --> 00:34:50,810 It is a protocol like a router can exchange routes and network information with other routers. 263 00:34:50,810 --> 00:35:02,630 Routing protocols help routers to directly learn about the networks around them and to determine the best path for forwarding the packet. 264 00:35:02,830 --> 00:35:16,000 For example, Router A has a subnet 192.168.1.0.24 and Router C could learn the routes from Router B by routing protocols. 265 00:35:17,360 --> 00:35:24,840 We often see companies use VXLAN terminals to connect to sites with routing protocols. 266 00:35:26,240 --> 00:35:35,360 But when we combine this with a learning feature, we can hijack router's AIP. 267 00:35:36,580 --> 00:35:45,980 Then, we can announce, we can connect to the routing protocols and announce domain controller's IP in the routing protocols. 268 00:35:46,000 --> 00:35:48,280 With slash 72. 269 00:35:50,500 --> 00:36:06,340 Other routers will receive and trust the routing prefix and redirect their domain controller's traffic to the attacker because the route is more specific, more smaller than the subnet. 270 00:36:09,040 --> 00:36:15,580 We have summarized the potential impact of hijacking different service IP. 271 00:36:16,840 --> 00:36:33,440 If an attacker hijacks the IP of domain controller and NTLN is possible, meaning SMB signing is disabled or ADCS ESC 8 is present, they can take over the entire domain. 272 00:36:33,440 --> 00:36:50,520 If an attacker hijacks the IP of vSphere, Proxmox or any HTTPS service and the original SSL certificate is unsigned or not valid, user may not be noticed. 273 00:36:50,700 --> 00:36:55,800 And the attacker can then take over the account or the full server. 274 00:36:55,800 --> 00:37:07,160 In short, hijacking this service IP can lead to account takeover, denial of service, DNS hijack or even full domain compromise or server compromise. 275 00:37:09,140 --> 00:37:11,380 And here's a bonus. 276 00:37:11,600 --> 00:37:17,260 A bad configuration in the company's OSPF lead to IP hijacking. 277 00:37:17,260 --> 00:37:25,240 This attack factor has been published for years and we actually observed it during our rating scenario. 278 00:37:25,800 --> 00:37:29,040 Yet, very few people discuss it. 279 00:37:30,520 --> 00:37:35,900 Do you check and use a TCP dump after you get into an intranet? 280 00:37:36,520 --> 00:37:42,000 If you see this on the victim intranet, it might be vulnerable. 281 00:37:44,590 --> 00:38:01,530 Just like the exploitation method described in the previous slide, if you see a hello package, there is a highly possible that you can direct establish an OSPF connection with the router and hijack the routes. 282 00:38:02,190 --> 00:38:12,990 So, in short, we can, if we connect to the OSPF, we can hijack the domain controller again and get previous escalation. 283 00:38:15,390 --> 00:38:18,790 Next, there are some key takeaways. 284 00:38:20,010 --> 00:38:23,230 Here's the key takeaways for Blue Team. 285 00:38:23,310 --> 00:38:27,890 First, check all unencrypted tunnels in your company's network. 286 00:38:27,890 --> 00:38:30,570 If you find any, don't use them. 287 00:38:30,970 --> 00:38:35,870 This includes protocols like GRE, IPIP, SIT, GRE-TAP and DXLAN. 288 00:38:35,870 --> 00:38:39,550 These tunnels are not secure and can be abused by attackers. 289 00:38:40,110 --> 00:38:43,730 Next, make sure you have secure firewall in place. 290 00:38:43,850 --> 00:38:55,950 Your firewall should filter outbound intranet traffic, especially SYN-ASDK packet with a response from server. 291 00:38:56,370 --> 00:39:01,910 Also, check for IP spoofing in your intranet. 292 00:39:01,910 --> 00:39:11,970 Ideally, OSPF should fill out spoofed IP address, but in reality, this is rarely possible. 293 00:39:11,970 --> 00:39:17,710 Check if OSPF is not enabled on ports between routers. 294 00:39:17,710 --> 00:39:21,190 It's only enabled on ports between routers. 295 00:39:21,190 --> 00:39:25,180 OSPF should not open on unnecessary port. 296 00:39:26,370 --> 00:39:31,390 Monitor your routing prefix for any anomalies. 297 00:39:31,750 --> 00:39:37,180 Unaccept change in router protocol can indicate an ongoing attack. 298 00:39:37,180 --> 00:39:46,000 Finally, set minimum accept prefix size in your routing protocol, for example, slash 24. 299 00:39:46,420 --> 00:40:01,100 In summary, avoid unencrypted tunnels, secure your firewall, filter for IP spoofing, restrict OSPF, monitor routing and enforce minimum prefix size. 300 00:40:02,220 --> 00:40:04,290 And here's the takeaway for writing. 301 00:40:05,550 --> 00:40:12,650 First, scan or use OSINT techniques to find victims on encrypted tunnels. 302 00:40:12,710 --> 00:40:16,390 These can be entry point into the network. 303 00:40:16,930 --> 00:40:22,290 Once you are inside the intranet, check the victim's network setup for spoofing. 304 00:40:23,190 --> 00:40:28,350 Use source IP spoofing techniques during high-risk scanning to avoid detection. 305 00:40:28,350 --> 00:40:36,730 Look for OSPF upload message to identify active routing protocols and potential attack path. 306 00:40:37,350 --> 00:40:40,550 Scan for misconfiguration via extended tunnel. 307 00:40:40,550 --> 00:40:47,390 If you find a vulnerable tunnel, hijack it to get initial access. 308 00:40:48,030 --> 00:40:54,230 Abuse routing protocols and hijack IP for lateral movement and privilege escalation. 309 00:40:54,230 --> 00:40:58,490 Automating can continue looking for more vulnerable protocols in future. 310 00:40:58,490 --> 00:41:01,110 Remember, scan, find, hack. 311 00:41:05,200 --> 00:41:08,940 And here are some takeaway for tool makers. 312 00:41:09,680 --> 00:41:16,120 First, implement intranet IP spoofing command control tools. 313 00:41:16,920 --> 00:41:24,200 Develop automated tools to test possible of IP spoofing within a target intranet. 314 00:41:24,200 --> 00:41:26,140 Create automation save times. 315 00:41:26,500 --> 00:41:38,400 Create automated correction mechanism for mismatch between IP destination and source address within the same TCP session. 316 00:41:38,620 --> 00:41:41,340 Some routers still perform SNAT. 317 00:41:41,340 --> 00:41:44,500 Even the packet is a server response. 318 00:41:47,300 --> 00:41:57,260 Automate the process of sending H.323 package or new TCP packet to trigger a routing mechanism. 319 00:41:57,380 --> 00:42:02,680 Especially for ISP that filter private IP as a source IP address. 320 00:42:03,720 --> 00:42:07,840 Develop tools for automation OSPF IP hijacking attacks. 321 00:42:07,840 --> 00:42:14,600 And finally, implement a more efficient GIS scanner for global scanning. 322 00:42:14,600 --> 00:42:19,260 Similar to what MaxScan does for TCP. 323 00:42:19,920 --> 00:42:22,060 So, thank you everyone.