Advertisement

DVWA—文件上传漏洞(FileUpload)

阅读量:

DVWA—文件上传漏洞(File Upload)

原理

相当数量的网站及应用系统均具备上传功能,在开发者设计任意文件上传功能时往往忽视了对文件格式后缀的有效性验证或仅在前端层面依赖JavaScript进行后缀检测。在这种情况下,攻击者可发送一个与服务器端脚本语言对应的恶意动态脚本(如jSP、ASP、PHP、ASPx文件扩展名)至服务器端,从而解析并执行其中所含恶意代码,最终达到破坏服务器安全的目的

low

复制代码
    <?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' ] );
    
    	// Can we move the file to the upload folder?
    	if( !move_uploaded_file( $_FILES[ 'uploaded' ][ 'tmp_name' ], $target_path ) ) {

全部评论 (0)

还没有任何评论哟~