Author Topic: SECURITY: album.cfg in cgi-bin  (Read 6405 times)

0 Members and 1 Guest are viewing this topic.

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
SECURITY: album.cfg in cgi-bin
« on: April 17, 2002, 17:35:16 »
Hello all!

I've been alerted to the fact that on some systems, your config file (album.cfg) can be downloaded directly. In these cases, you should move album.cfg out of your cgi-bin directory, so that is no longer accessible under your web root.

Once you have moved the config file, you'll have to edit album.pl, to tell it where you moved it. This is done by changing the "configfile=" line, which appears near the very beginning of the script.

You may also be able to re-configure your web server to disallow access to .cfg files in your cgi-bin directory, though this is not the simplest solution.

To test if your site is vulnerable, go to your album, and replace the "pl" at the end of the URL with "cfg". Some servers will just throw an internal server error, but others will allow the user to download your configuration.

If you have any questions about this, please post them here.

Cheers

Offline michael

  • album.pl Tester
  • **
  • Posts: 25
  • Karma: +0/-0
  • Album.pl is cool ;)
    • The MikeCam
Re: SECURITY: album.cfg in cgi-bin
« Reply #1 on: April 18, 2002, 08:47:21 »
Heh, woops, teach me to watch my permissions. I just took off read access for the public, which is what everyone else can do as well.. CHMOD 640 or 600
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline fivepin

  • album.pl Donor
  • album.pl Tester
  • **
  • Posts: 30
  • Karma: +0/-0
  • I Love ALBUM.PL !!
    • LoganHarris.com
Re: SECURITY: album.cfg in cgi-bin
« Reply #2 on: July 12, 2002, 13:55:56 »
I know we aren't supposed to post here, but I wanted to make you aware of this Mike.

I did exactly as you said, and it broke my album.  I tried moving the cfg to a different folder, I tried keeping it in the cgi-bin with the same name ... but the album.pl never worked again.

I fixed it by doing a REPLACE in the album.pl ...  replace all album.cfg with xxxxx.cfg (my new filename).  this worked.  

One question, if I changed the name of the cfg file, that does mean that all the subfolder cfg files will have to change to the same name, right?
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: SECURITY: album.cfg in cgi-bin
« Reply #3 on: July 15, 2002, 10:09:25 »
Changing the "configfile=" line is a bit more complicated than it appears... You can change it in a relative way, I.E. "configfile=../config/album.cfg" or in an absolute way ("configfile=/home/user/album.cfg") but anything other than that is likely to break it.

What did you change the configfile= line to? (When it was broken...)
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline fivepin

  • album.pl Donor
  • album.pl Tester
  • **
  • Posts: 30
  • Karma: +0/-0
  • I Love ALBUM.PL !!
    • LoganHarris.com
Re: SECURITY: album.cfg in cgi-bin
« Reply #4 on: July 15, 2002, 10:19:24 »
Quote


What did you change the configfile= line to? (When it was broken...)


I thought I may be having path problems, so I even simply changed the line to read

configfile=install.cfg

and I renamed the album.cfg to install.cfg.  simple as that, and it didn't work.  not until I did a "replace" of album.cfg to install.cfg.  Then it worked just fine.
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: SECURITY: album.cfg in cgi-bin
« Reply #5 on: July 15, 2002, 11:01:21 »
Yeah, the code is a bit tricky there. It tries to open "configfile" as you've defined it, which by default is just "album.cfg" with no directory.

That pretty much always fails, so (among other things) it tries to append the current directory's path to a hard-coded album.cfg, and that usually works. But since it was hard coded, it would fail if you changed the name.

So (to try to be brief) I've added a new attempt in the code which should make it work for you. If you want to re-download and copy over your album.pl, it should work.

Cheers
« Last Edit: December 31, 1969, 19:00:00 by 1039064400 »

Offline p5mmx10g

  • album.pl User
  • *
  • Posts: 15
  • Karma: +0/-0
  • I forgot to change the default text.
Re: SECURITY: album.cfg in cgi-bin
« Reply #6 on: May 04, 2004, 21:01:09 »
on album.pl, change $::configfile="album.cfg";
to $::configfile="alongassfilenamewith123.cfg";

and set your cgi-bin folder can't list directory.

i guess in that way, there is noway for other people to guess your config file name. so they can't open it and try to hack your password path.


Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re: SECURITY: album.cfg in cgi-bin
« Reply #7 on: May 06, 2004, 10:32:44 »
Yep, that's another good method for securing your settings... Thanks!