CVE-2024-21515
Description
This affects versions of the package opencart/opencart from 4.0.0.0. A reflected XSS issue was identified in the filename parameter of the admin tool/log route. An attacker could obtain a user's token by tricking the user to click on a maliciously crafted URL. The user is then prompted to login and redirected again upon authentication with the payload automatically executing. If the attacked user has admin privileges, this vulnerability could be used as the start of a chain of exploits like Zip Slip or arbitrary file write vulnerabilities in the admin functionality. Notes: 1) This is only exploitable if the attacker knows the name or path of the admin directory. The name of the directory is "admin" by default but there is a pop-up in the dashboard warning users to rename it. 2) The fix for this vulnerability is incomplete. The redirect is removed so that it is not possible for an attacker to control the redirect post admin login anymore, but it is still possible to exploit this issue in admin if the user is authenticated as an admin already.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
opencart/opencartPackagist | >= 4.0.0.0 | — |
Affected products
1Patches
1c546199e8f10removed a xss vunribility if the attack knows the admin path
2 files changed · +1 −25
upload/admin/controller/common/login.php+1 −22 modified@@ -51,23 +51,6 @@ public function index(): void { $data['forgotten'] = ''; } - if (isset($this->request->get['route']) && $this->request->get['route'] != 'common/login') { - $args = $this->request->get; - - $route = $args['route']; - - unset($args['route']); - unset($args['user_token']); - - $url = ''; - - $url .= http_build_query($args); - - $data['redirect'] = $this->url->link($route, $url); - } else { - $data['redirect'] = ''; - } - $data['header'] = $this->load->controller('common/header'); $data['footer'] = $this->load->controller('common/footer'); @@ -126,11 +109,7 @@ public function login(): void { $this->model_user_user->addLogin($this->user->getId(), $login_data); - if ($this->request->post['redirect'] && str_starts_with(html_entity_decode($this->request->post['redirect'], ENT_QUOTES, 'UTF-8'), HTTP_SERVER)) { - $json['redirect'] = html_entity_decode($this->request->post['redirect'], ENT_QUOTES, 'UTF-8') . '&user_token=' . $this->session->data['user_token']; - } else { - $json['redirect'] = $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true); - } + $json['redirect'] = $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true); } $this->response->addHeader('Content-Type: application/json');
upload/admin/view/template/common/login.twig+0 −3 modified@@ -35,9 +35,6 @@ <div class="text-end"> <button type="submit" class="btn btn-primary"><i class="fa-solid fa-key"></i> {{ button_login }}</button> </div> - {% if redirect %} - <input type="hidden" name="redirect" value="{{ redirect }}"/> - {% endif %} </form> </div> </div>
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
4- github.com/opencart/opencart/commit/c546199e8f100c1f3797a7a9d3cf4db1887399a2nvdPatchWEB
- security.snyk.io/vuln/SNYK-PHP-OPENCARTOPENCART-7266573nvdExploitPatchThird Party AdvisoryWEB
- github.com/advisories/GHSA-qx44-885h-7p56ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2024-21515ghsaADVISORY
News mentions
0No linked articles in our index yet.