Introduction
Today's post is about
phishing. I will illustrate a simple example using the Google login screen. Using an apache2 webserver, I host a phishing page that captures the username and password of an unsuspecting user and saves them to a file. In the process, I learned about php, html POST requests and how to set up a webserver.
Source Code
After setting up my webserver on my Unix box, I downloaded the source code of the gmail login page:
|
| The familiar Google login page.
|
|
| The relevant sourcode for the form submission.
|
By looking at the source code, we can see that the login page uses a form with POST request to send the login data to
https://accounts.google.com/ServiceLoginAuth. My goal, then, is to hijack that request, sending the data to a page of my own making before redirecting the user to the real login page, none the wiser.
Modifying the Page Source
The first step is to modify the page source and host it on my webserver. All I'm going to do is change the destination of the POST method to a page of my own creation (see next section). I'll call that page "get_info.php", so that's what I'll modify in the Google sourcecode.
PHP
I wrote a small PHP script,
"get_info.php" that captures the login data and appends it to a file on the server.
It then redirects the user to Google's actual login page. To the casual user, it would appear as though she had merely entered her password incorrectly. If I had more time, I would figure out how to have the "incorrect password" notification appear, so there would be no clue to the user that something is amiss.
Data Capture
The final result is a csv file with username / password pairs.
Final Thoughts
I started this project, I had never encountered PHP before, so part of the
challenge was figuring out how the form worked. Future exploration would
probably skip the "get_info.php" step altogether and simply have malicious
php embedded in the original page. I would also make the redirection more surreptitious.