Windows/Linux应急响应

2229ff4d27fd3632d88e32cbf746f3e5

1. 系统排查

Windows

msinfo32   #系统信息窗口
systeminfo  #查看系统信息 

系统信息窗口中主要关注:正在运行任务、服务、启动程序、加载的模块、系统驱动程序…

eventvwr.msc #事件管理器
导出Windows日志--安全,利用Log Parser进行分析。
   4624  登录成功
   4625  登录失败
   4648  使用明确的登录凭证 (请求的IP、端口、进程)
compmgmt.msc(计算机管理) #异常账户
taskschd.msc   # 任务计划分析
services.msc  #服务状态和启动类型
Get-EventLog -LogName Security | Select-Object -Property * #Get-Eventlog命令获取安全事件
netstat -ano | findstr “port” #查看端口对应的PID

Linux

lscpu  #cpu 信息
uname -a  #操作系统信息
cat /proc/version  #操作系统版本信息
lsmod   #已载入系统的模块信息
df -Th   #查看磁盘使用率

image

2. 用户信息

  • Windows

net user 21522  #查看用户详细信息
lusrmgr.msc #用户和组
regedit  #注册表
wmic useraccount get name,SID #wmic扩展WMI,提供从命令行接口和批命令脚本执行系统管理支持。

image
image
影子用户只能通过注册表查看

image

  • Linux

cat /etc/passwd   #查看所有用户信息  // 用户名:x(代表密码加密):用户ID:用户组:注释:用户主目录:默认登录shell
#bin/bash 可登录    sbin/nologin 不可登录
cat /etc/passwd | grep '/bin/bash'  #查看可登录的用户
lastb  #查看用户错误的登录信息
lastlog   #查看所有用户最后登录信息

/etc/shadow   #影子文件
who  #查看当前登录用户(tty本地登陆 pts远程登录) 
w 查看系统信息,想知道某一时刻用户的行为 
uptime 查看登陆多久、多少用户,负载

   查看用户最近登录信息:/$  last   数据源:
           /var/log/wtmp   wtmp存储登录成功的信息
           /var/log/btmp    btmp存储登录失败的信息
           /var/log/utmp)utmp存储当前正在登录的信息
------------------------------------------
1、查询特权用户特权用户(uid 为0) 
[root@localhost ~]# awk -F: '$3==0{print $1}' /etc/passwd 
2、查询可以远程登录的帐号信息 
[root@localhost ~]# awk '/\$1|\$6/{print $1}' /etc/shadow 
3、除root帐号外,其他帐号是否存在sudo权限。如非管理需要,普通帐号应删除sudo权限 
[root@localhost ~]# more /etc/sudoers | grep -v "^#\|^$" | grep "ALL=(ALL)" 
4、禁用或删除多余及可疑的帐号 
usermod -L user 禁用帐号,帐号无法登录,/etc/shadow第二栏为!开头 
userdel user 删除user用户 
userdel -r user 将删除user用户,并且将/home目录下的user目录一并删除 

ls –alt /tmp/  #查看tmp目录下的文件
ls -alt  /etc/init.d/ #查看开机启动项内容,/etc/init.d 是 /etc/rc.d/init.d 的软链接
cat /root/.bash_history 
find / -perm 777 | more #查找777 的权限的文件
ls /etc -ar | grep "^\."  #隐藏的文件 (以 "."开头的具有隐藏属性的文件)

image

image
image

image

image

3. 启动项

Windows

msconfig

image

查看注册表
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LCOAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Runonce

Linux

cat /etc/init.d/rc.local  #査看init.d 文件加下的rc.local 文件内容
cat /etc/rc.local  #査看rc.local 文件的内容
ls -alt /etc/init.d  #查看init.d 文件夹下所有文件的详细信息

启动项是恶意病毒实现持久化的常用手段

image

4. 计划任务

Windows

taskschd.msc
cmd > schtasks
powershell > Get-ScheduledTask 

image

Linux

crontab -l  // 查看当前用户的计划任务
crontab|terminal -u root -l  // 查看指定用户root的计划任务
ls|cat  /etc/cron*   // 查看etc目录下的计划任务文件

image

5. 防火墙规则

image

netsh firewall show state

image
image

6. 进程排查

Windows

tasklist -svc  #进程与服务对应
tasklist /m name.dll  #加载特定DLL
netstat -ano | findstr 'ESTABLISHED'  #网络连接进程(LISTENING/ESTABLISHED/CLOSE_WAIT)

Linux

netstat -ap  #所有进程及网络连接
ls -alt /proc/PID  #特定PID的执行程序
lsof -p PID  #进程打开的文件
kill -9 PID  #杀进程;rm -rf 文件名;chattr -i 文件名(去除i属性)
隐藏进程对比:ps -ef | awk '{print}' | sort -n | uniq > 1;ls /proc | sort -n | uniq > 2;diff 1 2
top   #资源占用

7. 服务排查

Windows

services.msc

Linux

CentOS/RedHat:chkconfig --list
Ubuntu/Kali:service --status-all
service ssh status

8. 文件痕迹排查

Windows

敏感目录:temp、浏览器下载、Recent文件、Prefetch

时间点查找:forfiles /m *.exe /d +2020/2/12 /s /p c:\ /c "cmd /c echo @path @fdate @ftime" 2>null

工具:D盾、webshellkill

Linux

敏感目录:/tmp、/usr/bin、/usr/sbin、~/.ssh、/etc/ssh
时间点查找:find / -ctime -7 -name "*.sh"(-mtime按修改时间,-ctime按更改时间)
文件状态:stat test.php
权限777:find /tmp -perm 777
工具:findWebshell、Scan_Webshell.py、chkrootkit
SUID权限程序:find / -type f -perm -04000 -ls -uid 0 2>/dev/null

9. 日志分析

Windows

事件查看器:eventvwr.msc

三类日志位置:
应用程序:C:\Windows\System32\winevt\Logs\Application.evtx
系统:C:\Windows\System32\winevt\Logs\System.evtx
安全:C:\Windows\System32\winevt\Logs\Security.evtx

Linux

日志目录:/var/log/
wtmp:登录进出/重启
cron:定时任务
messages:系统启动及错误
auth.log:授权信息
secure:账号密码及登录成功与否
faillog:登录失败

Web日志:
IIS:%SystemDrive%\inetpub\logs\LogFiles 等
Apache:/var/log/httpd/access.log 或 /var/log/apache2/access.log
Nginx:/usr/local/nginx/logs/access.log
MySQL:show variables like 'log_%';show variables like 'general'

10. 内存分析

获取工具:FTK Imager、Dumpit、RAM Capture
转储文件:系统 → 高级 → 启动和故障恢复 → 核心内存转储
分析工具:Redline、Volatility

11. 流量分析(Wireshark)

ip.addr == IP:特定目的/源地址
ip.src == IP:特定源地址
直接输入协议:http、arp
tcp.port == 端口 或 udp.port == 端口
tcp contains 关键字

posted @ 2026-04-19 01:21  Xiewt  阅读(51)  评论(0)    收藏  举报