Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.36 KB | None | 0 0
  1. <?php
  2. // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
  3. // of $_FILES.
  4.  
  5. $uploaddir = '/var/www/uploads/';
  6. $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
  7.  
  8. echo '<pre>';
  9. if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
  10.     echo "File is valid, and was successfully uploaded.\n";
  11. } else {
  12.     echo "Possible file upload attack!\n";
  13. }
  14.  
  15. echo 'Here is some more debugging info:';
  16. print_r($_FILES);
  17.  
  18. print "</pre>";
  19.  
  20. ?>
  21.  
  22.  
  23.  
  24.  
  25. // wireshark log....
  26.  
  27. POST /test.php HTTP/1.1
  28.  
  29. Content-Type: multipart/form-data; boundary=---------------------8cd540c8dc91f79
  30.  
  31. Host: 192.168.1.4
  32.  
  33. Content-Length: 885443
  34.  
  35.  
  36.  
  37. -----------------------8cd540c8dc91f79
  38.  
  39. Content-Disposition: form-data; name="file"; filename="Chrysanthemum.jpg"
  40.  
  41. Content-Type: application/octet-stream
  42.  
  43.  
  44.  
  45. ......JFIF.....`.`......Adobe.d.......*"Exif..MM.*.......2.........b.;.........vGF..........GI.......?...i.........~...........V..........................................................................................
  46. .....b...u...L..#.d._.... 3.o.&..-.<...u.2V...JR.4.$.....H.O....C.....M.y`.9.....9.%a.-....H..[....Ov.\iF.Q\1..d.X'.........<.N.......:a...f.9#.Q.1...Dz.]V'......+E.... ....>./.....,.,O...q.....Y..OR."X.....j(.w......h.{Z.[.-.+[Y..$...T..N.#5
  47. O<....p...@`..=....W.N...........XcD....*.h...,1....q..).Y.c......e..w.\..?Sj.{...k.'4:hh
  48. ...{E..^..6.......R.k.^.
  49. yS.=R.-M.E7.O.;.*.hX....&..{......3....C=......
  50. i\...S.Y$..i...k..$
  51. ..I..-FKT>
  52. N.x....I..3D..}J.?.,.$.].......*3.....=/-....X........1=2n.z<d2.L]dX..... W@%.
  53. ...G..i....C.Z..T...^k.|7.pV8.rF...j>.O?...v.......@.e...@...c.}... ..<H.P..3.{....j..!S..:.........Ic"G.}55.....Uy&.....w...*+S.P.......[..dv..b../.V......m.....:..sU.".jS.....F@q.....!S.S....G$.k"21a...B..,jF.UW$.Z..Iqw:.`4....^.YI.).}...E.....
  54.  
  55. -----------------------8cd540c8dc91f79--
  56.  
  57. HTTP/1.1 200 OK
  58.  
  59. X-Powered-By: PHP/5.3.3-1ubuntu9.1
  60.  
  61. Content-type: text/html
  62.  
  63. Transfer-Encoding: chunked
  64.  
  65. Date: Wed, 17 Nov 2010 00:19:01 GMT
  66.  
  67. Server: lighttpd/1.4.26
  68.  
  69.  
  70.  
  71. 133
  72.  
  73. <pre>Possible file upload attack!
  74. Here is some more debugging info:Array
  75. (
  76.     [file] => Array
  77.         (
  78.             [name] => Chrysanthemum.jpg
  79.             [type] => application/octet-stream
  80.             [tmp_name] => /tmp/phpRBETbL
  81.             [error] => 0
  82.             [size] => 885242
  83.         )
  84.  
  85. )
  86. </pre>
  87.  
  88.  
  89. 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement