GHSA-qpgq-5g92-j5q8: Magento LTS Vulnerable to Open Redirect via Unvalidated `uenc` Parameter in `stockAction()`
Summary`Mage_ProductAlert_AddController::stockAction()` reads the uenc query parameter and passes it directly to `$this->_redirectUrl($backUrl)` without calling `$this->_isUrlInternal()` When the supplied `product_id` does not match any catalog product, the server issues an unvalidated HTTP 302 redirect to whatever URL was provided as `uenc`.Vulnerable path:Secure peer (priceAction()):Steps to ReproducePrerequisitesOpenMage LTS ≤ 20.16.0 with Product Alerts enabled (default configuration)A valid, logged-in customer session on the target storeStep 1 – Authenticate as a Customer (Attacker controls the crafted link; victim must be logged in)The `preDispatch()` hook calls `Mage::getSingleton('customer/session')->authenticate($this)`. If the request comes from an unauthenticated user, they are redirected to the login page first. The open redirect only fires after the customer is authenticated. This is the realistic attack scenario: the attacker sends a crafted link to a customer who is already logged in.Step 2 – Craft the Malicious URLThe `uenc` parameter is read raw via `getParam()` with no base64 decoding in this code path. A plain URL is sufficient and produces the redirect:Key conditions:`product_id` must reference a non-existent product (triggers the vulnerable branch; any large ID works)`uenc` is the raw destination URL (no base64 encoding required)ImpactTechnical ImpactAn attacker who controls the `uenc` parameter value can redirect any logged-in shopper to an arbitrary external URL. Because the redirect originates from the legitimate store domain, the victim’s browser shows the trusted store URL in the address bar momentarily before being sent to the attacker site. The HTTP 302 response exits the store’s origin before the browser shows anything to the user.Business-Level Attack Vectors| Scenario                | Description                                                                 |
|------------------------|-----------------------------------------------------------------------------|
| Credential phishing    | Craft a link claiming to show a stock notification. Customer lands on attacker’s login clone and reuses their password. |
| OAuth / SSO token theft| If the store uses a social login or “Login with Google” flow, the attacker can inject their redirect_uri via the open redirect, stealing OAuth tokens. |
| Affiliate fraud        | Redirect customers from the legitimate store to a competing retailer after they click a “notify me” link. |
| Malware distribution   | Redirect to drive-by-download pages with the store’s reputation acting as social proof. |PropagationA single malicious link can be embedded in:Customer emails (“Click here for stock notification preferences”)Forum posts, social media, or product reviews on the storeSEO-poisoned search results that rank the store’s domainRecommended FixApply the same `_isUrlInternal()` guard used in `priceAction()` to the `stockAction()` missing-productThis is an AI-generated report.An attempt was made to test the same PoC against the online demo https://demo.openmage.org/ but it couldn't be reproduced. It was only reproduced against the local setup env against the latest version.
CVSS v3.1: 6.1