Cybersecurity Lab8
Cybersecurity Lab8
Cybersecurity Lab8
Lab Assignment 8
Phishing Attacks
Mamindla Sathvika
202151084
Objective
To simulate an attachment-based phishing attack using Google App Scripts, which will display a
message when a shared Google Document is accessed.
Steps:
This code will display an alert with a message whenever someone opens the Google Document.
Explanation
This simulates an attachment-based phishing attack by using Google App Scripts to execute a
pop-up message. The attacker could use such tactics to coerce users into performing an action,
such as making a payment.
Task 2: Demonstration of Credential Harvesting Attack
Objective:
To simulate a credential harvesting phishing attack by creating a fake HTML email resembling a
legitimate service and gathering credentials through an API endpoint.
Prerequisites:
Python, Flask, PyMongo, dnspython, ngrok, MongoDB
● HTML files for the phishing email and fake login pages
● Flask for API creation and request handling
● MongoDB Atlas for cloud-based credential storage
● Ngrok for port tunneling
Step 1: Create a Replicated Google Email Page
● Function: This HTML page alerts the user to a suspicious sign-in and asks them to
review their account activity by clicking the “Review your Activity” button.
● Purpose: To create urgency for the user to interact with the button, leading to the
phishing login page.
This step involves two pages that guide the user through a simulated Google login process.
Setup:
● Created a Flask application to serve as the API endpoint and manage requests between
the HTML pages.
● Integrated MongoDB Atlas to store credentials securely on a cloud server.
● The Flask app captures email and password data from the fake login pages and routes it
to MongoDB Atlas.
● Serves as a bridge between the frontend (HTML pages) and the database.
● Configures credential storage in MongoDB, appending new entries as they come in.
app = Flask(__name__)
uri =
"mongodb+srv://sathvika1609:[email protected]/?retryWrites=true&w
=majority&appName=Sathvika"
try:
client.admin.command('ping')
except Exception as e:
@app.route('/')
def index():
learner = {
"first_name": "Sathvika",
"email": "[email protected]"
def login():
if request.method == 'POST':
email = request.form['email']
return render_template('login.html')
def password():
message = ""
if request.method == 'POST':
password = request.form['password']
try:
except Exception as e:
if __name__ == '__main__':
app.run(debug=True)
Below is the output after running main.py file:
● Ngrok was used to expose the local server to the internet, providing an accessible link for
the API endpoint. This URL was embedded within the email and button links.
● Testing: The setup was tested on both laptop and mobile device to ensure the link
functioned correctly.
After clicking the link given in the terminal after running ngrok command: the below was the
page opened.
After clicking the Visit Site on Laptop the below page was opened.
When we click “Review Your Activity” The below page will open from which we can get the
details of the user
● MongoDB Atlas: Stores harvested data with each endpoint hit from the email and
password pages.
● Verification: Inspected the MongoDB database to verify that credentials were logged
with each interaction.
Backend Process:
Ngrok terminal
We can see that 2nd credentials are also stored in the database