PrestaShop v.1.3.1 – Important security update

We draw your attention to a new version of PrestaShop, concerning security.

With the great assistance of John JEAN from the Wargan Solutions company, specialized in computer security, we managed to fix several security vulnerabilities in the software affecting all versions (from v0.8 to v1.3).

One of the main benefits of Open-Source software is safety and reliability. Our team and the community produce their best efforts to offer quality software and responsiveness in terms of patches availability.

So you benefit a software continuously improved in terms of stability and security, which includes advice and recommendations from leading experts in each domain!

We strongly recommend you to update PrestaShop to correct these problems.

To update PrestaShop to this new version you can:

- Update PrestaShop with the new 1.3.1 version.

This version is identical to the 1.3 version (it does not fix bugs) and only corrects problems related to security


- If you do not want to upgrade your PrestaShop shop, apply the following changes in your files:

/! Important: You must of course first and foremost, BACKUP your old files before applying these changes.

File: /config/
Where: At the end of the file, before “?>”
Add: $smarty->register_modifier(‘secureReferrer’, array(‘Tools’, ‘secureReferrer’));

File: /modules/paypalapi/error.tpl
Where: line 13
Replace: {$smarty.server.HTTP_REFERER}
By: {$smarty.server.HTTP_REFERER|secureReferrer}

File: /themes/prestashop/errors.tpl :
Where: line 9
Replace: {$smarty.server.HTTP_REFERER|escape:’htmlall’:'UTF-8′}
By: {$smarty.server.HTTP_REFERER|escape:’htmlall’:'UTF-8′|secureReferrer}

File: /themes/prestashop/shopping-cart.tpl :
Where: line 255
Replace: {$smarty.server.HTTP_REFERER|escape:’htmlall’:'UTF-8′}
By: {$smarty.server.HTTP_REFERER|escape:’htmlall’:'UTF-8′|secureReferrer}

File: /admin/login.php
Where: line 67
$cookie->passwd = $employee->passwd;
$cookie->passwd = $employee->passwd;
$cookie->remote_addr = ip2long($_SERVER['REMOTE_ADDR']);

File: /admin/confirm.php
Where: Line 22
Replace: $referer = rawurldecode(Tools::getValue(‘referer’));
By: $referer = Tools::htmlentitiesUTF8(rawurldecode(Tools::getValue(‘referer’)));

File: /classes/Tools.php
Where: Line 17
After “class Tools
Add these two functions:

* Get the server variable SERVER_NAME
* @param string $referrer URL referrer
static function getServerName()

* Secure an URL referrer
* @param string $referrer URL referrer
static public function secureReferrer($referrer)
if (preg_match(‘/^http[s]?://’.self::getServerName().’/.*$/Ui’, $referrer))
return $referrer;
return __PS_BASE_URI__;

File: /classes/Cookie.php
Where: Line 164
Replace the function isLoggedBack() by this function:
function isLoggedBack()
/* Employee is valid only if it can be load and if cookie password is the same as database one */
if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND
Employee::checkPassword(intval($this->id_employee), $this->passwd) AND (!isset($this->_content['remote_addr']) OR
$this->_content['remote_addr'] == ip2long($_SERVER['REMOTE_ADDR'])))
return true;
return false;
Click here to download PrestaShop v.1.3.1

Comments are closed.