javascript - Exploiting jQuery HTML decoding using textarea -


following on my last question...

this code can exploited if attacker has access encodedtext:

return $('<div/>').html(encodedtext).text(); 

e.g. $("<div/>").html('<img src="x" onerror="alert(\'hi\');" />').text() displays alert.

this answer recommends using textarea instead avoid xss vulnerability:

return $('<textarea/>').html(encodedtext).text(); 

this able handle previous exploit safely.

however, this answer indicates there still xss vulnerabilities when using textarea:

i suggest using safer, more optimized function

don't use jquery.html().text() decode html entities it's unsafe because user input should never have access dom

my question is: there way in browser exploit $('<textarea/>').html(encodedtext); run xss assuming attacker has access encodedtext?

i wouldn't risk honest, lot safer if handled needed encrypted or unencrypted server-side.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -