VYPR
Medium severity4.2NVD Advisory· Published Jun 22, 2024· Updated Apr 29, 2026

CVE-2024-21516

CVE-2024-21516

Description

This affects versions of the package opencart/opencart from 4.0.0.0 and before 4.1.0.0. A reflected XSS issue was identified in the directory parameter of admin common/filemanager.list 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.

PackageAffected versionsPatched versions
opencart/opencartPackagist
>= 4.0.0.0

Affected products

1

Patches

2
c546199e8f10

removed a xss vunribility if the attack knows the admin path

https://github.com/opencart/opencartDaniel KerrMay 21, 2024via ghsa
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

News mentions

0

No linked articles in our index yet.