Hands-on-4: BGP Exploration and Attack

Read the following hands-on. Do as instructed, and submit your solutions in English or Chinese for the following quizes. Upload your answers to Canvas in a .pdf file.

Due is 2022/12/28 23:59

This hands-on would help you learn more about the BGP (Border Gateway Protocol) and BGP attacks.

BGP Exploration

Q1: What is BGP? Why do we need BGP in the network? Please describe it using your own words

We use an emulator in this handson. You can download the emulator from the course homepage. We recommend doing this handson on Ubuntu 20.04 or 18.04 virtual machine.

Some basic software packages are required. e.g., docker, docker-compose, python3, etc.

Start the emulation:

In this emulator, each computer (hosts or routers) is a docker container. Go to the Labsetup/output folder, run the following commands to initialize the containers:

Then you can see each computer that form a mini Internet from this URL: http://localhost:8080/map.html:

image-20221031101700358

(NOTE: The map figure may be different on your computer)

You can also access each "computer" using docker commands, such as getting a shell inside a container.

You can filter the protocols in the "Filter box" at the top left of the map. After filtering, you can see the blinks in the map that denote the network transmissions.

Click the circles in the map, which denote routers, and you can see the details of the router, take router 162 as an example:

 

image-20221031102701931

You can click Launch console to access the router. Use ip addr command, and you can see information like the following:

You can use tcpdump to capture and display packets. Run the following commands at router 162:

Keep the command executing. Now, we can find that another router, router 164, is connected with AS 12 (you can search the router by the "Search" box).

Disconnect router 164 with AS 12 by click to the Disable in "BGP sessions" in the detail menu:

image-20221031115343128

You can find that router 162 receives new packets after the disconnection between 164 and 12 through the "tcpdump" command.

Q2: Paste the information of the new packet. Explain why router 162 receives the packet after the disconnection, and how the packet is sent to the router 162.

Q3: Explain what the "AS Path" in the packet information means, and mark the path in the map.

Now re-enable the connection of AS 164 with AS 12. Again, router 162 receives new packets after the reconnection.

Q4: Paste the information of the new packet. Explain why router 162 receives the packet after the reconnection, and how the packet is sent to the router 162.

Let's try to disconnect other routers. Click router 151, disconnect it with AS 150.

Q5: Do you receive new packets this time by disconnecting AS 150 from AS 151? Explain the phenomenon.

BGP Attacks

In this section, we will try to operate a BGP attack in the emulated network.

The target we want to hijack is 10.154.0.0/24, which belongs to AS 154 in the emulator.

Firstly, randomly choose a Host in the network. For example, we use AS 160 's host_1 (whose IP is "10.160.0.72/24"), and ping AS 154's webservice_1 (10.154.0.72) from AS 160 host_1. You can see the following outputs:

Write icmp && dst 10.154.0.72 in the Filter box on the top left. You can see the traffic between AS 160 and AS 154:

image-20221031123453178

Now, we want to hijack AS 154. We choose the router from AS 153 to see its BGP configuration by the following commands:

Bird is the routing software used in the Emulator.

We add a new protocol at the end of the bird.conf: (blackhole means that the packets will be dropped)

After we reload the configuration by:

We can see the traffic from host 160 to host 154 is completely hijacked, and the ping of 160 can get nothing:

image-20221031124655413

Q6: Why the traffic from 160 to 154 is now to 153? Explain how the attack works.

Q7: Explain why we use "10.154.0.0/25" and "10.154.128.0/25" in the configure. How about 10.154.0.0/24? How about 10.154.0.0/23?

After we simply disconnect AS 153, we can see that AS 160 can connect to AS 154 again, and ping continues output results.

image-20221031125207106

Q8: Explain why AS 160 can find AS 154 now in 1 sentence.

(Hint: reference the explanation in Q2)

Q9: Explain that if AS 153 is still connected, how to help AS 160 fight back.

(Hint: match longer ip prefix)

 


REFERENCE:

https://seedsecuritylabs.org/Labs_20.04/Networking/BGP/BGP_Exploration_Attack/