The GET handler treats existence as the authorization decision
PrestaShop 1.7 through 8.2.2 ships an admin password-reset flow that starts with an email link. The link is generated by processForgot() and points back at the same controller with two parameters: id_employee (an auto-increment integer naming which administrator the link belongs to) and reset_token (a 40-character SHA-1 stamped onto the employee row at link-generation time, with a 1440-minute default validity window).
When an administrator clicks that link, the browser hits index.php?controller=AdminLogin&id_employee=N&reset_token=T. The front controller routes the GET to AdminLoginController::initContent(), which is responsible for rendering the form the administrator will type their new password into. The form needs the employee's email so it can round-trip the value back on submission, and so the user can see whose account they are about to change.
The pre-patch initContent() walks five operations:
// controllers/admin/AdminLoginController.php (PrestaShop 8.2.2, lines 160-170)
// For reset password feature
if ($reset_token = Tools::getValue('reset_token')) {
$this->context->smarty->assign('reset_token', $reset_token);
}
if ($id_employee = Tools::getValue('id_employee')) {
$this->context->smarty->assign('id_employee', $id_employee);
$employee = new Employee($id_employee);
if (Validate::isLoadedObject($employee)) {
$this->context->smarty->assign('reset_email', $employee->email);
}
}
Read the operations in order. The handler reads reset_token from the request and binds it to the Smarty template. The token is never compared to anything. Its single role in this method is to be a hidden input on the form that submits the new password, so the next request carries it back. The handler then reads id_employee from the request, instantiates an Employee object against it, and asks Validate::isLoadedObject whether the constructor succeeded in loading a row. If the row loaded, the employee's email goes into the template.
The check at the end of that sequence is asking "does an employee with this ID exist in the database?" The decision it gates is whether to disclose that employee's email. Those are two different questions. The PoC iterates id_employee from 1 to 30 (PrestaShop installs typically have between one and ten administrators, and id_employee is a sequential primary key), runs the URL once per integer with arbitrary garbage in reset_token, and scrapes the rendered HTML for <input ... name="reset_email" value="...">. Each iteration that finds a row prints a real administrator's email. The reset_token can be any non-falsy string.
The validator was already on the model
The fixed version of initContent() calls a real validator. The validator's name is Employee::getValidResetPasswordToken(), defined in classes/Employee.php:
// classes/Employee.php (lines 711-725, identical in 8.2.2 and 8.2.3)
/**
* Returns the valid reset password token if it validity date is > now().
*/
public function getValidResetPasswordToken()
{
if (!$this->reset_password_token) {
return false;
}
if (!$this->reset_password_validity || strtotime($this->reset_password_validity) < time()) {
return false;
}
return $this->reset_password_token;
}
This method existed in PrestaShop 8.2.2. A byte-level diff of classes/Employee.php between 8.2.2 and 8.2.3 is empty; the patch did not add the validator. The pre-patch initContent() loaded the Employee object and then did not call $employee->getValidResetPasswordToken(). It called Validate::isLoadedObject($employee) instead.
In the same controller, two hundred lines further down, processReset() already knew how to use the method. That handler answers the POST the form submits, and its job is to actually change the password:
// controllers/admin/AdminLoginController.php, processReset(), line 438 (pre-patch)
} elseif ($employee->getValidResetPasswordToken() !== $reset_token_value) {
// To update password, we must have the temporary reset token that matches.
$this->errors[] = $this->trans(
'Your password reset request expired. Please start again.',
[], 'Admin.Login.Notification'
);
}
processReset() reads the supplied token, calls getValidResetPasswordToken() on the loaded Employee, compares the two with !==, and refuses to change the password if they disagree. The author of processReset() knew the token had to be checked, because the password-change action would otherwise let anyone reset any administrator's password. They wrote the check.
The author of initContent() is rendering the form that supplies that very token to processReset(). They have the same Employee object, the same reset_token value out of the request, and the same getValidResetPasswordToken() method available on the model. They wrote a different check.
The patch copies the comparison from one method into the other
The diff is 11 lines, all in AdminLoginController.php:
// For reset password feature
- if ($reset_token = Tools::getValue('reset_token')) {
+ $reset_token = Tools::getValue('reset_token');
+ $id_employee = Tools::getValue('id_employee');
+ if ($reset_token !== false && $id_employee !== false) {
$this->context->smarty->assign('reset_token', $reset_token);
- }
- if ($id_employee = Tools::getValue('id_employee')) {
$this->context->smarty->assign('id_employee', $id_employee);
+
$employee = new Employee($id_employee);
- if (Validate::isLoadedObject($employee)) {
+ $valid_reset_token = $employee->getValidResetPasswordToken();
+
+ if ($valid_reset_token !== false && $valid_reset_token === $reset_token) {
$this->context->smarty->assign('reset_email', $employee->email);
}
}
The body of the conditional is now gated by $valid_reset_token === $reset_token instead of Validate::isLoadedObject($employee). No method was added to Employee. No call was reorganised at the front-controller level. The four lines of comparison that already lived in processReset() were copied, with one variable rename, into initContent().
The commit message that ships those four lines, signed by morgan at PrestaShop on 2025-08-28, is three words: "Email enumeration fix."
The exploit is the URL the legitimate link would have been
processForgot(), the handler that generates the legitimate reset email, builds the URL like this:
// controllers/admin/AdminLoginController.php, processForgot(), line 349
'{url}' => $admin_url . '&id_employee=' . (int) $employee->id
. '&reset_token=' . $employee->reset_password_token,
A real reset email contains a URL whose id_employee is the integer primary key of the recipient and whose reset_token is the SHA-1 stamped on their row sixty seconds earlier. The attacker's request is the same URL with the second value replaced by a value the attacker chose:
curl -s "https://shop.example/admin123/index.php?controller=AdminLogin&id_employee=1&reset_token=$(head -c32 /dev/urandom | xxd -p)" \
| grep -Eo 'name="reset_email"[^>]*value="[^"]+"'
# name="reset_email" value="[email protected]"
The PoC, a nuclei template authored by mastercho, iterates id_employee from 1 to 30 across forty common admin-panel paths (admin, backoffice, back-office, administrator, panel, ..., admin123, ps-admin, BackofficeNEW). It registers a hit whenever the response is 200 OK and the body contains <input ... name="reset_email" value="...">. The token in the URL is a random 32-character string the template regenerates per run. The token's value does not matter. Its presence matters only because the pre-patch conditional was the assign-and-test if ($reset_token = Tools::getValue('reset_token')), and Tools::getValue returns the string false when the parameter is missing.
The output of one successful scan against a vulnerable host is a list of administrator email addresses, one per back-office account, indexed by the integer that is their primary key.
Existence is authorization, at the model layer
PrestaShop wrote a model with a reset_password_token column, a reset_password_validity column, and a getValidResetPasswordToken() method that consults both. The model carries the per-call credential. The model's validator is one call away from any handler that loads the object. The bug is not the absence of a check. The bug is a handler that loaded the object, had the credential value in the request, and decided to ask whether the row existed.
This is existence-is-authorization where the per-call credential is already in the request and the validator is already on the loaded object. The n8n exhibit had to switch from checkIfExecutionExists to findExecution because the original lookup did not return a row rich enough to validate against. The ksmbd exhibit had to add a durable_owner struct that did not exist on the file row at all. PrestaShop did not need to add a column, a method, or a lookup. The credential travels in the URL. The validator is on the object. The sibling method on the same file does the comparison.
Validate::isLoadedObject is the question "did the ORM find a row with this primary key?" The handler asked that question and then disclosed an email. The question that would have gated the disclosure is "did the caller send a string that equals the token stamped on this row?" Both questions are one method call away from a loaded Employee object. The pre-patch handler answered the first one and named it the second.
What the 8.2.3 release actually contains
controllers/admin/AdminLoginController.php gained seven lines. classes/Employee.php did not change. The validator was not added; the call to the validator was. The structural reason for the bug is that one method on a controller knew how to use the model's validator and another method on the same controller did not. The 8.2.3 patch closes the GET-side disclosure by copying four lines from the POST-side method.
The 1.7-through-8.2.2 range is the entire 7.x and 8.x line of PrestaShop, and the validator is the one whose method body has been on Employee long enough that the patch shipped without touching it. Maxime Morel reported the disclosure to PrestaShop on 2025-05-17. The fix landed on 2025-08-28. The advisory shipped on 2025-09-04. CVE-2025-51586 was published the same week.
PoC: projectdiscovery/nuclei-templates
The fix did not add a method. The validator was already on the object, and the sibling handler in the same file already called it.