Archive for May, 2010

Online Bilgi Güvenliği Eğitimleri Başlıyor !

CehTürkiye ekibi olarak Anadolunun her kesimine hitap edecek Online Bilgi Güvenliği Eğitim Projesini başlatmış bulunuyoruz.

Temel ve ileri düzey bilgi güvenliği ve özgür yazılım teknolojilerin yoğunlukla pratiğe yönelik olarak sunulacağı eğitim içeriği CEH sertifikasyonuna uygun olacaktır.Her eğitim başlığı sonunda sınav ve ödüllü hacking oyunları düzenlenecektir.

Bu eğitim projesi ile bilişim sektörüne yeni bilişim güvenliği araştırmacıları ve güvenlik yazılımı projeleri üretmeyi hedeflemekteyiz.
Destek olmak ve fikir beyan etmek için root@cehturkiye.com adresinden bize ulaşabilirsiniz.

Projenin detayları yakın zamanda alt başlıklar ile burada yer alıcaktır.

p0f (Passive OS fingerprinting)

İşletim sistemini tespit etmenin sık kullanılan iki yöntemi vardır.

Aktif İşletim Sistemi Tespiti (Active OS fingerprinting) : Hedef sistem aktif ve ulaşılabilir olmalıdır.Hedef sisteme anormal paketler gönderip dönen cevaplara göre işletim sistemi tespit edilmeye çalışılır.
Uzak bir ağdaki aktif sistemi tespit etmek için ideal, fakat güvenlik duvarı , saldırı tespit ve engelleme sistemlerine takılmanız kuvvetle muhtemel

Pasif İşletim Sistemi Tespiti (Passive OS fingerprinting) : Kaydedilmiş trafikten veya pasif modda trafiği dinleyip işetim sistemi tespit etmeyi sağlayan etkili bir yöntem.

Pasif işletim sistemi tespiti sağlayan gelişmiş araçlardan p0f ile farklı senaryolar üzerinden bu methodu inceleyelim ;
root@ubuntucuk:/home/coslat/pcap# p0f -h
p0f: invalid option — ‘h’

Usage: p0f [ -f file ] [ -i device ] [ -s file ] [ -o file ]
[ -w file ] [ -Q sock [ -0 ] ] [ -u user ] [ -FXVNDUKASCMROqtpvdlrx ]
[ -c size ] [ -T nn ] [ -e nn ] [ 'filter rule' ]
-f file   – read fingerprints from file
-i device – listen on this device
-s file   – read packets from tcpdump snapshot
-o file   – write to this logfile (implies -t)
-w file   – save packets to tcpdump snapshot
-u user   – chroot and setuid to this user
-Q sock   – listen on local socket for queries
-0        – make src port 0 a wildcard (in query mode)
-e ms     – pcap capture timeout in milliseconds (default: 1)
-c size   – cache size for -Q and -M options
-M        – run masquerade detection
-T nn     – set masquerade detection threshold (1-200)
-V        – verbose masquerade flags reporting
-F        – use fuzzy matching (do not combine with -R)
-N        – do not report distances and link media
-D        – do not report OS details (just genre)
-U        – do not display unknown signatures
-K        – do not display known signatures (for tests)
-S        – report signatures even for known systems
-A        – go into SYN+ACK mode (semi-supported)
-R        – go into RST/RST+ACK mode (semi-supported)
-O        – go into stray ACK mode (barely supported)
-r        – resolve host names (not recommended)
-q        – be quiet – no banner
-v        – enable support for 802.1Q VLAN frames
-p        – switch card to promiscuous mode
-d        – daemon mode (fork into background)
-l        – use single-line output (easier to grep)
-x        – include full packet dump (for debugging)
-X        – display payload string (useful in RST mode)
-C        – run signature collision check
-t        – add timestamps to every entry

‘Filter rule’ is an optional pcap-style BPF expression (man tcpdump).

Ağ arabirimini üzerinden geçen trafiği dinleyip anlık olarak sonuç verebilir.
-S : Bilinen sistemler için imzaları raporla
-v : 802.1q Vlan frame desteğini aktif eder.
-l : Çıktıyı satır satır ver.

