You are here: Re: What is the best chmod for a fopen/fwrite? « PHP Programming Language « IT news, forums, messages
Re: What is the best chmod for a fopen/fwrite?

Posted by C. on 07/25/07 11:35

On 25 Jul, 07:27, Sanders Kaufman <bu...@kaufman.net> wrote:
> FFMG wrote:
> > Hi,
>
> > My users can upload images in a folder on my system.
> > What minimum attribute should I give the created, (@fopen($new_file,
> > 'wb');), files and folder?
>
> > I limit the extension of files, (images), but I want to prevent them
> > from executing any code on the server.
>
> > What attributes would you suggest?
>

What is your security model?

I'd usually go with drwxrSxr-x for upload dirs (with a group including
webserver uid and web developer uids) and -rw-rw-r-- for files. But a
group excluding web server uid for non-uploaded content.

> Just a note about this.
> I found out a few years ago that you also should strip header
> information out of GIF images. You can put PHP code in there, and it
> executed when the gif is displayed.
>

This only applies if the PHP parsing engine is invoked on the file.
This is usually determined by the file extension:

> > I limit the extension of files,

But its probably better practice to convert to a different img format
and back again using GD to be on the safe side.

C.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация