The AnimeFanlistings Network Message Board

CodeGrrl PHP scripts vulnerability

Offline Jonathan

  • TAFL Staff Alumni
  • *
    • Posts: 0
    • View Profile
An error in several GodeGrrl PHP scripts has been found that can potentially let a malicious web user read any file on your website, upload their own files, or otherwise cause mischief and mayhem. The vulnerable scripts are:

PHPCurrently version 2.0 and prior
PHPQuotes version 1.0 and prior
PHPCalendar version 1.0 and prior
PHPClique version 1.0 and prior
PHPFanBase version 2.1 and prior

Quote
Input passed to the "siteurl" parameter in "protection.php" isn't properly verified, before it is used to include files. This can be exploited to include arbitrary files from external and local resources.

REMEDIES:

If you have the ability to edit the php.ini file (PHP configuration file) on your webserver, set the "register_globals" variable to "off".*

If you do not have the ability to edit the configuration file, consider using an alternate script system until a new version is provided that fixes the vulnerability.

OR, if you are an uber PHP guru, you can edit protection.php yourself to make sure the siteurl variable has not been tainted.

References:
http://secunia.com/advisories/17542/
http://www.frsirt.com/english/advisories/2005/2402


*NOTE: I do not know if setting "register_globals" to "off" will break any of the scripts.

EDIT: That will teach me to multi-task while trying to process someone else's code. I incorrectly diagnosed the problem from the security advisories above. Text of post changed to reflect actual threat. Thread opened for discussion and sharing of suggestions of how to ensure the siteurl variable is not tainted.
« Last Edit: November 14, 2005, 08:06:56 PM by Johan »


Offline Jonathan

  • TAFL Staff Alumni
  • *
    • Posts: 0
    • View Profile

Offline Shadow

  • TAFL Staff Alumni
  • *
    • Posts: 0
  • HYDE. ICHIGO. ALPHONSE. BOYSANDW
    • View Profile
    • http://www.elric.nu
Thank you, Johan! *has quickly converted the last phpfanbase fanlisting to Enth on her server* @_@


Firefly

  • Guest
Thanks for opening up the thread.

I have a question on this issue.  I don't use Fanbase, but my two hostees do.  Now, the issue is with the part of the protection.php?

Code: [Select]
// This is the page to show when the user has been logged out
$logout_page = "$siteurl";


Offline Mura

  • TAFL Staff Alumni
  • *
    • Posts: 0
  • Shiny things. =D
    • View Profile
    • http://fan.gekidasa.net
I know other CodeGrrl scripts, as they are now, assume register_globals is turned on, so it's likely that these will break when it's turned off. If so, they can probably be fixed by adding this somewhere:

Code: [Select]
extract($_GET, EXTR_SKIP);
extract($_POST, EXTR_SKIP);


