31 Aug 2023

Unveiling the Dangers of
Injection Vulnerabilities
Part (2)

Phishing mails based on XSS

Hey there, pals! :D Welcome back to my blog. In today's post, I'll be diving into a high-impact XSS technique that'll really open your eyes to just how far the rabbit hole goes with XSS. Let's jump right in! ๐Ÿš€

Sure thing, folks! ( อ โ›โ€ฏอœส– อกโ›) Just to clarify, we're not here to exchange XSS payloads. We've got something even more intriguing to explore together! Let's keep the excitement going! ๐Ÿ•ต๏ธโ€โ™€๏ธ๐Ÿ”


Ever stopped to think that phishing emails aren't just about fake web apps? What if I told you that you could fall for a phishing attack through a legitimate website that's vulnerable to XSS? Intriguing, right? Let's delve into this fascinating twist! ๐ŸŽฃ๐ŸŒ
But hold on, isn't it all about triggering an alert(1) pop-up? Well, let me introduce you to something called FAKE LOGIN FORM INJECTION. This takes things to a whole new level! ๐Ÿ•ถ๏ธ๐Ÿ”

FORM INJECTION:
Absolutely wild, isn't it? ( อ โ‰–โ€ฏแด— อกโ‰–) So, once we've got a working XSS payload in our arsenal, the next step is to launch the phishing attack. Imagine we inject a snippet of HTML code into the vulnerable page. This sneaky code then presents a seemingly harmless login form to the user. But here's the kicker: all the login details they enter get sent to a server that we're carefully listening on. Talk about a crafty way to grab those credentials, huh? It's a real eye-opener!๐Ÿ‘๏ธ ๐Ÿ‘๏ธ

Well, well, well! Hold onto your hats because this part is fascinating. Believe it or not, all these modifications can be accomplished using just a simple <script>XSS PAYLOAD</script>.
It may jump in your minds that we are talking about stored XSS but, no! Actually its reflected! What does that mean? It means the web page gets infected solely through URL modification. There's no storing involved in this game! ๐ŸŽฉ๐Ÿ”ฎ


Now, let's shine a spotlight on our magical key player here: the JavaScript function document.write() . You might have heard of it before, but have you ever thought about harnessing its power from an XSS perspective to pull off such an attack? Well, buckle up, because we're diving right into it! (๐Ÿ‘ อ โ›โ€ฏอœส– อกโ›)๐Ÿ‘
Alright, let's break down a typical HTML login form example:


This snippet presents a basic login form with fields for a username, password, and a submit button. Users enter their credentials and click "Login" to proceed. Now, let's see how we can use the document.write() function to inject our crafty XSS attack!
Absolutely, let's weave this web of deception. Imagine sending a URL that injects the following form into the web app, concealing its original content and displaying only the login page:
This compact piece of code creates the illusion of a login page overlaying the actual web app content. Users might believe they need to log in to access the site's services. However, it's all a crafty faรงade, capturing their login details before they're redirected to the legitimate web app.
It's like magic, isn't it?( อ โ‰–โ€ฏอœส– อกโ‰–)

You're catching on quickly! ๐Ÿ˜„ Just like you'd normally inject an XSS payload, you can do the same with this crafty login form injection. Instead of the usual <script>alert(1)</script>.

Hold the phone, you're absolutely right! To make this ruse even more convincing, we've got to clean up the page content. You're playing the role of a true puppet master here! ( อ โ—กโ€ฏอœส– อกโ—ก)

Time to CLEAN UP!
You're wrapping things up nicely! Adding an HTML comment <!-- to filter out any remnants of the original HTML code after injecting the login form is a smart move. It ensures that there's no trace left behind to arouse suspicion.
You're bringing all the pieces together to create a seamless trick! Implementing a basic PHP script to listen to the provided server IP is the cherry on top. This script will log the credentials from the HTTP request and then gracefully redirect the victim back to the original page without any trace of the injection. Here's how you might set up that PHP script:


With this PHP script, you're capturing the credentials in a log file and then smoothly redirecting the victim back to the legitimate page. The illusion of successful login is maintained, while you gather the information you need. Your meticulous planning is turning this into a truly captivating tale! ( อ โ‰–โ€ฏอœส– อกโ‰–)๐Ÿ‘Œ
You've got it all figured out! Setting up that index.php script in a directory, firing up the PHP server with php -S 0.0.0.0:80 , and then reaping the rewards by reading the creds.txt file โ€“ you've just brought your crafted magic trick to life. That captured username and password combo is like the final piece of a puzzle.
Your attention to detail and strategic thinking has truly transformed this XSS technique into something impressive.



Remember, with great power comes great responsibility, so make sure to use your skills ethically and responsibly! ๐ŸŽฉ๐Ÿ”๐Ÿ”

HOLD ON A SECOND!

cat creds.txt
Username: Jake_Richards | Password: J@kKkeEe2023!
(ใฃ อ ยฐโ€ฏอœส– อกยฐ)ใฃ