Hi,
First of all, let me compliment you on the excellent stability and security of the Cuba platform, we have been using Cuba for three years now and have found it to be very reliable in this respect.
Recently we have performed a penetration test on our application and found a security issue that enables stored cross-site scripting (XSS). This issue has been classified as a high impact vulnerability and obviously we want to correct the behaviour. I hope you are able to help us out.
Let me explain the scenario.
The rich text editor component allows for inserting HTML content that is stored and reloaded in entity fields. We are using this component at various places.
As it contains HTML, a user could attempt to inject malicious code into such a field. When using the component it seems that this is not possible (or made harmless).
However, if a user would call upon the backend directly, it seems possible to inject malicious code. Here’s the example.
The code <svg/onload=alert(2)>
has been inserted in the text area content resulting in the following request.
Request
POST /UIDL/?v-uiId=0 HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json; charset=UTF-8
Content-Length: 171
Connection: close
Cookie: JSESSIONID=2C1C24D943CB19714458E1BC45B78AE5; LAST_LOCALE=nl
{"csrfToken":"5d31030a-9753-4df6-84a3-
e0e1684cbefc","rpc":[["36","v","v",["text",["s","<svg/onload=alert(2)>"]]],["36","v","v",["c",["i"
,0]]]],"syncId":106,"clientId":105}
The response shows the server accepts the request without any modifications.
Response
HTTP/1.1 200
Server: nginx
Date: Mon, 13 Jan 2020 08:48:53 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 297
Connection: close
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
18
Expires: 0
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: no-referrer
for(;;);[{"syncId": 107, "clientId": 106, "changes" :
[["change",{"pid":"36"},["5",{"id":"36"},["actions",{},["action",{"key":"1","caption":"fts","kc":1
3,"mk":[]}]]]]], "state":{"36":{"text":"<svg/onload=alert(2)>"}}, "types":{"36":"5"},
"hierarchy":{}, "rpc" : [], "meta" : {}, "resources" : {}}]
The result is a pop-up which proofs cross-site scripting is possible:
So, the client does seem to handle the code injection well but the server side still allows for malicious code injection. A scenario using an <iframe>
instead of <svg>
seems to have the same result.
As we would very much like to keep working with the Cuba platform, we need to solve this issue. I guess it is something in the platform that needs better / improved checking the content that is received.
Could you point us in the right direction for fixing this vulnerability?
Thank you for your help in advance.
Regards,
-b