Top Banner
Network Device Development PART 4 – Firewall 103: Protocol Filter & Payload Filter & Payload Modifier SEAN
24

Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Apr 14, 2017

Download

Software

Cheng-Yi Yu
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Network Device Development

PART 4 – Firewall 103: Protocol Filter & Payload Filter & Payload Modifier

SEAN

Page 2: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Sean

• Developer

[email protected]

• https://www.facebook.com/erinus

Page 3: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

GitHub

https://github.com/erinus/NetworkDeviceDevelopment

Page 4: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Read Me

It is a series of training. If you have no experience on kernel module development, you must view

other presentations.

1. Network Device Development - Part 1: Switchhttp://www.slideshare.net/erinus/network-device-development-part-1-switch

2. Network Device Development - Part 2: Firewall 101http://www.slideshare.net/erinus/network-device-development-part-2-firewall-101

Page 5: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

3. Network Device Development - Part 3: Firewall 102 ~ IP Filterhttp://www.slideshare.net/erinus/network-device-development-part-3-firewall-102-ip-filter

Page 6: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

First Protocol Filter

Page 7: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Protocols over IP

Page 8: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Second Payload Filter

Page 9: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

VMnet2

192.168.102.?

VMnet3

192.168.103.?

CLIENTUbuntu Desktop192.168.102.128

CLIENTUbuntu Desktop192.168.103.128

SWITCHDebian

VMnet1

NAT

eth1 eth2

eth0

TCP (IP 192.168.103.*) Payload contains "fuck"

TCP (IP 192.168.103.*) Payload without "fuck"

Page 10: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Modify main.c

Find "fuck"

Page 11: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Install

$ make

$ make install

$ dmesg

Page 12: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Test your Firewall

Page 13: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Create HTTP Server on CLIENT of VMnet3

$ sudo python server.py

Page 14: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Test on CLIENT of VMnet2

Open Web Browser and connect:

1. http://192.168.103.128/ Success

2. http://192.168.103.128/test Failure

$ ping 192.168.103.128 Success

Page 15: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Third Payload Modifier

Page 16: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

VMnet2

192.168.102.?

VMnet3

192.168.103.?

CLIENTUbuntu Desktop192.168.102.128

CLIENTUbuntu Desktop192.168.103.128

SWITCHDebian

VMnet1

NAT

eth1 eth2

eth0

TCP (IP 192.168.103.*) Payload contains "fuck" Return "****"

TCP (IP 192.168.103.*) Payload without "fuck"

Page 17: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Modify main.c

Page 18: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Modify main.c

Change "fuck" to "****“

and do not forget to

re-calculate checksum

Page 19: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Install

$ make

$ make install

$ dmesg

Page 20: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Test your Firewall

Page 21: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Test on CLIENT of VMnet2

Open Web Browser and connect:

http://192.168.103.128:80/

Page 22: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Test on CLIENT of VMnet2

Open Web Browser and connect:

http://192.168.103.128:80/test

Page 23: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Next Part

Page 24: Network Device Development - Part 4: Firewall 103 ~ Protocol Filter & Payload Filter & Payload Modifier

Firewall 104