Jump to content

Forwarding $_FILES requests


benjamin_

Recommended Posts

Hello,

 

I've written php scripts that emulate a simple web proxy server, it forwards each request to the requested server and can authenticate users on several applications.

 

One of these applications provides a file upload feature, with a bit of tampering I tried to reverse the $_POST data in order to replicate it and send it to the right server.

 

It turns out to be like that:

// MAGIC + Content-Disposition: form-data; name="wpUploadFile"; filename=""\r\nContent-Type: $contenttype\r\n\r\n
// DATA OF THE FILE\r\n
// MAGIC\r\n
// Content-Disposition: form-data; name="wpSourceType"\r\n\r\nfile\r\nMAGIC\r\n
// Content-Disposition: form-data; name="wpDestFile"\r\n\r\n
// FILENAME\r\nMAGIC\r\n
// Content-Disposition: form-data; name="wpUploadDescription"\r\n\r\n
// DESCRIPTION\r\nMAGIC\r\n
// Content-Disposition: form-data; name="wpUpload"\r\n\r\n
// import file\r\nMAGIC\r\n

 

As you see, there's a MAGIC value, typically something like:

-----------------------1234412412312312312312

That's the only thing I need to send the file, all the data is in $_POST['POST_DATA'] on the client side. On the server side, you have the tmp_name instead of the file's data, so you can fopen the file, read it and so on.

 

Does anyone know what the MAGIC value is ? Please give me a clue !

 

Thanks in advance.

 

Benjamin.

 

PS: I figured out that the MAGIC value doesn't change if you send the same file, but changes when you send another file, it may be a sort of checksum, there are only numbers in this MAGIC.

Link to comment
https://forums.phpfreaks.com/topic/173909-forwarding-_files-requests/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.