0x03 常见安全事件处置
| 2024-2-21
0  |  阅读时长 0 分钟

5.14 [email protected]

一共有几个安全事件处置快照,勒索病毒应急响应中需要开机密码:1qaz2wsx
notion image
打开虚拟机会有两个提示,第一个点我已复制虚拟机,第二个点放弃即可,启动后手动双击桌面上的phpstudy开启web服务
 
先来第一个

一、web应急游戏黑链

0x01 异常现象确认

访问localhost,发现网站被劫持
notion image
 

0x02 处置分析过程

在phpstudy查看站点,发现只有一个localhost,先到网站根目录 C:\phpstudy_pro\WWW 备份好代码
 
在 index.php 发现跳转到恶意网站
notion image
查看文件被修改的时间如下
notion image

0x03 处置异常情况

恢复注释的代码,删除恶意代码,网站恢复(这里直接用记事本编辑会有点问题,最好是vscode之类的写好在覆盖回去)
notion image
 
notion image

0x04 溯源分析

d盾扫描发现webshell https://www.d99net.net/
notion image
查看apache日志,由于一般日志不会保存POST参数,但此任意文件上传漏洞是由 POST 该URL引起的所以,黑客的攻击IP为192.168.199.130 于 2022年6月1日 22:37:58 分在服务器上传WebShell
notion image
 

0x05 清除病毒木马

样本保留
notion image
 
删除webshell
notion image
notion image
 
排查用户
regedit.msc
notion image
 
notion image
重新打开注册表,对比和 lusrmgr.msc 中的用户是否一致,并和客户确认用户是否自建用户
notion image
最后可以通过360或火绒进行全盘查杀
 

0x06 结论

黑客的攻击IP为192.168.199.130 于 2022年6月1日 22:37:58 分在服务器上传WebShell获得WebShell权限,并在2022年6月1日修改主页index.php
 

0x07 系统中存在的安全隐患

  1. 操作系统为windows server 2012R2版本,未打全安全补丁,容易造成提权
  1. Web网站用户未进行合理权限分配,容易导致恶意文件上传
  1. Web网站后台页面未更改默认路径和默认用户名
  1. 网站无任何防护措施,未部署相关waf和防火墙
  1. 数据库权限存在问题,可进行任意下载,造成数据泄露(权限设置问题)
  1. 网站上线未进行系统安全测试,存在多方面web安全漏洞,如本次的任意文件上传漏洞
 

0x08 安全加固和改进建议

  1. 部署相关waf安全产品
  1. 增加流量分析相关产品
  1. 定期进行网站安全测试
  1. 操作系统建议升级到最新版本,并打全补丁
  1. 中间件服务器需要升级到最新版本
  1. WEBDVA功能无必要需要关闭
  1. 进行安全加固,做好权限分配
  1. SIT态势感知
  1. 日式分析系统
  1. 流量清洗流量监控
  1. 文件监控
  1. 防火墙waf
 

二、勒索病毒应急响应

0x01 异常现象确认

主机文件被勒索,文件被加密,桌面存在 info文本,提示如果要解密则需支付比特币
notion image
文件后缀都被改为如图所示
notion image
 

0x02 处置分析过程

对物理机进行物理隔离,断网处理
notion image
 

0x03 溯源分析

查看被加密文件时间
时间为2022年11月1日18:15左右
notion image
 
查看系统日志 eventvwr.msc
notion image
4776 事件ID 凭据验证 登录密码校验的事件ID,如果时间和源工作站都很密集的话,存在爆破事件。可以进一步筛选审计成功来确定是否登录成功
notion image
 
4625 是登录事件,是登录失败的
4624 登录事件会记录登录成功的
5156 筛选平台连接,通讯的IP地址,通过目的地址确定攻击者IP(注意:源地址和源端口是被攻击的),并借助 3389 搜索源端口
notion image
可以看到链接事件非常密集(应该是在爆破中)
 
当然也可以通过翻日志的上下文来确定
notion image
 
应用程序和服务日志/Microsoft/Windows/TerminalServices-RemoteConnectionManager/Operational 这里面的日志也可以看登录日志,黑客可能忘了清了,这里主要看
  • 1149事件ID 远程桌面服务 成功了才会记录(这里的源网络地址是攻击者的IP地址)
notion image
  • 261 RDP-TCP 可以确定爆破行为
notion image
 
综上,系统日志中登陆审核发现在2022年11月1日18:04:54有异常登录成功,登录ip为192.168.206.131
 
notion image
2022年11月1日18:15分左右存在异常程序对主机文件进行访问,猜测为勒索程序
 
通过Last ActivityView 可以看到运行了可疑程序1.exe并运行eventvwr.exe删除了部分日志
notion image
 
上传微步进行分析
notion image
发现其为phobos家族勒索病毒木马,经过判断得知无法进行解密。
 

0x04 清除病毒木马

打开任务管理器,结束1.exe进程
notion image
notion image
使用 /IRE-取证/F.应急响应工具/启动项分析工具/Autoruns/Autoruns.exe 分析启动项
notion image
把相关启动项和文件都删掉(注意留样)
notion image
notion image
 

0x05 结论

登陆审核发现在2022年11月1日18:04:54有异常登录,登录ip为192.168.206.131,通过弱口令爆破进行登录。登录之后上传了1.exe文件,并运行该文件,导致绝大部分文件被加密,随后清空了系统日志
 

0x06 安全隐患

  1. 操作系统为windows 10版本,未打全安全补丁,容易造成提权
  1. 远程登陆用户超级管理员弱口令
 

0x07 加固建议

 

三、web应急篡改处置* (重点

网站根目录在 C:\phpstudy_pro\WWW\dedecms,关卡为 index1-5.php 和 heiye/2-5.html
 
访问 index1.php
notion image
发现页面被恶意篡改
notion image
这部分代码引起,删除即恢复正常
notion image
 
index2.php
notion image
 
notion image
 
notion image
删除 include/common2.inc.php 12行 以及 heiye/index2.html 即可
notion image
 
index3.php
notion image
notion image
删除index3.php 第3行、 include/1.js 和 heiye/index3.html 即可
notion image
index4.php
和index2差不多
notion image
删除 include/common3.inc.php 12行 以及 heiye/index4.html 即可
notion image
index5.php
notion image
PACK函数把指定打包为二进制字符串,直接运行一下即可
notion image
即包含了该文件
notion image
 
删除 index5.php 第7行、uploads/image/888888/1 第3行、heiye/index5.html 即可
notion image
  • GitTalk
目录