Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Site Vulnerability  (Read 2588 times)

0 Members and 1 Guest are viewing this topic.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Site Vulnerability
« on: July 11, 2006, 03:22:37 PM »
I just noticed it today, all the things that make my site vulnerable to everything.
People can upload PHP files to take over, people might just have the knowledge of whats located where in my site to take it over, and everything like that.

What can I do to protect my site?

(Just as I was downloading PSAK for my site, aka, Swiss Army Knife, because I left my PostNuke disabled, I realized all the problems that I could have with things like hackers, DoS attacks, and whatnot. )
any advice welcome.

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: Site Vulnerability
« Reply #1 on: July 12, 2006, 03:55:57 AM »
HOW can people upload files to your site?  Are you saying they may be able to crack your FTP access?  Then change your password frequently and make it a strong one.
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Site Vulnerability
« Reply #2 on: July 12, 2006, 03:06:38 PM »
Quote
HOW can people upload files to your site?  Are you saying they may be able to crack your FTP access?  Then change your password frequently and make it a strong one.
No no no. I have upload forms. (Not yet available to public)
People don't know the upload directory, but what if they just went anonymous FTP and found it?
They could upload a PHP file that could potentially take over...

And there are many other ways.

How about this:
How would I force an upload form to deny a PHP file?

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: Site Vulnerability
« Reply #3 on: July 14, 2006, 03:51:05 AM »
Quote
People don't know the upload directory, but what if they just went anonymous FTP and found it?
Disable anonymous FTP access, or point it a a directory that prevents them viewing any other directories.

Quote
They could upload a PHP file that could potentially take over...
Only if anonymous uploading is permitting AND such uploads can be accessed via the web server.

Please tell me you're not that silly?  That is pretty much the most insecure setup you could create for any web site.

Quote
How would I force an upload form to deny a PHP file?
Wrong question.  You NEVER trust anything uploaded by a user.  So you NEVER let a user upload to a folder that can then be accessed through the web server.  The reasons for that should be obvious...  If an outside user can force the web server to parse a file he uploaded, he can do pretty much anything he likes with your server.

Therefore, whatever form processes the upload should check the file first, and enforce requirements (such as determining the file name and final location).

NEVER EVER put your web server in a position where it can be FORCED to run a file (of ANY TYPE) uploaded by a user.

Have I said that enough times yet?  ;)
« Last Edit: July 14, 2006, 03:52:10 AM by robpomeroy »
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Site Vulnerability
« Reply #4 on: July 14, 2006, 03:47:53 PM »
Quote
Quote
People don't know the upload directory, but what if they just went anonymous FTP and found it?
Disable anonymous FTP access, or point it a a directory that prevents them viewing any other directories.
I believe it is already disabled. But just to be sure, I will check...
Quote
Quote
They could upload a PHP file that could potentially take over...
Only if anonymous uploading is permitting AND such uploads can be accessed via the web server.

Please tell me you're not that silly?  That is pretty much the most insecure setup you could create for any web site.

They could upload a PHP file through the form. (which is not available to the public) (In fact, its protected and password restricted right now)
Quote
Quote
How would I force an upload form to deny a PHP file?
Wrong question.  You NEVER trust anything uploaded by a user.  So you NEVER let a user upload to a folder that can then be accessed through the web server.  The reasons for that should be obvious...  If an outside user can force the web server to parse a file he uploaded, he can do pretty much anything he likes with your server.

Therefore, whatever form processes the upload should check the file first, and enforce requirements (such as determining the file name and final location).

NEVER EVER put your web server in a position where it can be FORCED to run a file (of ANY TYPE) uploaded by a user.

Have I said that enough times yet?  ;)
The form is what would allow any file to be uploaded. Not FTP.
Re-write: "How would I make a form only allow images to be uploaded"
(as the form is for images. And I would like images to be uploaded there. )

Rob Pomeroy



    Prodigy

  • Systems Architect
  • Thanked: 124
    • Me
  • Experience: Expert
  • OS: Other
Re: Site Vulnerability
« Reply #5 on: July 17, 2006, 09:31:33 AM »
  • Do not store the incoming file in a folder that is within your webroot
  • You will need to rename the file, or at least check the filename, to prevent any existing files from being overwritten
  • Check the the file has an acceptable extension - .jpg, .gif, etc.
  • Use a PHP script to enable the image to be downloaded, but never run
  • Consider using the PHP image functions to test whether the file is an image (by checking its size, for example)
  • Consider emailing to you a copy of all uploaded files
Only able to visit the forums sporadically, sorry.

Geek & Dummy - honest news, reviews and howtos

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Site Vulnerability
« Reply #6 on: July 17, 2006, 03:29:00 PM »
Quote
  • Do not store the incoming file in a folder that is within your webroot
  • You will need to rename the file, or at least check the filename, to prevent any existing files from being overwritten
  • Check the the file has an acceptable extension - .jpg, .gif, etc.
  • Use a PHP script to enable the image to be downloaded, but never run
  • Consider using the PHP image functions to test whether the file is an image (by checking its size, for example)
  • Consider emailing to you a copy of all uploaded files
Well, in that case, I think I am mostly fine.
I can rename the files as they come in. I am sent an email with a link to the file, and the files are automatically renamed.
I will start another thread about acceptable file extensions.
So, for now, I think I am all good!

Flame

  • Moderator


  • Prodigy

  • Think, dream, see, be... Everything.
  • Thanked: 6
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Other
Re: Site Vulnerability
« Reply #7 on: July 19, 2006, 05:34:15 PM »
If you keep the account safe, leave the rest to Scott  ;)

Flame

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Site Vulnerability
« Reply #8 on: July 19, 2006, 05:39:04 PM »
Quote
If you keep the account safe, leave the rest to Scott  ;)

Flame
Scott?
BTW: Flame,
I have been sending emails to [email protected] , and have received no replies.