I'm told that doesn't compromise security, but Johan can probably say whether or not it really does better than I can. ^^
« Last Edit: November 14, 2005, 08:56:17 PM by Mura »
[color=\"#FFCC00\"]☆ [color=\"#993399\"]Mura[/color] ☆[/color] [color=\"#993399\"]

aka Boobitari Perestroika Homuncula sensei/Ebil Wonder Twin Jayna

(メ¬_¬) --> (.~_^)/☆ OTP!!



FLs | LJ | Plug: [url=\"http://fuuma.


Offline Shell

  • TAFL Staff Alumni
  • *
    • Posts: 0
    • View Profile
    • http://www.firesenshi.com
I have a question....before when I used phpfanbase I had to add the

Code: [Select]
php_flag register_globals on
to my .htaccess to get the script to work.  Now that I use Enthusiast, should I remove this snippet from my .htaccess?
« Last Edit: November 14, 2005, 09:40:28 PM by Shell »


Offline Mura

  • TAFL Staff Alumni
  • *
    • Posts: 0
  • Shiny things. =D
    • View Profile
    • http://fan.gekidasa.net
[quote name='Shell' date='Nov 14 2005, 08:40 PM']I have a question....before when I used phpfanbase I had to add the

Code: [Select]
php_flag register_globals on
to my .htaccess to get the script to work.  Now that I use Enthusiast, should I remove this snippet from my .htaccess?
[post=\"115790\"]<{POST_SNAPBACK}>[/post]
[/quote]


Yeah, remove it. Enthusiast doesn't depend on register_globals, and it's safer to have it off. ^_^
« Last Edit: November 14, 2005, 09:53:01 PM by Mura »
[color=\"#FFCC00\"]☆ [color=\"#993399\"]Mura[/color] ☆[/color] [color=\"#993399\"]

aka Boobitari Perestroika Homuncula sensei/Ebil Wonder Twin Jayna

(メ¬_¬) --> (.~_^)/☆ OTP!!



FLs | LJ | Plug: [url=\"http://fuuma.


Offline Shell

  • TAFL Staff Alumni
  • *
    • Posts: 0
    • View Profile
    • http://www.firesenshi.com
that's what i figured....it just never occured to me b/c I simply forgot about it *L*

*goes to fix 22 fls now  ^_^*

Offline Jonathan

  • TAFL Staff Alumni
  • *
    • Posts: 0
    • View Profile
[quote name='Firefly' date='Nov 14 2005, 05:51 PM']Thanks for opening up the thread.

I have a question on this issue.  I don't use Fanbase, but my two hostees do.  Now, the issue is with the part of the protection.php?

Code: [Select]
// This is the page to show when the user has been logged out
$logout_page = "$siteurl";
[post=\"115777\"]<{POST_SNAPBACK}>[/post]
[/quote]
Yes, that is the problem code there.


Offline Jonathan

  • TAFL Staff Alumni
  • *
    • Posts: 0
    • View Profile
[quote name='Mura' date='Nov 14 2005, 05:54 PM']I know other CodeGrrl scripts, as they are now, assume register_globals is turned on, so it's likely that these will break when it's turned off. If so, they can probably be fixed by adding this somewhere:
Code: [Select]
extract($_GET, EXTR_SKIP);
extract($_POST, EXTR_SKIP);
I'm told that doesn't compromise security, but Johan can probably say whether or not it really does better than I can. ^^
[post=\"115778\"]<{POST_SNAPBACK}>[/post]
[/quote]
According to the PHP online manual, extract breaks an array into individual variables. The "EXTR_SKIP" flag prevents PHP from clobbering existing variables with the extracted data:
Code: [Select]
Do not use extract() on untrusted data, like user-input ($_GET, ...). If you do, for example, if you want to run old code that relies on register_globals  temporarily, make sure you use one of the non-overwriting extract_type values such as EXTR_SKIP and be aware that you should extract in the same order that's defined in variables_order within the php.ini.Basically what it's saying is when you use it on $_GET and $_POST, ALWAYS add the EXTR_SKIP flag to make sure the get and post data doesn't overwrite your existing variables. Of course not using "register_globals" is encouraged by the PHP folks, but this appears to be a decent fix.


Offline Jonathan

  • TAFL Staff Alumni
  • *
    • Posts: 0
    • View Profile
(whee, 3 in a row)

Just to be clear, I want to state that in an effort to remain impartial to popular management systems, I am not naming alternatives, nor am I badmouthing CodeGrrl's scripts. I am just alerting potential users of those scripts of vulnerabilities that have been found and documented.


Firefly

  • Guest
Thanks.  Since I use Enthusiast though, I can't turn the register globals off.  =.=  So I'm making a quckie script for my hostees to use.


Offline Mura

  • TAFL Staff Alumni
  • *
    • Posts: 0
  • Shiny things. =D
    • View Profile
    • http://fan.gekidasa.net
[quote name='Firefly' date='Nov 15 2005, 07:48 PM']Thanks.  Since I use Enthusiast though, I can't turn the register globals off.  =.=  So I'm making a quckie script for my hostees to use.
[post=\"116059\"]<{POST_SNAPBACK}>[/post]
[/quote]



...Yes you can. Enthusiast doesn't require register_globals.
[color=\"#FFCC00\"]☆ [color=\"#993399\"]Mura[/color] ☆[/color] [color=\"#993399\"]

aka Boobitari Perestroika Homuncula sensei/Ebil Wonder Twin Jayna

(メ¬_¬) --> (.~_^)/☆ OTP!!



FLs | LJ | Plug: [url=\"http://fuuma.


Firefly

  • Guest

Offline Tracy

  • Newbie
  • *
    • Posts: 0
    • View Profile
    • http://www.sesshoumaru.org
good thing i'm changing to enth3 o.o
篱笆外的古道我牵着你走过

li ba wai de gu dao wo qian zhe ni zou guo

I once held your hand walking that road outside the bamboo fence

-------

I love Sesshoumaru <3

Fan of Me?