Tutor: In this lecture I'd like to introduce you
to a really cool framework called BeEF.
BeEF is short for the Browser Exploitation Framework.
It allows us to run a number of attacks on hooked browsers
that would allow us to further exploit the target system
to steal passwords or even gain full access
or full control over this system.
So, right here,
I'm at my Kali machine and we can go ahead and start with,
and to do that I'm gonna click on all my applications.
I'm gonna type BeEF,
and I'm gonna click on the first icon in here, beef start.
You can use the beef stop to stop it,
but right now we just want to start the framework.
So we're gonna click on the start.
Now, because this is the first time we're on the framework,
it's asking us to set a password for the default user.
So go ahead and pick any password you want.
And note when you type the password,
you will not see the characters on screen.
This is a security feature, so that the people around you
will not see your password.
So right now I actually typed my password,
but you can't see anything on screen.
I'm just gonna hit Enter,
and then it'll automatically start
the BeEF Framework for me.
And it'll automatically start Firefox
and go to the web interface
that we can use to access BeEF
and control the hooked browsers.
As you can see,
the first thing that it'll ask us,
is a username and a password to login to this web interface.
The default user is BeEF, B-E-E-F,
and the password is the password
that we just set in terminal.
I'm gonna hit Enter to login.
And as you can see, we have the main user interface of BeEF.
The main thing you can see here on the left
is the Online and the Offline Browsers.
In the Online Browsers,
you'll see the browsers that are hooked to BeEF right now
that you can control.
And in the Offline Browsers,
you'll see the browsers that you previously
were able to control.
So browsers that you previously hooked to BeEF.
Now, in order to hook a browser to BeEF
and be able to control it and run commands on it,
you have to get that browser
to execute a specific JavaScript code.
So if we go back to the terminal window here
that started before us and just scroll up,
you'll see that it's given us the JavaScript code
that we need to use to hook browsers to beef.
As soon as this piece of code gets executed
on a web browser,
you will see that web browser here in the Online Browsers,
and you'll be able to execute a lot of really cool commands
that'll allow you to show fake login pages,
It's allow you to show fake updates
and even gain full control over the target system.
Now because BeEF uses JavaScript,
it'll work on any web browser that supports JavaScript
regardless of what device this web browser is running on.
So it'll basically work on all modern browsers.
So it'll work against phones, tablets, smart TVs,
all operating systems used on PCs,
such as Linux, Windows, or SX and so on.
Literally any browser that can run JavaScript
will be able to run this code.
And therefore we'll be able to hook that browser to BeEF
and do all of the cool things that you will learn
in the next lectures.
So right now, it really depends on you and your imagination
on how you're going to get this piece of code
to run on our web browser.
If you're able to become the man in the middle,
you can do DNS spoofing and redirect requests to a page
that contains this whole code.
Or, you can inject this JavaScript in any webpage
that the target loads using the JavaScript
injection methods that we learned
once you become demand in the middle.
You can also exploit an XSS vulnerability
and inject this code in a vulnerable webpage.
And you will learn how to do that
in the website hacking section,
or you can use social engineering
and social engineer a target into loading a webpage
that contains our whole code.
So all you'll need to do is think of a way to get a target,
to load a page that contains the hook JavaScript code.
Now, in this lecture,
I'm gonna show you a very basic hook method
that is really good for us to make sure that our system
is working as expected.
And this very page can also be used with method number one
and method number four.
Because we're gonna have an HTML page
that contains the whole code.
Therefore, you can either DNS spoof targets to this page
or social engineer them to this page
and once they load this page,
the hook code will be executed on their browser
and therefore they will be hooked to BeEF
and we'll be able to run all of the commands
that BeEF allow us to run.
So, let's go back to BeEF.
And like I said,
this is the code that we want our target browsers to load
or execute.
So I'm gonna copy it and I'm gonna go
and open my File Manager.
And I wanna go to my web root.
So you can either press Ctrl + L from your keyboard
or click in here at the path bar
and just press the forward slash.
This will open a path text box,
where you can type the path that you want to go to.
And I wanna go to /var/www/html.
Now, as we learned before,
this is the location where the files
for your web server are stored,
and the index.html is the file that gets loaded
by default when someone loads your IP in their web browser.
So I'm gonna right click the index.html
and I'm gonna choose to open it with a text editor.
And I'm simply gonna remove all of this
and paste the hook code in here.
There's one thing that I wanna modify,
is the IP in here.
I'm gonna replace this IP with the IP of my Kali machine.
As we learned before,
you can get the IP using F config command.
So I'm not gonna do it right now,
you should already know this by now.
So I know my IP is 10.20.14.207.
And that's it, we're ready to go.
So if anybody now loads my IP address,
which is 10.20.14.207,
I will have a web server working on it,
which will load the index.html by default.
And when this file is loaded, it'll load the BeEF hook code
and it'll hook that browser to BeEF,
which will allow me to run a number of really cool commands.
Now, before loading this page,
we need to start our web server.
And as we learned before, we can do this by doing,
service apache2 start.
And now, my Apache web server is running.
And if I go to my windows machine in here
and simply just go to the address of my web server,
which is 10.20.14.207.
Now, as you can see, we'll get a blank page.
That's fine because our page contains nothing but the code,
you could actually have a proper HTML page
and just put the whole code at the end or at the start.
But this will do for testing for now.
And if we go back here and go to the BeEF interface,
if we look at the online browsers,
you'll see we have the IP address of my target,
which is 10.20.14.206.
This is the IP address of the windows machine.
And right now, if I click on it,
you'll see I'll have a number of tabs in here
which will allow us to do various things.
In the home and the details,
you'll see we have information
about the browser of the target.
For example,
you can see that it doesn't have a VLC plugin installed,
it supports web socket.
If you scroll down, you can see the user agent,
which is Mozilla/5.0, it's running on windows NT,
64 bit architecture.
Again, if you keep going down,
you can see the cookies, you can see the host name,
you can see the screen size and a lot of other information
that can be useful when it comes to exploiting a target.
At the Logs tab in here,
you'll see logs of all the events that happened
in the browser.
And if you execute commands,
you'll see logs in here for these commands.
The Commands tub is the one that we're gonna be using
the most in the next lectures.
This will allow you to run various commands on the target.
Like I said, you can run information gathering commands,
you can run commands to inject other JavaScript codes,
you can run commands to steal passwords using fake log-ins,
you can run fake updates and get your target to download
the backdoor and hack their computer.
There are a lot of really cool things that you can do,
and I will walk you through some of the best ones
in the next lectures.
In the proxy tab you can configure
and use a hooked browser as a proxy.
The XSSRays will show you if the hook page
contains any XSS vulnerabilities.
And the Network tab
will give you an overview of the current network.
So right now you can see,
we have the target running windows.
We have his browser, which is hooked to BeEF to us.
And then from here, we'll be able to, like I said,
launch a number of really cool commands
that can be used to do so many things
and further exploit the target system.
Once done with using BeEF,
you can click on Logout to logout
and then go to your all applications,
look for BeEF and click on beef stop
to stop the service from running in the background.
So that's it for this lecture.
I just wanted to give you a quick overview on BeEF.
And in the next lectures,
we'll see how we can use it to steal credentials,
get screenshots, gather information,
and even gain full control over hooked browsers.