Author Topic: [1.7 - 1.7.8] Security fix for CSRF vulnerability  (Read 96012 times)

0 Members and 1 Guest are viewing this topic.

Offline kai

  • Administrator
  • Addicted member
  • *****
  • Posts: 1.418
    • View Profile
    • 4images - Image Gallery Management System
[1.7 - 1.7.8] Security fix for CSRF vulnerability
« on: October 27, 2010, 12:10:43 PM »
A cross-site request forgery vulnerability in 4images 1.7 - 1.7.8 has been found.

To fix this please follow these 4 steps:

1.
Download the attached file csrf_utils.php file and copy it into includes/ folder of your 4images installation.


2.
Open global.php and search for the following line:

@include(ROOT_PATH.'config.php');

and insert the following code ABOVE this line:

// Initialize CSRF protection configuration
$csrf_protection_enable      1;
$csrf_protection_frontend    1;
$csrf_protection_backend     1;
$csrf_protection_expires     7200;
$csrf_protection_name        '__csrf';
$csrf_protection_xhtml       1;


In the same file, search for the line:

include_once(ROOT_PATH.'includes/captcha_utils.php');

and insert the following code BELOW this line:

//-----------------------------------------------------
//--- CSRF protection ---------------------------------
//-----------------------------------------------------
include_once(ROOT_PATH.'includes/csrf_utils.php');



3.
Open includes/page_header.php and search for the following line (at the end for the file):

?>

and insert the following code ABOVE this line:

if ($csrf_protection_enable && $csrf_protection_frontend) {
  
csrf_start(true);
}



4.
Open admin/admin_global.php and search for the following line:

include_once(ROOT_PATH.'admin/admin_functions.php');

and insert the following code BELOW this line:

if ($csrf_protection_enable && $csrf_protection_backend) {
  
csrf_start();
}




Thanks to Russ McRee for finding and reporting this vulnerability!
« Last Edit: October 29, 2010, 11:07:24 AM by Jan »
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #1 on: October 27, 2010, 05:43:19 PM »
seit ich das eingebaut habe, klappt die Suche nicht mehr von außerhalb der Galerie.
bekomme dann die Fehlermeldung

CSRF check failed.

Zur Erklärung, habe auf einer anderen Seite eine Suchbox installiert, die zu 4images führt, und bis zu diesem update auch geklappt hat.
http://www.ue-ei-portal.de

Die Suche auf 4images klappt natürlich weiterhin

LG
Danke Harald




Rembrandt

  • Guest
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #2 on: October 27, 2010, 06:40:55 PM »
Seit dem Update bekomme ich beim Aufruf folgende Fehlermeldung (wenn keine &sessionid=*** vorhanden ist):
...
Wie kann ich die Fehlermeldung wieder abstellen?
im moment funktioniert deine seite...

ich pers. habe heute bei 4 galerien das "fix" eingebaut und nirgends gab es probleme..

Offline Hagen-Roderich

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • Hof Jokers
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #3 on: October 27, 2010, 06:47:08 PM »
Ja, Seite funktioniert wieder  :D

Ich habe mir mal die Fehlermeldung durchgelesen und dann die Zeile 249 in der "csrf_utils.php" angeschaut.
Da waren bei mir zwei Leerzeilen hinter "?>".

Danke das Du dir die Zeit dafür genommen hast.

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #4 on: October 27, 2010, 06:48:31 PM »
das Problem kann ich auch nicht bestätigen, und Session ID's werden bei mir auch nicht angezeigt.
Kannst Du denn mal eine externe suche testen ?
Danke Harald




Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #5 on: October 27, 2010, 10:34:11 PM »
Diese auch nicht, gehe davon aus das keine funktionieren

Image Group
Data Backup
Rebuild Thumbnails
Shoutbox Admin
Danke Harald




Rembrandt

  • Guest
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #6 on: October 27, 2010, 10:36:32 PM »
...
Image Group
...
meinst du meine mod?

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #7 on: October 27, 2010, 10:37:57 PM »
jep
wenn ich im Admin die ID aufrufe, kommt die Meldung
Danke Harald




Rembrandt

  • Guest
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #8 on: October 27, 2010, 10:44:33 PM »
ahjo.. so ein schmorn...
ich habe in der global.php das mal auf "0" gesetzt:
Code: [Select]
$csrf_protection_backend     = 0;
aber es wird sicher noch eine lösung dafür geben...

mfg Andi

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #9 on: October 27, 2010, 10:52:36 PM »
damit klappen die internen, bei externen (meine suche)
habe ich noch $csrf_protection_frontend    = 0; auf null gestellt.
Hoffe das kai was findet
Danke Harald




Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #10 on: October 27, 2010, 10:57:01 PM »
ahjo.. so ein schmorn...
ich habe in der global.php das mal auf "0" gesetzt:
Code: [Select]
$csrf_protection_backend     = 0;
aber es wird sicher noch eine lösung dafür geben...

mfg Andi

Hi Andi,

schaltet das den ganzen Schutz ab?


Gruß Jens

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #11 on: October 27, 2010, 11:21:21 PM »
nein, wenn du das auf 0 stellst, ist alles aus

$csrf_protection_enable      = 1;
Danke Harald




Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #12 on: October 28, 2010, 10:02:23 AM »
Ich habe die csrf_utils.php im Hauptpost aktualisiert. Bitte ersetzt die aktuelle mit dieser, dann sollten auch die Plugins wieder funktionieren.

Zu den Konfigurationsvariablen:

Code: [Select]
$csrf_protection_enable      = 1;
Dies auf 0 gesetzt, schaltet den Schutz komplett aus (für Frontend und Backend).

Code: [Select]
$csrf_protection_frontend    = 1;
Dies auf 0 gesetzt, schaltet den Schutz komplett für das Frontend aus.

Code: [Select]
$csrf_protection_backend     = 1;
Dies auf 0 gesetzt, schaltet den Schutz komplett für das Backend aus.

Meine Empfehlung:

$csrf_protection_enable und $csrf_protection_backend sollten in jedem Fall auf 1 gesetzt sein. Falls es Probleme gibt, bitte hier melden. Im Falle von Problemen kann man $csrf_protection_backend temporär auf 0 setzen um benötigte Änderungen durchzuführen. Danach wieder auf 1 setzen.

$csrf_protection_frontend sollte man natürlich am besten auf 1 belassen. Falls es Probleme gibt, kann man hier aber vorrübergehend 0 setzen um die Galerie am Laufen zu halten.
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Rembrandt

  • Guest
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #13 on: October 28, 2010, 11:15:26 AM »
Ich habe die csrf_utils.php im Hauptpost aktualisiert. Bitte ersetzt die aktuelle mit dieser, dann sollten auch die Plugins wieder funktionieren.
...
funktioniert tatsächlich  :mrgreen: danke!

mfg Andi

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.288
    • View Profile
    • Discover the New World of Kindersurprise
Re: [1.7 - 1.7.8] Security fix for CSRF vulnerability
« Reply #14 on: October 28, 2010, 04:42:04 PM »

Meine Empfehlung:

$csrf_protection_frontend sollte man natürlich am besten auf 1 belassen. Falls es Probleme gibt, kann man hier aber vorrübergehend 0 setzen um die Galerie am Laufen zu halten.


Die Suche von außerhalb klappt aber immer noch nicht
würde ungerne drauf verzichten

LG Harald
Danke Harald