I'm using a rich text editor - CKEditor to allow users to input formatted text that renders HTML/CSS.
To prevent XSS attacks by untrusted users, I'm using the Jsoup Java library which filters/whiltelists necessary tags and/or attributes of the user input something like, for example, an anchor tag like,
<a href='http://example.com/' onclick='executeMaliciousTask();'>Click Here</a>
is turned into
<a href="http://example.com/" rel="nofollow">Click Here</a>
The link generated by Jsoup seems to be safe against XSS attacks.
I need to allow users to input images through the editor. For this to be so, I'm using using the following method of Jsoup.
org.jsoup.Jsoup.clean(editorContents, org.jsoup.safety.Whitelist.basicWithImages();
May allowing users to post images in this way be vulnerable to XSS attacks in any way?