GHSA-QPGQ-5G92-J5Q8
Vulnerability from github – Published: 2026-05-05 20:11 – Updated: 2026-05-15 23:48Summary
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:
// app/code/core/Mage/ProductAlert/controllers/AddController.php : stockAction()
$backUrl = $this->getRequest()->getParam(Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED); // raw, no decode
$productId = (int) $this->getRequest()->getParam('product_id');
if (!$backUrl || !$productId) {
$this->_redirect('/');
return;
}
$product = Mage::getModel('catalog/product')->load($productId);
if (!$product->getId()) {
$session->addError($this->__('Not enough parameters.'));
$this->_redirectUrl($backUrl); // ← NO _isUrlInternal() check
return;
}
Secure peer (priceAction()):
if (!$product->getId()) {
if ($this->_isUrlInternal($backUrl)) { // ← validation present
$this->_redirectUrl($backUrl);
} else {
$this->_redirect('/');
}
return;
}
Steps to Reproduce
Prerequisites
- OpenMage LTS ≤ 20.16.0 with Product Alerts enabled (default configuration)
- A valid, logged-in customer session on the target store
Step 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 URL
The uenc parameter is read raw via getParam() with no base64 decoding in this code path. A plain URL is sufficient and produces the redirect:
GET /productalert/add/stock/?product_id=99999&uenc=https://evil.com/steal-credentials HTTP/1.1
Host: <store-hostname>
Cookie: om_frontend=<authenticated-session>
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)
Impact
Technical Impact
An 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. |
Propagation
A single malicious link can be embedded in:
- Customer emails (“Click here for stock notification preferences”)
- Forum posts, social media, or product reviews on the store
- SEO-poisoned search results that rank the store’s domain
Recommended Fix
Apply the same _isUrlInternal() guard used in priceAction() to the stockAction() missing-product
This 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.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 20.17.0"
},
"package": {
"ecosystem": "Packagist",
"name": "openmage/magento-lts"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "20.18.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-42207"
],
"database_specific": {
"cwe_ids": [
"CWE-601"
],
"github_reviewed": true,
"github_reviewed_at": "2026-05-05T20:11:21Z",
"nvd_published_at": "2026-05-15T17:16:46Z",
"severity": "MODERATE"
},
"details": "## Summary\n`Mage_ProductAlert_AddController::stockAction()` reads the uenc query parameter and passes it directly to `$this-\u003e_redirectUrl($backUrl)` without calling `$this-\u003e_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`.\n\n## Vulnerable path:\n\n```php\n// app/code/core/Mage/ProductAlert/controllers/AddController.php : stockAction()\n\n$backUrl = $this-\u003egetRequest()-\u003egetParam(Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED); // raw, no decode\n$productId = (int) $this-\u003egetRequest()-\u003egetParam(\u0027product_id\u0027);\n\nif (!$backUrl || !$productId) {\n $this-\u003e_redirect(\u0027/\u0027);\n return;\n}\n\n$product = Mage::getModel(\u0027catalog/product\u0027)-\u003eload($productId);\n\nif (!$product-\u003egetId()) {\n $session-\u003eaddError($this-\u003e__(\u0027Not enough parameters.\u0027));\n $this-\u003e_redirectUrl($backUrl); // \u2190 NO _isUrlInternal() check\n return;\n}\n```\n\n### Secure peer (priceAction()):\n\n```php\nif (!$product-\u003egetId()) {\n if ($this-\u003e_isUrlInternal($backUrl)) { // \u2190 validation present\n $this-\u003e_redirectUrl($backUrl);\n } else {\n $this-\u003e_redirect(\u0027/\u0027);\n }\n return;\n}\n```\n\n## Steps to Reproduce\n\n### Prerequisites\n- OpenMage LTS \u2264 20.16.0 with Product Alerts enabled (default configuration)\n- A valid, logged-in customer session on the target store\n\n#### Step 1 \u2013 Authenticate as a Customer (Attacker controls the crafted link; victim must be logged in)\n\nThe `preDispatch()` hook calls `Mage::getSingleton(\u0027customer/session\u0027)-\u003eauthenticate($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.\n\n\u003cimg width=\"1548\" height=\"638\" alt=\"image\" src=\"https://github.com/user-attachments/assets/64c18279-ec0a-4110-b8f4-d952870e348c\" /\u003e\n\n#### Step 2 \u2013 Craft the Malicious URL\nThe `uenc` parameter is read raw via `getParam()` with no base64 decoding in this code path. A plain URL is sufficient and produces the redirect:\n\n```\nGET /productalert/add/stock/?product_id=99999\u0026uenc=https://evil.com/steal-credentials HTTP/1.1\nHost: \u003cstore-hostname\u003e\nCookie: om_frontend=\u003cauthenticated-session\u003e\n```\n\nKey conditions:\n- `product_id` must reference a non-existent product (triggers the vulnerable branch; any large ID works)\n- `uenc` is the raw destination URL (no base64 encoding required)\n\n\u003cimg width=\"1554\" height=\"852\" alt=\"image\" src=\"https://github.com/user-attachments/assets/d8530247-2d2f-4747-bf16-ece71a507b50\" /\u003e\n\n\n## Impact\n\n### Technical Impact\nAn 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\u2019s 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\u2019s origin before the browser shows anything to the user.\n\n### Business-Level Attack Vectors\n| Scenario | Description |\n|------------------------|-----------------------------------------------------------------------------|\n| Credential phishing | Craft a link claiming to show a stock notification. Customer lands on attacker\u2019s login clone and reuses their password. |\n| OAuth / SSO token theft| If the store uses a social login or \u201cLogin with Google\u201d flow, the attacker can inject their redirect_uri via the open redirect, stealing OAuth tokens. |\n| Affiliate fraud | Redirect customers from the legitimate store to a competing retailer after they click a \u201cnotify me\u201d link. |\n| Malware distribution | Redirect to drive-by-download pages with the store\u2019s reputation acting as social proof. |\n\n### Propagation\nA single malicious link can be embedded in:\n\n- Customer emails (\u201cClick here for stock notification preferences\u201d)\n- Forum posts, social media, or product reviews on the store\n- SEO-poisoned search results that rank the store\u2019s domain\n\n## Recommended Fix\nApply the same `_isUrlInternal()` guard used in `priceAction()` to the `stockAction()` missing-product\n\n\nThis is an AI-generated report.\n\nAn attempt was made to test the same PoC against the online demo https://demo.openmage.org/ but it couldn\u0027t be reproduced. It was only reproduced against the local setup env against the latest version.",
"id": "GHSA-qpgq-5g92-j5q8",
"modified": "2026-05-15T23:48:48Z",
"published": "2026-05-05T20:11:21Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/OpenMage/magento-lts/security/advisories/GHSA-qpgq-5g92-j5q8"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-42207"
},
{
"type": "PACKAGE",
"url": "https://github.com/OpenMage/magento-lts"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "Magento LTS Vulnerable to Open Redirect via Unvalidated `uenc` Parameter in `stockAction()`"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.