root@ubuntucuk:/home/coslat/pcap# p0f -S -v -l
p0f – passive os fingerprinting utility, version 2.0.8
(C) M. Zalewski <lcamtuf@dione.cc>, W. Stearns <wstearns@pobox.com>
p0f: listening (SYN) on ‘eth0′, 262 sigs (14 generic, cksum 0F1F5CA2), rule: ‘all’.
192.168.5.205:50969 – Linux 2.6 (newer, 2) (up: 15 hrs) Signature: [S4:64:1:60:M1460,S,T,N,W6:.] -> 209.85.227.106:80 (distance 0, link: ethernet/modem)
192.168.5.205:50970 – Linux 2.6 (newer, 2) (up: 15 hrs) Signature: [S4:64:1:60:M1460,S,T,N,W6:.] -> 209.85.227.106:80 (distance 0, link: ethernet/modem)
192.168.5.205:54475 – Linux 2.6 (newer, 2) (up: 15 hrs) Signature: [S4:64:1:60:M1460,S,T,N,W6:.] -> 209.85.227.138:80 (distance 0, link: ethernet/modem)
^C+++ Exiting on signal 2 +++
[+] Average packet ratio: 60.00 per minute.

Dinlediği ağ arabirimi üzerinden “192.168.5.205” ip adresine ait sistemin “Linux 2.6” çekirdeğine sahip olduğunu ve bu tespiti [S4:64:1:60:M1460,S,T,N,W6:.] imzasına göre yaptığını söyledi.

Promiscuous modda dinleme yapmak için  ;
-p : Promiscuous moda geç.

root@ubuntucuk:/home/coslat/pcap# p0f -S -v -l -p
p0f – passive os fingerprinting utility, version 2.0.8
(C) M. Zalewski <lcamtuf@dione.cc>, W. Stearns <wstearns@pobox.com>
p0f: listening (SYN) on ‘eth0′, 262 sigs (14 generic, cksum 0F1F5CA2), rule: ‘all’.
192.168.5.61:1522 – Windows XP/2000 (RFC1323+, w+, tstamp-) [GENERIC] Signature: [65535:128:1:52:M1460,N,W1,N,N,S:.:Windows:?] -> 91.103.140.2:80 (distance 0, link: ethernet/modem)
192.168.5.61:1522 – Windows XP/2000 (RFC1323+, w+, tstamp-) [GENERIC] Signature: [65535:127:1:52:M1460,N,W1,N,N,S:.:Windows:?] -> 91.103.140.2:80 (distance 1, link: ethernet/modem)
192.168.5.61:1523 – Windows XP/2000 (RFC1323+, w+, tstamp-) [GENERIC] Signature: [65535:128:1:52:M1460,N,W1,N,N,S:.:Windows:?] -> 91.103.140.2:80 (distance 0, link: ethernet/modem)
^C+++ Exiting on signal 2 +++
[+] Average packet ratio: 720.00 per minute
.

Kaydedilmiş trafiği analiz etmek
-S : Bilinen sistemler için imzaları raporla.
-v : 802.1q Vlan frame desteğini aktif eder.
-o : Çıktıyı dosyaya yaz.
-l : Çıktıyı satır satır ver.

root@ubuntucuk:/home/coslat/pcap# p0f -v -s p0f.pcap -o analiz.log -l
p0f – passive os fingerprinting utility, version 2.0.8
(C) M. Zalewski <lcamtuf@dione.cc>, W. Stearns <wstearns@pobox.com>
p0f: listening (SYN) on ‘p0f.pcap’, 262 sigs (14 generic, cksum 0F1F5CA2), rule: ‘all’.
[+] End of input file.
root@ubuntucuk:/home/coslat/pcap# cat analiz.log
<Wed May 26 17:11:09 2010> 192.168.2.13:1134 – Windows 2000 SP4, XP SP1+ -> 83.66.162.3:80 (distance 1, link: ethernet/modem)
<Wed May 26 17:11:15 2010> 192.168.2.7:1055 – Windows 2000 SP4, XP SP1+ -> 178.18.193.27:80 (distance 0, link: ethernet/modem)
<Wed May 26 17:11:15 2010> 192.168.2.7:1055 – Windows 2000 SP4, XP SP1+ -> 178.18.193.27:80 (distance 1, link: ethernet/modem)
<Wed May 26 17:11:20 2010> 192.168.5.144:3244 – Windows 2000 SP4, XP SP1+ -> 208.78.70.70:8245 (distance 0, link: ethernet/modem)

Farklı bir p0f imza veritabanınız varsa,  -f parametresi ile p0f imza veritabanını kullanabilirsiniz
root@ubuntucuk:/home/coslat/pcap# p0f -v -l -f /etc/p0f/p0f.fp -s p0f.pcap -o analiz.log

Nsm Console 1

NSM Console (Network Security Monitoring Console) network paketlerini analiz etmek için geliştirilmiş bir framework. Opensource tcp/ip analiz araçlarının bir araya getirilerek oluşturulduğu framework modüler bir yapıya sahip, ileri düzey programlama bilgisine sahip olmadan ek moduller geliştirmenizi mümkün kılıyor.

Sık kullanılan bazı komutlar ;
toogle = Modülü aktif/deaktif etmenizi sağlar
file = Analiz edeceğiniz pcap formatındaki dosyayı tanımlar
list = Modülleri ve durumlarını listeler
run = Seçili modül/ler ile analiz işlemini başlatır
info = Modül hakkında bilgi verir
exec= Komut çalıştırmayı sağlar

Analiz işlemi için Tshark ile bir süre networkü dinleyip tüm paketleri lol.pcap dosyasına yazdıralım ;

coslat@ubuntucuk:~/pcap$ sudo tshark -i eth0 -w lol.pcap
Running as user “root” and group “root”. This could be dangerous.
Capturing on eth0
3483

Kaydettiğimiz trafikten  resim dosyaları, ofis dökümanları, sıkıştırılmış dosyalar vs. gibi verileri ayıklamak ve bir kopyasını almak istiyor olalım.
Bunun için tcpxtract modülünü aktif edip lol.pcap dosyasını analiz edebiliriz.

