为什么要取证?

附录2:取证思路

附录3:取证分析纲要

注:上机取证时,应保存操作的每一步截图,方便作为后续写报告的依据。
一、网络、过程检测

主机通过网络连接和程序进程检测取证,可疑文件直接定位。
1.查看网络情况
1.1.1 查看网络连接
使用netstat -ano查看当前所有网络连接。

1.查看网络情况

1.1.1 查看网络连接
使用netstat -ano查看当前所有网络连接。IP查看地址异常定位请求。

1.1.2 查看木马心跳或网络请求


必要时可使用Wireshark监控当前的网络流量主要是收集攻击者信息和潜在的木马连接信息。
1.2 进程检测

建议使用本机的所有流程PCHunter查看,信息比较全,可以同时看到过程名称和程序路径。
使用外部工具不方便wmic命令查看过程信息:

caption:进程名; commandline:流程名、流程执行路径、流程执行参数; creationDate:开始时间(格式为:年月日时分秒); executablepath:程序执行路径; handle:进程pid; handleCount:父亲的过程pid。
根据流程名称、流程执行参数、流程启动时间、流程执行路径,可以判断是否有异常,并根据异常点进行深入分析。
木马程序通过服务,dll、com可劫持注入程序开始。



示例:
通过检查监控端口,发现异常监控,pid指向800。

打开任务管理器,发现pid 800是svchost.exe由于程序的特点,需要使用第三方工具pe进行检查。

通过pe工具可发现pid 800由服务启动。根据启动路径,可以发现该程序是由正常路径启动的,但不知道该程序是否被替换。启动服务是netsvcs(小白杀手,当初虐了我n久),服务下挂12个子服务。

在pe双击程序,点击【tcp/ip】,可以发现49154端口是服务schedule监听。

点击【services】,可发现schedule服务启动的动态链接库的绝对路径是c:\\windows\\systemc32\\schedsvc.dll,从而发现哪个程序在监控49154端口。

通过点击pe功能菜单模块(下图齿轮图标)【view handles】该程序调用的可显示clsid。

如果在启动和点击程序后重新启动恶意过程,则可以com劫持检查。
通过点击【view dlls】该程序调用的可显示dll文件。
你也可以通过排序直观地看到它是否存在dll劫持。



注入过程检测通常需要检测主机的网络情况,可以使用livetcpudpwatch监控工具。
通过其异常请求pid,利用Process Explorer对该PID检查并使用线程内存dump出来。




wmic useraccount get name,SID
阴影用户和隐藏在注册表中的用户可以检测到(net user命令搜索很容易错过这些特殊用户):

检查管理员分组的用户是什么? net localgroup administrators:

查看xxx创建用户的时间和次登陆时间net user xxx
进入C:/Users ?次登陆时间net user xxx
进入C:/Users ?查看哪些用户登录系统,以及黑客未清理的恶意用户。
进入C:\\Users\\%UserName%\\AppData\\Roaming\\Microsoft\\Windows\\Recent
文件夹,查看当前用户的最新操作记录(不记录可执行程序的执行情况)2.2 登陆检测

1. 被黑主机什么时候连接?

注:默认记录主机日志20Mb,在达到最大值时,先覆盖旧事件,网络安全法要求日志至少保存6个月。
分为远程桌面连接和IPC以两种方式连接讨论。



对于关键点2,可以使用查看注册表HKEY_CURRENT_USER\\Software\\Microsoft\\Terminal Server Client\\Default(有空格,注意引号扩展)展示本机最近10次成功建立。RDP连接。


其实这里的登陆类型是 10 表示的是 RDP 登陆也可以通过FullEventLogView4624等时间批量加载主机日志ID日志筛选比主机直接查看日志更直观。
针对要点2,注册表可以查看HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\TypedPaths


2.3.1 最近的操作文件
最近的可执行文件操作最近的文件操作
最近的浏览器操作
利用AppCompatCacheParser工具检查最近的可执行文件操作(由于该记录以非文本方式保存在注册表中,许多攻击者不会清理文件夹:
根据时间倒叙,重点关注最近或被攻击时间段的程序执行记录。
可直接使用最近的文件操作lastactivityview便于查看。优点是收集的信息非常完整,可以导出HTML。
注意,进行C:/User/xxx/Recent目录还可以看到一些用户最近经常操作的文件,但并非所有操作都不够全面最近使用了所有浏览器的操作记录BrowsingHistoryView?并且可以根据时间短筛选记录。2.3.2人工检查目录 | 这些路径通常被用作攻击者内网渗透的临时工作目录,以及木马启动和减压路径。
C:\\Perflogs\\
C:\\Perflogs\\admin\\C:\\ProgramData\\C:\\Users\\Public\\C:\\Users\\当前用户\\C:\\Windows\\Temp\\C:\\Users\\当前用户\\AppData\\Roaming\\




2.3.3 黑客工具
木马文件
Webshell文件
黑客工具









