Jump to content

Recommended Posts

Hi All,

In a recent paper about unserialization attacks ("File Operation Induced Unserialization via the “phar://”StreamWrapper") that can be found here the recommended defence is :

"To prevent the exploitation of this issue it is imperative to prevent attacker-controlled data being used in the beginning of a file name used in any of the file operations which can trigger stream wrappers."

Is there a way to implement this protection ? Could a regex on the filename do the job ?

Thanks !

 

 

Link to comment
https://forums.phpfreaks.com/topic/307635-preventing-unserialization-attacks/
Share on other sites

Thanks for your answer.

For example, my website allows the user to upload jpeg files. Before storing the files, in addition to doing some checks, it renames the files in such a way that there will never be two files bearing the same name. Later, when the website displays those images, it first checks whether the corresponding files exist (if (file_exists(…))). Is this approach at risk as far as unserialization attacks are concerned ?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.