coslat@ubuntucuk:~/İndirilenler/nsm-console$ sudo ./nsm
[sudo] password for coslat:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
,.—.
,,,, / _ `.
\\\\ / \ )
|||| /\/“-.__\/ NSM
::::/\/_
{{`-.__.-’(`(^^(^^^(^ 9 `.=========’
{{{{{{ { ( ( ( ( (—–:=
{{.-’~~’-.(,(,,(,,,(__6_.’=========.
::::\/\
|||| \/\ ,-’/\ console
//// \ “ _/ )
”” \ ` /
`—”
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

NSM Console version 0.7

Loading modules from: modules
Loading ngrep.module…done.
Loading snort.module…done.
Loading harimau.module…done.
Loading chaosreader.module…done.
Loading iploc.module…done.
Loading foremost.module…done.
Loading yahsnarf.module…done.
Loading tcpdstat.module…done.
Loading bro-ids-stream.module…done.
Loading trace-summary.module…done.
Loading bro-ids-protocol.module…done.
Loading tshark.module…done.
Loading tcpick.module…done.
Loading tcpxtract.module…done.
Loading ip2asn.module…done.
Loading tcpflow.module…done.
Loading hash.module…done.
Loading flowtag.module…done.
Loading p0f.module…done.
Loading honeysnap.module…done.
Loading tcptrace.module…done.
Loading fl0p.module…done.
Loading flowtime.module…done.
Loading bro-ids-conn.module…done.
Loading capinfos.module…done.
Loading pads.module…done.
Loading argus-basic.module…done.
Loading aimsnarf.module…done.
Loading clamscan.module…done.

29 modules loaded.

Loading categories from modules/categories
Loading nsm…done.
Loading flow…done.
Loading statistics…done.
Loading forensics…done.
Loading IDS…done.

5 categories loaded.

Logging to logs/nsm-log.2010526.log

Default ${OUTPUT_DIR} is ‘${PCAP_BASE}-output’
Default ${MODULE_DIR} is ‘modules’

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Welcome to NSM Console, type ‘help’ to see available commands
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Note: All modules are DISABLED by default, use ‘list’ to list available
modules and ‘toggle <module>’ to disable/enable a module.

nsm> toggle capinfos
capinfos module turned on.

nsm> run capinfos
===> module capinfos running…
Directory lol.pcap-output/capinfos already exists, not recreating
–> capinfos /home/coslat/pcap/lol.pcap >> lol.pcap-output/capinfos/lol.pcap.capinfos

nsm> exec cat /home/coslat/nsm-console/lol.pcap-output/capinfos/lol.pcap.capinfos
Executing: cat /home/coslat/nsm-console/lol.pcap-output/capinfos/lol.pcap.capinfos
File name:           /home/coslat/pcap/lol.pcap
File type:           Wireshark/tcpdump/… – libpcap
File encapsulation:  Ethernet
Number of packets:   3483
File size:           862335 bytes
Data size:           806583 bytes
Capture duration:    95 seconds
Start time:          Wed May 26 10:43:21 2010
End time:            Wed May 26 10:44:57 2010
Data byte rate:      8455.64 bytes/sec
Data bit rate:       67645.11 bits/sec
Average packet size: 231.58 bytes
Average packet rate: 36.51 packets/sec
Exit status: 0

nsm> file /home/coslat/pcap/lol.pcap
Setting ${PCAP_FILE} = /home/coslat/pcap/lol.pcap
Setting ${PCAP_BASE} = lol.pcap

nsm> info tcpxtract
The tcpxtract module attempts to extract files from a pcap file.

http://tcpxtract.sourceforge.net/

To edit the extraction settings, change the ${MODULE_DIR}/${MODULE_NAME}.module/tcpxtract.conf
file.

nsm> toggle tcpxtract
tcpxtract module turned on.

nsm> run

Executing analysis…
===> module tcpxtract running…
Creating directory lol.pcap-output/tcpxtract
–> tcpxtract -f /home/coslat/pcap/lol.pcap -c modules/tcpxtract.module/rp-tcpxtract.conf -o lol.pcap-output/tcpxtract
Found file of type “png” in session [192.168.5.205:10624 -> 65.54.48.173:18183], exporting to lol.pcap-output/tcpxtract/00000000.png
Found file of type “gzip” in session [209.85.227.99:20480 -> 192.168.5.205:9956], exporting to lol.pcap-output/tcpxtract/00000001.gzip
===> module tcpxtract finished.

Tcpdump 802.1q vlan network sniff

Bir çok sniffer vlan tag’lerini ayrıştıramadığı için vlan networklerde sıkıntı yaratabiliyor. bknz. httpry, urlsnarf vs.
Tcpdump ile vlan networkleri sniff etmek için “vlan” parametresi kullanılabilir.

coslat@ubuntucuk:~$ sudo tcpdump -i eth0 vlan and tcp port 80

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes

10:59:43.054948 vlan 12, p 0, IP 192.168.2.20.1390 > 193.140.115.119.www: Flags [P.], seq 813912607:813913122, ack 1415196208, win 65535, length 515

10:59:43.055071 vlan 12, p 0, IP 192.168.2.20.1390 > 193.140.115.119.www: Flags [P.], seq 515:1279, ack 1, win 65535, length 764

10:59:43.055116 vlan 16, p 0, IP 192.168.2.20.1390 > 193.140.115.119.www: Flags [P.], seq 0:515, ack 1, win 65535, length 515

10:59:43.055260 vlan 16, p 0, IP 192.168.2.20.1390 > 193.140.115.119.www: Flags [P.], seq 515:1279, ack 1, win 65535, length 764

Layer 2 başlık bilgilerini görüntülemek için “-e” parametresi kullanılabilir ;

coslat@ubuntucuk:~$ sudo tcpdump -e -i eth0 vlan and tcp port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
11:00:51.589185 00:1d:7d:3b:00:4b (oui Unknown) > 00:11:bb:e0:7b:10 (oui Unknown), ethertype 802.1Q (0×8100), length 1518: ethertype IPv4, 88.255.41.21.www > 192.168.2.8.1291: Flags [.], seq 1826901155:1826902615, ack 303813320, win 65535, length 1460
11:00:51.589567 00:11:bb:e0:7b:10 (oui Unknown) > 00:19:66:f7:1b:48 (oui Unknown), ethertype 802.1Q (0×8100), length 1518: ethertype IPv4, 88.255.41.21.www > 192.168.2.8.1291: Flags [.], seq 0:1460, ack 1, win 65535, length 1460

 
Hosting Sponsorumuz