javascript - Is this Cross-Site Scripting: DOM in dhtmlHistory.js -


i'm newbie js. in 1 of project i'm working depend on dhtmlhistory.js. understand js library use track history , bookmarking related functionalities in ie. , library seems dead too. when fortify security scan there exist vulnerabilities. e.g.

var initialhash = this.getcurrentlocation(); if (this.isinternetexplorer()) {          document.write("<iframe style='border: 0px; width: 1px; "                                + "height: 1px; position: absolute; bottom: 0px; "                                + "right: 0px; visibility: visible;' "                                + "name='dhtmlhistoryframe' id='dhtmlhistoryframe' "                                + "src='blank.html?" + initialhash + "'>"                                + "</iframe>");          // wait 400 milliseconds between history          // updates on ie, versus 200 on firefox          this.wait_time = 400;       } 

here initialhash value pass src not validated one. actual risk?

is there way me find whether can rid of y. since modern browsers capable of handling stuffs without of 3rd party dependency @ present? there mailing list can inquire question?

updated

getcurrentlocation: function() {       var currentlocation = this.removehash(window.location.hash);        return currentlocation;    },  removehash: function(hashvalue) {       if (hashvalue == null || hashvalue == undefined)          return null;       else if (hashvalue == "")          return "";       else if (hashvalue.length == 1 && hashvalue.charat(0) == "#")          return "";       else if (hashvalue.length > 1 && hashvalue.charat(0) == "#")          return hashvalue.substring(1);       else          return hashvalue;         },           

yes risk.

if attacker redirects user page url hash set this:

https://example.com/page.htm#'/>+<img+src="x"+onerror="alert('xss')"+/> 

the document write functionality write instead of iframe:

<iframe style='border: 0px; width: 1px; height: 1px;  position: absolute; bottom: 0px; right: 0px; visibility: visible;'  name='dhtmlhistoryframe' id='dhtmlhistoryframe'  src='blank.html?'/> <img src="x" onerror="alert('xss')" />'> </iframe> 

boom - have xss.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -