Well if ever you needed a wakeup call for security problems this is it people, the magical software it a MiTM (Man int he Middle) attack software that relies on social engineering and phishing, you can then target certain websites and extract the session cookies from a valid victim and the login as that user without the user being present, all you need for this to work is to “lure” the user into clicking a specially crafted web link - from here all seems normal to the user - but as of many things looks are not with what they appear to be 😉
Warning: Author accepts no responsibility for abusing educational/learning software and/or using this guide outside of a learning setting outside of a lab/training setting, actively using this attack, may have legal implications and security implications in your company.
This bypasses the requirement for a password and it also bypasses the requirement for MFA as you end up injecting cookies into the browser which are "valid" for the attacker and these cookies are the actual "victims" session cookies 🍪
If you like a visualisation of this then you can view the below infographic, however in this infographic you see Google as the real website, for this guide we will use Office 365.
So first thing you need is a CentOS Stream v9 Linux machine, well you can use anything but I have for this example used CentOS Linux, this is also hosted in Digital Ocean as you get $200 free credit for 60 days - sweet!
Then for this I will access the console from the website, you need the options dots then access console as below:
This will then tell you that there are no Reserved IPs, and give you the droplet in the list, so select the "Assign Reserved IP"
This will then start the asasignment process as you can see below:
After a short wait you can now see that the IP is now a static IP:
root ssh:notty 222.92.89.xx Sat Nov 4
The full list was crazy long for a 10 minute delay, for people interested this is full list, all those naughty people trying to attack my server, this is why you need the firewall rules in place for sure.
🔗 View connection attempts while firewall was disabled
This for me will require the use of 1Password as a SSH key option, however I will cover the other method as well, but first 1Password method
Then I need to Create a SSH key from the 1Password menu:
Then you will see the key which will be saved in 1Password and in Digital Ocean as below:
Build server as key : PuttyGen 🔐
Warning: SSH key shown below is not an active key used on my servers.
When you run the application ensure you choose EdDSA with 255bits for security and then click generate:
Then give the firewall a relevant name as below:
Then jsut below that you will see "Inbound Rules" and it will look like this, which is wrong because that means the whole internet can access you droplet on SSH which is TCP:22 - this will need to be updated.
I woudl recommend to stop everyone being able to SSH to your Droplet that you change it to the name of your droplet which will stop "everyone" from seeing a server on TCP:22 and trying to exploit it.
Then once done choose the Droplets tab as below:
Then choose Add Droplet and then enter the name of your Droplet as below and click Add, simple all done:
This is the same as the "none Cloudflare" guide expect need to complete this as well and setup Spectrum, lets get cracking!
173.245.48.0/20 103.21.244.0/22 103.22.200.0/22 103.31.4.0/22 141.101.64.0/18 108.162.192.0/18 190.93.240.0/20 188.114.96.0/20 197.234.240.0/22 198.41.128.0/17 162.158.0.0/15 104.16.0.0/13 104.24.0.0/14 172.64.0.0/13 131.0.72.0/22
Setup Spectrum in Cloudflare
Then you require SSH and then continue as below:
sudo dnf update
This will end with something like this where you will get an summary of everything to be updated, here we can see 10 new pckges and upgrades to 163 packages - you need to say "Y"
Once you give the approval off it will go downloading all the packages as you can see here:
Then the next step is to update them, you can see here I have 336 installs and updates, leave this for a moment as it updates:
Once you get to update 336 this scriptlet update may take some time, wait for this to finish without errors before you move on:
Then when it completes, my droplet took 3 minutes, you will see a list of updates and what has been installed which should say "Complete!"
Install Prerequisites
sudo dnf install git go-toolset
This will install the dependencies requires for Evilginx
This will then end in the summary of what will be installed where you need to approve that with a "y" again, the same as when they brought Skynet online and ruined the world"
This should then end up with a summary of what has been installed as you can see below, which should end in a "Complete!" as below:
Evilginx - Git Clone to get you started
git clone https://github.com/kgretzky/evilginx2.git
Then you need to move into the directory created, so start with an "ls" and notice you have a directory called "evilginx2" s you will need to "cd evilginx2/" to get the directory and then do another "ls" to take a look at the contents as below:
make
Once the build is complete you will get a command prompt return feed to tell you all is done:
If you then perform an "ls" you will notice you have a build directory now, and if you cd build you will notice you now have the executable all ready for execution as below:
Evilginx - Power up the magic
./evilginx
This should now show you the interface as below, which is all good news....however we need to more before we can use it.....
The error we get is shown below:
you need to provide the path to directory where your phishlets are stored: ./evilginx -p <phishlets_path>
nano example.yaml
So from the current directory in the phishlets directory lets create a m365.yaml file with this command:
sudo nano m365.yaml
Then from the nano editor will need to copy the m365.yaml contents into the nano editor like this:
Then press Cttrl + x, when you do you need to say "y" to save the file:
Right, now move upa directory and then you need the command:
build/evilginx -p phishlets/
These are the phishlets loaded, but as you can see there are disabled:
If you noticed in the start-up data we have some warning that the domain is not set and neither is the IP address, so we will have more to configure.
Evilginx Domain Configuration
config domain <domain>
That should look like this:
config ipv4 <ip address>
That should look like this:
phishlets hostname m365 <domain>
phishlets enable m365
This will then generate the SSL certificates and setup your Phishlet which is confirmed below:
Check Phishlets is enabled
Now you need to ensure your Phishlets are enabled, to complete this type into the shell "quit" then run up Evilginx again using this command and this time you will be presented with status bxo of it being enabled:
Just like this:
You should now see now errors when you start Evilginx, if you get any [War] errors these will need to be corrected before you continue with this guide:
This means my lure for this example is : https://login.grizzlybear.me/<unique_id>
lures
Excellent, now we can move right along to the email that the user will need to click and then enter their credentials and complete the MFA for the session token.
Then from the code this will send them to my lure link, the text give the users some action, but they all do the same thing:
Obviously you will need to craft one for your own organisation and requirements, but the goal is to get the user or victim to click on the link.
Then after the login you will have captures the session cookies, to see this in action you can then type in to the shell:
You will then need to request data for all sites as below:
This confirms you are currently not signed in as anyone
Then we need to find the option to import valid cookie data into your browser as you can see below, this is where you put your session data from Evilginx then click in the import button:
Now lets try that test again to the same websites as before, so first is https://portal.azure.com: