DVWA靶场搭建
- 将文件拷入虚拟机
- 修改数据库配置文件
/dvwa_2.0.1/config/config.inc.php
。
$_DVWA[ 'db_server' ] = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa_201';
$_DVWA[ 'db_user' ] = 'root';
$_DVWA[ 'db_password' ] = 'root';
$_DVWA[ 'default_security_level' ] = 'low';
-
重启数据库之后就可进入登录界面
-
账号admin 密码password
对搭建的靶场上传图片马
- 准备一句话木马并改后缀
- low难度直接上传成功
medium 难度
在不修改的情况下,上传失败
打开bp进行修改上传
将content-type修改为图片,上传成功
high难度
使用中等难度的上传方法已经不能完成
查看代码
<?php
if( isset( $_POST[ 'Upload' ] ) ) {
// Where are we going to be writing to?
$target_path = DVWA_WEB_PAGE_TO_ROOT . "hackable/uploads/";
$target_path .= basename( $_FILES[ 'uploaded' ][ 'name' ] );
// File information
$uploaded_name = $_FILES[ 'uploaded' ][ 'name' ];
$uploaded_ext = substr( $uploaded_name, strrpos( $uploaded_name, '.' ) + 1);
$uploaded_size = $_FILES[ 'uploaded' ][ 'size' ];
$uploaded_tmp = $_FILES[ 'uploaded' ][ 'tmp_name' ];
// Is it an image?
if( ( strtolower( $uploaded_ext ) == "jpg" || strtolower( $uploaded_ext ) == "jpeg" || strtolower( $uploaded_ext ) == "png" ) &&
( $uploaded_size < 100000 ) &&
getimagesize( $uploaded_tmp ) ) {
// Can we move the file to the upload folder?
if( !move_uploaded_file( $uploaded_tmp, $target_path ) ) {
// No
echo '<pre>Your image was not uploaded.</pre>';
}
else {
// Yes!
echo "<pre>{$target_path} succesfully uploaded!</pre>";
}
}
else {
// Invalid file
echo '<pre>Your image was not uploaded. We can only accept JPEG or PNG images.</pre>';
}
}
?>
可得:文件上传后缀白名单检测,文件内容检测
上传报错
打开bp修改如下:
上传成功
标签:uploaded,db,DVWA,修改,上传,0629,难度 From: https://www.cnblogs.com/W-xzg/p/17514718.html