tcptraceroute, hping gibi kesif araclarindan korunma(OpenBSD PF ile)

Ag/host kesifleri yaparken genelde traceroute, tcptraceroute, firewalk ve hping gibi araclar kullanilir. Bu araclarin temel ozelligi IP basligindagi TTL alanini kullanmalaridir.

Gunumuzde artik traceroute’a acik aglari pek goremiyoruz, cogu guvenlik duvarlari tarafindan engelleniyor fakat tcptraceroute gibi araclar ile guvenlik duvarlari arkasindaki hostlarin varligi rahatlikla gorulebiliyor.

mesela www.microsoft.com’un onunde Fw var mi diye bakmak istersek

#tcptraceroute www.microsoft.com 80

gibi bir komut isinizi gorecektir.

Peki bu tip kesif araclari nasil engellenebilir? Eger guvenlik duvari/IPS vs cihaziniz uzerindne gecirecegi paketlerin TTL alaninin kontrol edebiliyorsa basitce guvenlik duvarina TTL’i su degerden asagi olan paketleri gecirme diyerek olabilir.

Mesela OpenBSD PF’de bulunan scrub tanimi ile Guvenlik duvarina gelen paketlerin min. TTL degerini belirleyebiliriz. Bu degerden daha dusuk TTL’li paketler kabul edilmeyecektir.  Hemen trace vs gibi araclarin calisma mantigini hatirlayalim:

Baslangictan itibaren gonderecegin paketin TTL degerini 1 yap ve gelen cevabi kontrol et, olumlu ise TTL degerini bir artir ayni islemi takip ta ki son kaleye ulasana dek.

Durum boyle olunca biz guvenlik duvarina TTL degeri 10’dan dusuk olan paketleri kabul etme dersek bu tip paketlerden korunmus oluruz. Zira guvenlik duvarina gelen ve TTL alaninin kullanan kesif araclarinin TTL degeri guvenlik duvarinda 1 olacaktir.

pf.conf’a asagidaki tanimi ekleyerek kesif yapanlari bir nebze engelleyebilirsiniz.

scrub in on $ext_if min-ttl 10
Ornek;

scrub min-ttl ozelligi aktif degilken;

fuzuli# tcptraceroute test.enderunix.org 80
Selected device fxp0, address 64.90.164.206, port 64064 for outgoing packets
Tracing the path to test.enderunix.org (1.2.3.4) on TCP port 80, 30 hops max
1 64.90.164.205.nyinternet.net (64.90.164.205) 9.394 ms 9.733 ms 9.934 ms
2 cs20.nyinternet.net (64.147.101.57) 20.189 ms 9.722 ms 9.939 ms
3 cs-nyi-gigalan-25.nyinternet.net (64.147.101.25) 9.935 ms 9.447 ms 9.932 ms

..
..

15 193.255.0.62 (193.255.0.62) 237.505 ms 231.713 ms 231.690 ms
16 test.enderunix.org (1.2.3.4) 241.249 ms 232.016 ms 232.556 ms
17 test.enderunix.org (1.2.3.4) [open] 233.970 ms * *

firewall.enderunix.org makinesindeki tcpdump ciktisi; TTL degerine dikkat

firewall#tcpdump -i rl0 -tttnn tcp port 80 and host fuzuli.enderunix.org
tcpdump: listening on rl0, link-type EN10MB
Nov 16 09:02:09.894166 64.90.164.206.64064 > 1.2.3.4.80: S 0:0(0) win 0 [ttl 1]
Nov 16 09:02:10.361102 64.90.164.206.64064 > 1.2.3.4.80: S 0:0(0) win 0 [ttl 1]
Nov 16 09:02:10.593576 64.90.164.206.64064 > 1.2.3.4.80: S 0:0(0) win 0 [ttl 1]
Nov 16 09:02:10.827504 64.90.164.206.64064 > 1.2.3.4.80: S 0:0(0) win 0
Nov 16 09:02:10.827807 1.2.3.4.80 > 64.90.164.206.64064: S 2470163164:2470163164(0) ack 1 win 65535 <mss 1460> (DF)
Nov 16 09:02:11.060166 64.90.164.206.64064 > 1.2.3.4.80: R 1:1(0) win 0 (DF)
Nov 16 09:02:11.286377 64.90.164.206.64064 > 1.2.3.4.80: S 0:0(0) win 0
Nov 16 09:02:14.285770 64.90.164.206.64064 > 1.2.3.4.80: S 0:0(0) win 0

scrub min-ttl degeri aktif edilmis haldeki kesif sonucu ve firewalldaki tcpdump ciktisi;

fuzuli# tcptraceroute test.enderunix.org 80
Selected device fxp0, address 64.90.164.206, port 64138 for outgoing packets
Tracing the path to test.enderunix.org (1.2.3.4) on TCP port 80, 30 hops max
1 64.90.164.205.nyinternet.net (64.90.164.205) 9.626 ms 10.114 ms 9.935 ms
2 cs20.nyinternet.net (64.147.101.57) 103.958 ms 9.716 ms 9.940 ms
3 cs-nyi-gigalan-25.nyinternet.net (64.147.101.25) 9.931 ms 9.699 ms 9.938 ms
4 gigabitethernet6-13.car4.nyc1.Level3.net (63.208.174.49) 9.938 ms 9.661 ms 9.929 ms
5 ae-31-51.ebr1.NewYork1.Level3.net (4.68.97.30) 9.947 ms 10.408 ms 9.816 ms
6..
..
15 193.255.0.62 (193.255.0.62) 231.946 ms 232.194 ms 232.533 ms

16 test.enderunix.org (1.2.3.4) [open] 232.260 ms * *

goruldugu gibi test.enderunix.org makinesi onunde guvenlik duvari var mi yok mu anlasilmiyor.

firewall#tcpdump -i rl0 -tttnn tcp port 80 and host fuzuli.enderunix.org
tcpdump: listening on rl0, link-type EN10MB
Nov 16 09:09:38.149348 64.90.164.206.58309 > 1.2.3.4.80: S 0:0(0) win 0 [ttl 1]
Nov 16 09:09:38.149707 1.2.3.4.80 > 64.90.164.206.58309: S 3566176315:3566176315(0) ack 1 win 65535 <mss 1460> (DF)
Nov 16 09:09:38.381941 64.90.164.206.58309 > 1.2.3.4.80: R 1:1(0) win 0 (DF)
Nov 16 09:09:38.607946 64.90.164.206.58309 > 1.2.3.4.80: S 0:0(0) win 0 [ttl 1]
Nov 16 09:09:41.609040 64.90.164.206.58309 > 1.2.3.4.80: S 0:0(0) win 0 [ttl 1]

**Bu yazi blog.huzeyfe.net adresinden alinmistir.

This entry was posted in Firewalls, Network Tools, OpenBSD, Penetration. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

4 + eight =