Hooking the browser with BeEF
In order to use BeEF, we need to start its services and be able to access its console. Additionally, in order to exploit a victim's browser, we need to find a way to hook their browser. There are a number of ways of exploiting a victim's browser; in this chapter, we will cover two ways:
- The first shows how we can deploy a script on a website that we are able to directly edit.
- In the second example, we will exploit a website vulnerable to XSS attacks. In this way, we can deploy our script on a site we have no administrative access to.
Getting ready
BeEF comes preinstalled on Kali Linux. In the examples provided, an instance of Metasploitable2 is used to demonstrate hooking a browser via XSS. For more information on how to set up systems in a local lab environment, refer to the Installing Metasploitable2 and Installing Windows Server recipes in Chapter 1, Getting Started. Additionally, this section will require a script to be written to the filesystem using a text...