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
Removing trailing white spaces and fixing typo (#5383)
* Remove trailing white spaces
Trailing whitespaces are removed from all files, empty lines and
image files are preserved. This patch is created using the following
shell commands:
find . -type f -not -path '*/\.*' -exec sed -i '/^$/!s/[ \t]*$//' {} \;
* docs/reference_guide.md: Fix typo
Copy file name to clipboardExpand all lines: examples/networking/tcp_mon_block/README.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,24 @@
1
1
# eBPF tcp_mon_block
2
2
3
-
This eBPF program uses netlink TC, kernel tracepoints and kprobes to monitor outgoing connections from given PIDs (usually HTTP web servers) and block connections to all addresses initiated from them, unless they are listed in allow_list.json
3
+
This eBPF program uses netlink TC, kernel tracepoints and kprobes to monitor outgoing connections from given PIDs (usually HTTP web servers) and block connections to all addresses initiated from them, unless they are listed in allow_list.json
4
4
5
5
To run the example:
6
6
7
7
1. Run python3 web_server.py . Note the server's PID (will be printed to stdout)
8
8
2. Add the server's PID to allow_list.json . You can replace the first entry on the JSON file and put your PID instead
9
9
3. Run tcp_mon_block.py -i network_interface_name (-v for verbose output). For example: python3 tcp_mon_block.py -i eth0
10
-
4. Put your web_server's listening IP in 'server_address' variable in http_client.py and run python3 http_client.py
10
+
4. Put your web_server's listening IP in 'server_address' variable in http_client.py and run python3 http_client.py
11
11
12
12
**Explanation**:
13
13
14
14
web_server.py is a simple HTTP web server built with flask. It has a SSRF vulnerability in the route to /public_ip (you can read more about this vulnerability here https://portswigger.net/web-security/ssrf).
15
15
16
-
This route demonstrates a web server which connects to some remote API server (which is pretty common behavior) and receives some data. The attached POC simply connects to https://api.ipify.org and fetches the server's public IP, then sends it back to the client.
17
-
However, this specific route receives the API address to connect to from the user (http_client.py is used as the client in this POC, but in real life scenarios it will probably be a web browser).
16
+
This route demonstrates a web server which connects to some remote API server (which is pretty common behavior) and receives some data. The attached POC simply connects to https://api.ipify.org and fetches the server's public IP, then sends it back to the client.
17
+
However, this specific route receives the API address to connect to from the user (http_client.py is used as the client in this POC, but in real life scenarios it will probably be a web browser).
18
18
19
19
This creates a SSRF vulnerability as an attacker can put any address he/she wishes to force the web server to connect to it instead of the intended API address (https://api.ipify.org)
20
20
21
-
**Run the POC twice:**
21
+
**Run the POC twice:**
22
22
23
23
**First**, run only web_server.py and http_client.py . http_client.py will send 2 requests to the web server:
24
24
@@ -28,7 +28,7 @@ This creates a SSRF vulnerability as an attacker can put any address he/she wish
28
28
29
29
**Now run the POC again**
30
30
31
-
First run web_server.py but this time add the web server's PID to allow_list.json and then run tcp_mon_block.py as mentioned earlier.
31
+
First run web_server.py but this time add the web server's PID to allow_list.json and then run tcp_mon_block.py as mentioned earlier.
32
32
33
33
This will make sure the web server will only connect to the predefined allow_list of addresses (this can be either an IPv4, URL or domain name), essentially blocking any connection to any address not listed in the allow_list.
34
34
@@ -49,7 +49,7 @@ After web_server.py initiated a connection to a non-allowed address:
49
49
50
50
51
51
52
-
**Prerequisites**:
52
+
**Prerequisites**:
53
53
54
54
1. BCC and pyroute2 for tcp_mon_block
55
55
2. Python3 flask and requests in order to run the web_server.py and http_client.py POC
0 commit comments