We are looking to alert a user if code injection has occurred while the page is loading. We are having an issue where JollyWallet injects code and causes a SCRIPT block to remain open. Of course our code is in that SCRIPT block.
Here is what we have in the original
sTrailer = "</body></html>" //Used to close popup print view window
Here is what gets injected:
sTrailer = "<script type="text/javascript">(function () {if (top.location == self.location && top.location.href.split('#')[0] == 'https://www.xxxxxxx.net/xxx/xxx/<filename>.asp?account=###############') {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://api.jollywallet.com/affiliate/client?dist=213&sub=bsg-rt-revenyou&name=BrowserSafeguard';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);}})();</script></body></html>"
Optimally, we would like to alert the user as to the presence of this PUP when they log into our site. Optionally, we would like to stop the injection on the affected pages.
Does anyone know of a test that could be run at the end of the page load that would identify the code injection?