ssh配置
Royal TSX 教程(macOS 的 SSH 工具)-CSDN博客–在配完凭证后,ssh OK,但是FTP报错,于是转用:termius :Free SSH Client for macOS
玄机-webshell查杀
WP参考:玄机——第一章 应急响应-webshell查杀 wp(手把手保姆级教学)-CSDN博客
自己先尝试打一遍,知道要到/var/www/html下查看,但是不知道查询命令的构造,只看到了一句话木马的;apache的日志文件打开后,简单看了访问的路径,没有审查的经验,30分钟到期后,看wp
任务:
黑客webshell里面的flag flag{xxxxx-xxxx-xxxx-xxxx-xxxx}
黑客使用的什么工具的shell github地址的md5 flag{md5}
黑客隐藏shell的完整路径的md5 flag{md5} 注 : /xxx/xxx/xxx/xxx/xxx.xxx. /var/www/html/include/Db/.Mysqli.php
黑客免杀马完整路径 md5 flag{md5}
查杀思路
手工查杀
根据文件后缀和内容「危险函数命令」手工查杀
动态特征:HTTP请求响应,cmd,bash
日志排查:webshell页面访问,POST 状态码200
代码特征(PHP):
危险函数:exec、system、eval、shell_exec,assert,base64_encode
文件操作:fopen,fwrite,file_get_contents,file_put_contents
网络操作:fsockopen,curl_exec,file_get_contents
在线webshell查杀
D盾 只支持win,适合线下比赛
cat shell.php
1 | root@ip-10-0-10-4:/var/www/html# find ./ type f -name "*.php" | xargs grep "eval(" |
//对于免杀Webshell,可以查看是否使用编码
find ./ -type f -name “*.php” | xargs grep “base64_decode”
-type 就是 find 命令的一个选项参数(option/flag),f设置只看普通文件
.开头的文件为linux隐藏文件,作用「存放配置文件,状态目录或缓存」,避免误操作,而非安全属性
判断webshell工具:哥斯拉
GitHub下载.jar后,Mac电脑:java -jar godzilla
生成木马xor_raw:
1 |
|
隐藏文件审查:
ls -l和ls -la对比
教程:第3篇:常见的Webshell查杀工具 · 应急响应实战笔记
linux日志分析
账号root密码linuxrz
ssh root@IP
1.有多少IP在爆破主机ssh的root帐号,如果有多个使用”,”分割
Aug 1 07:42:30 linux-rz sshd[7471]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.200.32 user=root
Aug 1 08:18:27 ip-172-31-37-190 sshd[544]: Server listening on :: port 22.
根据结尾写的user=root要排除,没用rootbaopo的
看了wp说是从小到大排序
由于数量不多,直接ctrl+F “ssh ”即可
2.ssh爆破成功登陆的IP是多少,如果有多个使用”,”分割
Accepted password for root from 192.168.200.2 port 48070 ssh2
还是看的不够仔细,查看了success和其他的复制
3.爆破用户名字典是什么?如果有多个使用”,”分割
flag{test1,test2,test3,hello,user,root}flag{root,user,hello,test3,test2,test1}
答案顺序:flag{user,hello,root,test3,test2,test1}
4.登陆成功的IP共爆破了多少次
Failed password for root from 192.168.200.2
自己没搞懂为什么前面的Failed password for invalid user hello from 192.168.200.2 port 41957 ssh2这种不算数 非法用户
5.黑客登陆主机后新建了一个后门用户,用户名是多少
cat /etc/passwd | grep “1000”
test2:x:1000:1000::/home/test2:/bin/sh
test2:$6$oIpMwQHVAWKNjsi1$kMV6ZNSOTZfqnNSxqMkl9tLj/1Y5KOJMZBzCu.qQgFxezvXrn..gHkt8lieFTDVCUI0PhVASNpZvKCJwsN3gH1:19570:0:99999:7:::
由于其实整个日志分析只需要考虑auth.log.1,因此看着wp整完一遍就关了环境
root@ip-10-0-10-6:/var/www/html# find -type f -name “*.php” | xargs grep “eval”
./include/gz.php: eval($payload);
./include/Db/.Mysqli.php: eval($payload);
./shell.php:
河马找木马,别的没找出来
| 疑似PHP命令执行类木马 | /html/api.php |
|---|
/data/tplcache/top.php /wap/index.php 这两个都是自带的CMS文件
/var/www/html/wap/top.php
1 |
|
偷偷看题解,想到会在apache2下的access.log
账号:root 密码:linuxruqin
ssh root@IP
1.web目录存在木马,请找到木马的密码提交
2.服务器疑似存在不死马,请找到不死马的密码提交
3.不死马是通过哪个文件生成的,请提交文件名
4.黑客留下了木马文件,请找出黑客的服务器ip提交
5.黑客留下了木马文件,请找出黑客服务器开启的监端口提交