You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browsers support both lowercase and uppercase x in hexadecimal form of HTML character entity (tested on Chromium && FF).
But marked unescape only lowercase:
// https://github.com/chjj/marked/blob/master/lib/marked.js#L1096-L1108functionunescape(html){// explicitly match decimal, hex, and named HTML entities returnhtml.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(_,n){n=n.toLowerCase();if(n==='colon')return':';if(n.charAt(0)==='#'){returnn.charAt(1)==='x'
? String.fromCharCode(parseInt(n.substring(2),16))
: String.fromCharCode(+n.substring(1));}return'';});}
This allow attacker to create link with javascript code.
For example, this code:
unfortunately the maintainer is not longer around to push a change to npm. I will push a change to the master branch but unfortunately that may be as far as this change goes.
Activity
matt- commentedon Aug 29, 2017
You are right. this should should be a case-insensitive match:
unfortunately the maintainer is not longer around to push a change to npm. I will push a change to the master branch but unfortunately that may be as far as this change goes.
CSEMike commentedon Oct 25, 2017
Hi Matt -- did this issue ever result in a pull request? Thanks!
joshbruce commentedon Dec 1, 2017
See #937
matt- commentedon Dec 4, 2017
Just tested this and it is still an issue. Why was this closed? what tests were added?
joshbruce commentedon Dec 5, 2017
See #926
sanatize uppercase hexidecimal