As far as I noticed, TinyMCE has its own escaping of metacharacters, and using htmlspecialchars () will only clutter up the output and show <p>, etc. instead of rendering them in a browser. It is easy to disable Javascript and enter malicious code that will be displayed when another user with Javascript enabled visits the content.
So, I need to use the correct server-side validation, but for sure -how can I do it right, given the thousands of XSS methods? Is there an efficient way that works for TinyMCE, for example, "using htmlspecialchars () with TinyMCE?"
So far I have made a whitelist for allowed HTML tags, replaced any javascript: and similar :void in the content to try to protect against inline Javascript such as onClick="javascript:void(alert("XSS"));" but I feel that is not enough.
Any advice on this would be greatly appreciated, but remember that certain content should be correctly displayed in the output, so I use TinyMCE in the first place. I need to protect only from XSS.
In addition, while on the subject; how can I protect myself from CSS XSS, for example style="background-image: url(XSS here);" ?
Melanie
source share