Author Topic: If u know absolute path, u can get a file  (Read 10189 times)

0 Members and 1 Guest are viewing this topic.

Offline helpme

  • Newbie
  • *
  • Posts: 19
    • View Profile
If u know absolute path, u can get a file
« on: June 30, 2002, 06:40:46 AM »
well, version 1.6 works like a dream, however, if people knows the absolute path to your images or files, they still can download, view it even tho u set the permission for the categories if private or registered or watever  :(

Is there a way to prevent this

Offline helpme

  • Newbie
  • *
  • Posts: 19
    • View Profile
If u know absolute path, u can get a file
« Reply #1 on: June 30, 2002, 03:38:37 PM »
am I right or wat, u can test on ur own 4images site anyways :)

Offline Alan @ ArtScans

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://www.qcs-software.com
If u know absolute path, u can get a file
« Reply #2 on: June 30, 2002, 03:43:09 PM »
Hi,

Unfortunatly, this isn't just a 4images problem.  The nature of web servers mean that you can get any publicly accessable file in the web server directory tree.

The only way (that I can think of) to work around this, would be to store the images in a BLOB column in the database, instead of files.

If security / permissions are of a prime concern to your site, then you'd better start editing the php :-)

Good luck,
Alan.
Alan Wagstaff,
Software Development Manager, SDT
QCS Software

Offline helpme

  • Newbie
  • *
  • Posts: 19
    • View Profile
If u know absolute path, u can get a file
« Reply #3 on: June 30, 2002, 06:29:26 PM »
well, i've seen scripts, program that prevent people from geting files on ur server directly, unfortunately i can't afford to buy the software so i'm looking for a free scripts that let me do this

any1 got any idea where i could get these kind of script?

Offline Alan @ ArtScans

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://www.qcs-software.com
If u know absolute path, u can get a file
« Reply #4 on: June 30, 2002, 06:40:38 PM »
Hi,

To the best of my knowledge, you cannot do this with 4images, as it requires the media directories to be world read/writable.  If a visitor goes directly to the URL, it bypasses 4images, and gets the web server listing for that directory, so you would need to read up on your web servers docs (but again, that will probably stop 4images being able to read/write images).

The only way that I can think of doing it, is to store the images in the database.  Ask in the Mods forum, and maybe someone will write it for you (but it would be a fairly big job).

Unless of course, Jan plans to put such a feature in the next version? :-)

Thanks,
Alan.
Alan Wagstaff,
Software Development Manager, SDT
QCS Software

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
A solution exists (almost) for Apache web server
« Reply #5 on: July 01, 2002, 05:42:44 AM »
If your web server is running Apache, you can use .htaccess to prevent people from loading images in their browser by entering the full URL in the address bar.

For an explanation of what the .htaccess file is all about and how to use it, read the article here:  http://www.javascriptkit.com/howto/htaccess10.shtml

This part of the article talks about hot linking but it will serve your purpose.

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?YourWebSite.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]


That code will instruct the Apache web server to return a "403 - Forbidden, access denied" error page back to the user should they try to access the image file directly.

HERE'S THE CATCH:

The user can always dig through their browser's cache and locate the file given to them by details.php.  They might also use a web site copier tool, or......  there are several other ways of getting the image.  So basically, the .htaccess approach will only work if you had a download image different from than the one served up by details.php

My two cents:  I'm not at all in favor of storing the images in the database itself.  It would introduce performance issues.

Offline helpme

  • Newbie
  • *
  • Posts: 19
    • View Profile
If u know absolute path, u can get a file
« Reply #6 on: July 01, 2002, 10:21:59 AM »
thanks for all the help guys, really appreciate it ;)

well, what i've already done is, i put the .htaccess file inside the data directory so no one can hot linking to my stuff from my site ;)

But to prevent people from downloading certain files at ur site ( i only want server people from a specific group to download), if they guess tha path right, they still can get the file....urm...