LOKI and author's Black Hat presentation can be downloaded here: http://www.ernw.de/content/e6/e180/index_eng.html
Falsifying routing information can have disastrous consequences to network stability. For example an attacker could reroute traffic through a monitoring station and capture traffic for later analysis. An attacker could also reroute traffic to a black hole or reroute a 10 Gig transit link traffic towards a 1 GB link causing a Denial of Service (DoS) condition.
Both network topology and scenario presented in this post are extremely simplistic but should be sufficient to present potential implications.
Our topology:
R1's routing table looks as follows:
R1#show ip route
C 20.0.0.0/8 is directly connected, FastEthernet1/0
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, FastEthernet0/0
O 192.168.5.0/24 [110/2] via 172.16.0.1, 00:00:01, FastEthernet0/0
10.0.0.0/32 is subnetted, 1 subnets
C 10.0.0.1 is directly connected, Loopback0
O 192.168.6.0/24 [110/3] via 172.16.0.1, 00:00:01, FastEthernet0/0
Its OSPF neighbor table:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.5.2 1 FULL/BDR 00:00:35 172.16.0.1 FastEthernet0/0
To launch LOKI in its default directory - #python /usr/bin/loki.py
Once we click run, LOKI will by default capture all control plane protocols it supports. In the screenshot below we can see that LOKI captured an OSPF Hello packet from its adjacent router. From the captured packet we can see the following:
From here we can craft our own OSPF packets.
Firstly we'll send an empty Hello packet and see what happens. To do so we set "area" to "1" and Authentication type to "AUTH_NONE". We start sending packets by clicking "Hello".
In R1's console we confirm that adjacency was set up:
*Mar 1 04:42:46.654: %OSPF-5-ADJCHG: Process 1, Nbr 20.0.0.2 on FastEthernet1/0 from LOADING to FULL, Loading Done
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
20.0.0.2 1 FULL/BDR 00:00:38 20.0.0.2 FastEthernet1/0
192.168.5.2 1 FULL/BDR 00:00:35 172.16.0.1 FastEthernet0/0
To get even more details we enable debugging.
R1#debug ip ospf events
*Mar 1 00:58:49.691: OSPF: Rcv hello from 20.0.0.2 area 1 from FastEthernet1/0 20.0.0.2
*Mar 1 00:58:49.691: OSPF: 2 Way Communication to 20.0.0.2 on FastEthernet1/0, state 2WAY
*Mar 1 00:58:49.695: OSPF: Neighbor change Event on interface FastEthernet1/0
*Mar 1 00:58:49.695: OSPF: DR/BDR election on FastEthernet1/0
*Mar 1 00:58:49.695: OSPF: Elect BDR 20.0.0.2
*Mar 1 00:58:49.695: OSPF: Elect DR 10.0.0.1
*Mar 1 00:58:49.695: DR: 10.0.0.1 (Id) BDR: 20.0.0.2 (Id)
*Mar 1 00:58:49.699: OSPF: Send DBD to 20.0.0.2 on FastEthernet1/0 seq 0x24F2 opt 0x52 flag 0x7 len 32
*Mar 1 00:58:49.699: OSPF: Neighbor change Event on interface FastEthernet1/0
*Mar 1 00:58:49.699: OSPF: DR/BDR election on FastEthernet1/0
*Mar 1 00:58:49.699: OSPF: Elect BDR 20.0.0.2
*Mar 1 00:58:49.703: OSPF: Elect DR 10.0.0.1
*Mar 1 00:58:49.703: DR: 10.0.0.1 (Id) BDR: 20.0.0.2 (Id)
*Mar 1 00:58:49.703: OSPF: Send immediate hello to nbr 20.0.0.2, src address 20.0.0.2, on FastEthernet1/0
*Mar 1 00:58:49.703: OSPF: Send hello to 20.0.0.2 area 1 on FastEthernet1/0 from 20.0.0.1
*Mar 1 00:58:49.707: OSPF: End of hello processing
At this point we've set ourselves up as an OSPF neighbor and successfully created an adjacency.
Now we'll inject a false route to network 192.168.5.0/24.
Now R1 believes that it can get to network 192.168.5.0/24 via F0/0 (real route) and F1/0 (bogus route). Both paths have the same cost.
R1#show ip route
C 20.0.0.0/8 is directly connected, FastEthernet1/0
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, FastEthernet0/0
O 192.168.5.0/24 [110/2] via 172.16.0.1, 00:00:00, FastEthernet0/0
[110/2] via 20.0.0.2, 00:00:00, FastEthernet1/0
10.0.0.0/32 is subnetted, 1 subnets
C 10.0.0.1 is directly connected, Loopback0192.
O 192.168.6.0/24 [110/3] via 172.16.0.1, 00:00:00, FastEthernet0/0
We didn't do any actual damage in this example, but this type of attack in an enterprise network could cause serious disruptions.
This attack can be easily defeated in a number of ways. We can use OSPF authentication, passive interfaces, access control lists or route filtering. Actually all of the above should be used together. More on defenses some other time.
LOKI supports both clear text (though I couldn't get it to work) and MD5 authentication for OSPF. Clear text is not much of security as the key is sent in clear text so it can be sniffed. In
LOKI detects type of authentication used and let's us attempt to crack it. We can feed it a word list or use brute force. LOKI cracked my key of "test" (not much of a key) on a slow VM in a couple of seconds.
Falsifying routing information can have disastrous consequences to network stability. For example an attacker could reroute traffic through a monitoring station and capture traffic for later analysis. An attacker could also reroute traffic to a black hole or reroute a 10 Gig transit link traffic towards a 1 GB link causing a Denial of Service (DoS) condition.
Both network topology and scenario presented in this post are extremely simplistic but should be sufficient to present potential implications.
Our topology:
R1's routing table looks as follows:
R1#show ip route
C 20.0.0.0/8 is directly connected, FastEthernet1/0
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, FastEthernet0/0
O 192.168.5.0/24 [110/2] via 172.16.0.1, 00:00:01, FastEthernet0/0
10.0.0.0/32 is subnetted, 1 subnets
C 10.0.0.1 is directly connected, Loopback0
O 192.168.6.0/24 [110/3] via 172.16.0.1, 00:00:01, FastEthernet0/0
Its OSPF neighbor table:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.5.2 1 FULL/BDR 00:00:35 172.16.0.1 FastEthernet0/0
To launch LOKI in its default directory - #python /usr/bin/loki.py
Once we click run, LOKI will by default capture all control plane protocols it supports. In the screenshot below we can see that LOKI captured an OSPF Hello packet from its adjacent router. From the captured packet we can see the following:
- IP address the hello was sent from is 20.0.0.1
- router ID is 10.0.0.1 (by default highest loopback interface address)
- OSPF Area is 1
- OSPF authentication is not enabled
From here we can craft our own OSPF packets.
Firstly we'll send an empty Hello packet and see what happens. To do so we set "area" to "1" and Authentication type to "AUTH_NONE". We start sending packets by clicking "Hello".
In R1's console we confirm that adjacency was set up:
*Mar 1 04:42:46.654: %OSPF-5-ADJCHG: Process 1, Nbr 20.0.0.2 on FastEthernet1/0 from LOADING to FULL, Loading Done
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
20.0.0.2 1 FULL/BDR 00:00:38 20.0.0.2 FastEthernet1/0
192.168.5.2 1 FULL/BDR 00:00:35 172.16.0.1 FastEthernet0/0
To get even more details we enable debugging.
R1#debug ip ospf events
*Mar 1 00:58:49.691: OSPF: Rcv hello from 20.0.0.2 area 1 from FastEthernet1/0 20.0.0.2
*Mar 1 00:58:49.691: OSPF: 2 Way Communication to 20.0.0.2 on FastEthernet1/0, state 2WAY
*Mar 1 00:58:49.695: OSPF: Neighbor change Event on interface FastEthernet1/0
*Mar 1 00:58:49.695: OSPF: DR/BDR election on FastEthernet1/0
*Mar 1 00:58:49.695: OSPF: Elect BDR 20.0.0.2
*Mar 1 00:58:49.695: OSPF: Elect DR 10.0.0.1
*Mar 1 00:58:49.695: DR: 10.0.0.1 (Id) BDR: 20.0.0.2 (Id)
*Mar 1 00:58:49.699: OSPF: Send DBD to 20.0.0.2 on FastEthernet1/0 seq 0x24F2 opt 0x52 flag 0x7 len 32
*Mar 1 00:58:49.699: OSPF: Neighbor change Event on interface FastEthernet1/0
*Mar 1 00:58:49.699: OSPF: DR/BDR election on FastEthernet1/0
*Mar 1 00:58:49.699: OSPF: Elect BDR 20.0.0.2
*Mar 1 00:58:49.703: OSPF: Elect DR 10.0.0.1
*Mar 1 00:58:49.703: DR: 10.0.0.1 (Id) BDR: 20.0.0.2 (Id)
*Mar 1 00:58:49.703: OSPF: Send immediate hello to nbr 20.0.0.2, src address 20.0.0.2, on FastEthernet1/0
*Mar 1 00:58:49.703: OSPF: Send hello to 20.0.0.2 area 1 on FastEthernet1/0 from 20.0.0.1
*Mar 1 00:58:49.707: OSPF: End of hello processing
At this point we've set ourselves up as an OSPF neighbor and successfully created an adjacency.
Now we'll inject a false route to network 192.168.5.0/24.
Now R1 believes that it can get to network 192.168.5.0/24 via F0/0 (real route) and F1/0 (bogus route). Both paths have the same cost.
R1#show ip route
C 20.0.0.0/8 is directly connected, FastEthernet1/0
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, FastEthernet0/0
O 192.168.5.0/24 [110/2] via 172.16.0.1, 00:00:00, FastEthernet0/0
[110/2] via 20.0.0.2, 00:00:00, FastEthernet1/0
10.0.0.0/32 is subnetted, 1 subnets
C 10.0.0.1 is directly connected, Loopback0192.
O 192.168.6.0/24 [110/3] via 172.16.0.1, 00:00:00, FastEthernet0/0
We didn't do any actual damage in this example, but this type of attack in an enterprise network could cause serious disruptions.
This attack can be easily defeated in a number of ways. We can use OSPF authentication, passive interfaces, access control lists or route filtering. Actually all of the above should be used together. More on defenses some other time.
LOKI supports both clear text (though I couldn't get it to work) and MD5 authentication for OSPF. Clear text is not much of security as the key is sent in clear text so it can be sniffed. In
LOKI detects type of authentication used and let's us attempt to crack it. We can feed it a word list or use brute force. LOKI cracked my key of "test" (not much of a key) on a slow VM in a couple of seconds.
Comments
Post a Comment