How to detect HTTP request by analysing JavaScript & HTML? -


i'm wondering if can analysis on javascript code detect whether web page contains these js send http request other domain.

for example, 1 put static web page files in web server(domain a), , don’t want file send http request other site(domain b, example).

there’re ways can this:

  1. using img tag: <img src=“http://domain.b.com/statics”>

  2. using script tag.

  3. using form tag.

  4. using iframe tag.

what’s more, can use js generate http request, example:

var f = document.createelement('form'); f.action = "http://domain.b.com/statics"; ... 

javascript obfuscated, javascript above compressed as:

eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,string)){while(c--){d[c]=k[c]||c}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new regexp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('4 0=3.2(\'1\');0.5="9://8.7.6/10";',10,11,'f|form|createelement|document|var|action|com|b|domain|http|statics'.split('|'),0,{})) 

it's going tricky prevent entirely - there new tricks malicious 3rd-party content employ (that haven't thought of or didn't exist @ time of writing).

testing content in sandbox (e.g. phantomjs) , seeing if makes such requests possibility, if malicious code aware doing might try , work around it.

you consider taking approach used in wikis/forums html markup isn't allowed custom markup (offering limited subset of html functionality) used generate html client.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -