Connecting Tech Pros Worldwide Help | Site Map

protecting file upload

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 11:28 AM
ahevans
Guest
 
Posts: n/a
Default protecting file upload

Hi,

I've read a few bits on the web about vulnerabilities in providing
file uploads where the upload could contain ../../ and so allow 'back
browsing' to other files on the server and copying them to a public
directory. If I was to check for this scenerio, would I have to do
something like (in simple terms):

if $_FILES['userfile']['tmp_name'] or $_FILES['userfile']['name'] =
.../../
echo u are norty
else
continue with code

Also, is it possible to verfiy that the referring html form to my
upload script originates from my server only? I could stop anyone from
creating their own forms then.

Many thanks

  #2  
Old July 17th, 2005, 11:28 AM
Senator Jay Billington Bulworth
Guest
 
Posts: n/a
Default Re: protecting file upload

ahevans@gmail.com (ahevans) wrote in news:d589c3f.0502120410.15a672d7
@posting.google.com:
[color=blue]
> Hi,
>
> I've read a few bits on the web about vulnerabilities in providing
> file uploads where the upload could contain ../../ and so allow 'back
> browsing' to other files on the server and copying them to a public
> directory. If I was to check for this scenerio, would I have to do
> something like (in simple terms):
>
> if $_FILES['userfile']['tmp_name'] or $_FILES['userfile']['name'] =
> ../../
> echo u are norty
> else
> continue with code[/color]

See:

<http://groups-
beta.google.com/group/comp.lang.php/browse_frm/thread/eff851f20fb4a8d/af5ad
51cf5946e1c>

(URL should all be on one line. Hey Google, new groups.google blows.)
[color=blue]
> Also, is it possible to verfiy that the referring html form to my
> upload script originates from my server only? I could stop anyone from
> creating their own forms then.[/color]

It's possible to detect the referring URL, but anyone can send whatever
Referer header they choose. There is no real security in checking the
Referer header.

hth


--
Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.