Upload Parameter !
www.mijnwebsite.nl/upload?=Blablabla.txt
Upload?=blablabla.txt is dan de parameter, hij lukt wel met het uploaden maar ik ga via een shellexecute in mijn C++ programma, uploaden.
Dus hij moet zegmaar een bestand dat op de C: schijf staat uploaden.
Source ( Credits naar nitrogen ) :
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<FORM ENCTYPE="multipart/form-data" ACTION="<?php echo($_SERVER["PHP_SELF"]); ?>" METHOD=POST>
Upload this file: <INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File"></FORM>
<?php
$Upload = $_FILES["userfile"];
$Text="";
switch($Upload["error"])
{
case UPLOAD_ERR_OK:$Text="Done.";break;
case UPLOAD_ERR_INI_SIZE:$Text="File size too high (as specified by the ini).";break;
case UPLOAD_ERR_FORM_SIZE:$Text="File size too high (as specified by the HTML).";break;
case UPLOAD_ERR_PARTIAL:$Text="File uploaded only patrially.";break;
case UPLOAD_ERR_NO_FILE:$Text="No file.";break;
case UPLOAD_ERR_NO_TMP_DIR:$Text="No temporary directory.";break;
case UPLOAD_ERR_CANT_WRITE:$Text="Unable to write to disk.";break;
case UPLOAD_ERR_EXTENSION:$Text="Invalid extensions.";break;
}
echo("$Text<br>\r\n");
echo("tmp: ".$Upload["tmp_name"]."<br>\r\n");
echo("nam: ".$Upload["name"]."<br>\r\n");
echo("typ: ".$Upload["type"]."<br>\r\n");
echo("siz: ".$Upload["size"]."<br>\r\n");
$MoveTo = "uploads\\".$Upload["name"];
echo("mov: ".$MoveTo."<br>\r\n<br>\r\n");
if(move_uploaded_file($Upload["tmp_name"],$MoveTo))
{
echo("File is valid, and was successfully uploaded.\r\n<br>You can download this file again by clicking <a href=\"uploads/".$Upload["name"]."\">here!</a>");
}
else
{
echo("Possible file upload attack!\n");
}
echo("<br>\r\n<br>\r\n<br><pre>");
print_r($_FILES);
?>
Upload this file: <INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File"></FORM>
<?php
$Upload = $_FILES["userfile"];
$Text="";
switch($Upload["error"])
{
case UPLOAD_ERR_OK:$Text="Done.";break;
case UPLOAD_ERR_INI_SIZE:$Text="File size too high (as specified by the ini).";break;
case UPLOAD_ERR_FORM_SIZE:$Text="File size too high (as specified by the HTML).";break;
case UPLOAD_ERR_PARTIAL:$Text="File uploaded only patrially.";break;
case UPLOAD_ERR_NO_FILE:$Text="No file.";break;
case UPLOAD_ERR_NO_TMP_DIR:$Text="No temporary directory.";break;
case UPLOAD_ERR_CANT_WRITE:$Text="Unable to write to disk.";break;
case UPLOAD_ERR_EXTENSION:$Text="Invalid extensions.";break;
}
echo("$Text<br>\r\n");
echo("tmp: ".$Upload["tmp_name"]."<br>\r\n");
echo("nam: ".$Upload["name"]."<br>\r\n");
echo("typ: ".$Upload["type"]."<br>\r\n");
echo("siz: ".$Upload["size"]."<br>\r\n");
$MoveTo = "uploads\\".$Upload["name"];
echo("mov: ".$MoveTo."<br>\r\n<br>\r\n");
if(move_uploaded_file($Upload["tmp_name"],$MoveTo))
{
echo("File is valid, and was successfully uploaded.\r\n<br>You can download this file again by clicking <a href=\"uploads/".$Upload["name"]."\">here!</a>");
}
else
{
echo("Possible file upload attack!\n");
}
echo("<br>\r\n<br>\r\n<br><pre>");
print_r($_FILES);
?>
Nu wil ik zegmaar dat ik bijvoorbeeld een plaatje in mijn C:\ schijf heb staan hij het upload.. dus zoiets:
www.bajodjfla.com/upload?=C:\example
bedankt,
Eduard
Er zijn nog geen reacties op dit bericht.