0% found this document useful (0 votes)
17 views

ccs374-WebApplicationSecurity Lab Manual

The document is a practical record for a Web Application Security laboratory course at Dhaanesh Ahmed Institute of Technology, detailing various experiments conducted by students. It includes aims, algorithms, procedures, and results for tasks such as analyzing HTTP vs HTTPS, identifying vulnerabilities using OWASP ZAP, creating a REST API, and testing for SQL Injection and Cross-Site Scripting using Burp Suite. Each experiment concludes with a verification of successful execution.

Uploaded by

zoro67135
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

ccs374-WebApplicationSecurity Lab Manual

The document is a practical record for a Web Application Security laboratory course at Dhaanesh Ahmed Institute of Technology, detailing various experiments conducted by students. It includes aims, algorithms, procedures, and results for tasks such as analyzing HTTP vs HTTPS, identifying vulnerabilities using OWASP ZAP, creating a REST API, and testing for SQL Injection and Cross-Site Scripting using Burp Suite. Each experiment concludes with a verification of successful execution.

Uploaded by

zoro67135
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

DHAANISH AHMED INSTITUTE OF TECHNOLOGY

COIMBATORE

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND DATA


SCIENCE

CCS374 WEB APPLICATION SECURITY


LABORATORY

PRACTICAL RECORD

NAME : …………………………………………………

REG.NO :………………………………………………….

DEPARTMENT : …………………………………………………

SEMESTER :……………………………………………………….
BONAFIDE CERTIFICATE

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND DATA SCIENCE

NAME OF THE STUDENT : …………………………………………….


REGISTER NUMBER : …………………………………………….

DEPARTMENT : …………………………………………….

SEMESTER : …………………………………………….

NAME OF THE LAB : …………………………………………….

PERIOD : …………………………………………….

Certified that this is the Bonafide Record of work done by the above student for
the……………………………………………………………during the year……………..

Faculty in charge Head of the Department

Submitted for the University Practical Examination Held on ………………….

Internal Examiner External Examiner


S.No DATE Name of the Experiment Page Marks Staff Remarks
No. Awarded Signature

Analyze the difference between


1.a) HTTP vs HTTPS
Analyze the various security
mechanisms embedded with
1.b) different protocols.

Identify the vulnerabilities


2. using OWASP ZAP tool
Create simple REST API using
python for following operation
With
3. GET,PUSH,POST,DELETE
Install Burp Suite to do
following vulnerabilities:
Sql injection
4.a)
Install Burp Suite to do
4.a) following vulnerabilities:
cross-site scripting (XSS)

Attack the website using Social


5. Engineering method
Ex.No: 01 Analyze the difference between HTTP vs HTTPS

Date:

Aim:

1. To Analyze the difference between HTTP vs HTTPS

Algorithm:
Step 1: Start
Step 2: Install wireshark
Step 3: Start wireshark
Step 4: Analyze the difference between HTTP vs HTTPS
Step 5: View Server Output
Step 6: Stop

Program:
# Installing wireshark in Ubuntu:
sudo apt install wireshark sudo
usermod -aG wireshark $USER sudo
wireshark

# capture HTTP traffic:


sudo tcpdump -i <interface> -w http_traffic.pcap 'port 80'
# capture HTTP traffic:
sudo tcpdump -i <interface> -w https_traffic.pcap 'port 443'
# open captured files in wireshark:
wireshark -r http_traffic.pcap
wireshark -r https_traffic.pcap
Output:
Result:
Thus, the experiment to analyze the difference between HTTP vs HTTPS
is executed and verified successfully.
Ex.No: 01
protocols
Date:

Aim:
2. To Analyze the various security mechanism embedded with different
protocols

Algorithm:
Step 1: Start
Step 2: Start wireshark
Step 3: Analyze the various security mechanism embedded with different
protocol
Step 4: View Server Output
Step 5: Stop

Program:
#capture HTTPS traffic:
sudo tcpdump -i <interface> -w https_traffic.pcap 'port 443'

#capture IPsec traffic:


sudo tcpdump -i <interface> -w ipsec_traffic.pcap 'ip proto 50 or ip proto
51'
#capture SSH traffic:
sudo tcpdump -i <interface> -w ssh_traffic.pcap 'port 22'

#capture WPA/WPA2 traffic:


sudo tcpdump -i <wireless_interface> -w wpa_traffic.pcap 'type mgt
subtype assoc-req or type mgt subtype assoc-resp'

#capture DNSSEC traffic:


sudo tcpdump -i <interface> -w dnssec_traffic.pcap 'port 53'
#capture OAuth traffic:
sudo tcpdump -i <interface> -w oauth_traffic.pcap 'port 443 and
(tcp[((tcp[12] & 0xf0) >> 2):1] = 0x16 or tcp[((tcp[12] & 0xf0) >> 2):1] =
0x80)'
#after capturing packets , analyze them using wireshark:
wireshark -r <filename.pcap>
Output:

Result:
Thus, the experiment to analyze the various security mechanism
embedded with different protocols is executed and verified successfully.
Ex.No: 02

Date:

Aim:
To Identify the Vulnerabilities Using Owasp Zap Tool

Procedure:
1. Install OWASP ZAP:
1. Download and install OWASP ZAP from the official website.
2. Configure Browser Proxy
1. Set up your browser to use ZAP as a proxy server (Default: localhost,
Port: 8080).
Experiment Steps:
1. Launch OWASP ZAP:
□ Open the OWASP ZAP tool
2. Start ZAP Proxy:
1. In ZAP, click on the 'Quick Start' tab.
2. Start the ZAP Proxy.
3. Set Target Application:
1. Go to the "Sites" tab.
2. Enter the URL of the target application.
3. Right-click on the URL and choose "Include in Context" > "Default
Con- text" to add it for scanning.
4. Spider the Application:
1. Go to the "Spider" tab.
2. Right-click on the target URL and select "Spider" to crawl the application.
3. Let ZAP crawl and map the application structure.
5. Active Scan:
1. Go to the "Attack" tab.
2. Choose "Active Scan."
3. Configure the scan settings (scope, intensity, etc.).
4. Start the active scan on the target application.
6. Review Scan Results:
1. After the scan completes, go to the "Alerts" tab.
2. View the list of vulnerabilities discovered by ZAP.
7. Investigate Vulnerabilities:
1. Click on each vulnerability to get detailed information.
2. Verify and understand the nature and potential impact of each issue.
8. Prioritize and Document:
1. Prioritize vulnerabilities based on severity and potential impact.
2. Document the identified vulnerabilities with descriptions, severity levels,
affected URLs, and possible remediation steps.
9. Report Generation:
1. Go to the "Report" tab.
2. Generate a comprehensive report summarizing the identified vulnerabili-
ties and their details.
3. Choose the appropriate report format (HTML, PDF, etc.).
10. Remediation and Re-scan:
1. Work on fixing or mitigating the identified vulnerabilities.
2. After making changes, perform another scan using ZAP to verify that the
issues have been resolved.
11. Continuous Monitoring:
1. Schedule regular scans using ZAP to continuously monitor the
applica- tion's security posture.
2. Regularly review and update the security measures based on new findings
Result:
Thus, the experiment to identify vulnerabilities using OWASP Zap tool is
executed and verified successfully.
Ex.No: 03

Date: DELETE operations

Aim:
To create a simple REST API using python to do the GET, POST, PUT
and DELETE operations
Algorithm:

Step 1: Start
Step 2: Install Flask
Step 3: Start the Flask App
Step 4: Use Postman to Test Endpoints
Step 5: View Server Output
Step 6: Stop

Program:

from flask import Flask, jsonify, request


app = Flask( name )
# Sample data
data = [
{'id': 1, 'name': 'Item 1'},
{'id': 2, 'name': 'Item 2'},
{'id': 3, 'name': 'Item 3'}
]
# GET request to retrieve all items
@app.route('/items', methods=['GET'])
def get_items():
return jsonify({'items': data})
# GET request to retrieve a specific item by ID
@app.route('/items/<int:item_id>', methods=['GET'])
def get_item(item_id):
item = next((item for item in data if item['id'] == item_id), None)
if item:
return jsonify({'item': item})
else:
return jsonify({'message': 'Item not found'}), 404
# POST request to add a new item
@app.route('/items', methods=['POST'])
def add_item():
new_item = {'id': len(data) + 1, 'name': request.json['name']}
data.append(new_item)
return jsonify({'item': new_item}), 201
# PUT request to update a specific item by ID
@app.route('/items/<int:item_id>', methods=['PUT'])
def update_item(item_id):
item = next((item for item in data if item['id'] == item_id), None)
if item:
item['name'] = request.json['name']
return jsonify({'item': item})
else:
return jsonify({'message': 'Item not found'}), 404
# DELETE request to remove a specific item by ID
@app.route('/items/<int:item_id>', methods=['DELETE'])
def delete_item(item_id):
global data
data = [item for item in data if item['id'] != item_id]
return jsonify({'message': 'Item deleted'}), 200
if name == ' main ':
app.run(debug=True)

Procedure and Output:


Step 1: Install Flask
>>>pip install flask

Step 2: Start the Flask App


Save the code as app.py and execute
>>>python app.py
Copy the url produced http://127.0.0.1:5000

Step 3: Use Postman to Test Endpoints


1. GET Request to Retrieve All Items:
1. Set the request type toGET.
2. Enter the URL: http://127.0.0.1:5000/items
3. Click "Send."
2. GET Request to Retrieve a Specific Item by ID:
1. Set the request type toGET .
2. Enter the URL for a specific item ID, for example:
http://127.0.0.1:5000/items/1
3.
3. POST Request to Add a New Item:
1. Set the request type toPOST .
2. Enter the URL: http://127.0.0.1:5000/items
3. Go to the "Body" tab, select "raw" and choose "JSON (applica-
tion/json)".Enter the request body
4. Click "Send."

4. PUT Request to Update an Existing Item:


1. Set the request type toPUT .
2. Enter the URL for a specific item ID, for example:
http://127.0.0.1:5000/items/1
3. Go to the "Body" tab, select "raw" and choose "JSON (applica-
tion/json)".
4. Enter the updated information
5. Click "Send."

5. DELETE Request to Remove a Specific Item by ID:


1. Set the request type toDELETE .
2. Enter the URL for a specific item ID, for example:
http://127.0.0.1:5000/items/1
3.

Click "Send."
Step 4: View Server Output

Result:
Thus, the experiment to create a simple REST API using python to do the
GET, POST, PUT and DELETE operations is executed and verified successfully.
Ex.No: 04
SQL Injection
Date:

Aim:
1. To Install Burp Suite to do following vulnerabilities:
□ SQL Injection

Procedure:

1. Install Burpsuite and connect the burpsuite proxy in browser proxy settings.
2. Turn on the intercept and search for the website which needs to be captured.

3. Send the intercepted request to the intruder and load the SQL Injection File
from the device which is already installed.
4. Start the attack in the intruder and search for the requests & responses in the
render screen for SQL Injection.

5. After the attack, some response render shows the username and password for
the webpage.
Result:
Thus the above vulnerability is successfully executed and verified.
Ex.No: 04
Cross-Site Scripting (XSS)
Date:

Aim:
2. To Install Burp Suite to do following vulnerabilities:
1. Cross-Site Scripting (XSS)

Procedure:

1. Turn on the intercept and search for the website which needs to be captured.
2. Add the captured request to the Target scope.
3. Go to Target section and search for the captured request in the item field and
send the target item to the repeater.

4. The request in the repeater section will be modified and send to the Decoder.
5. Before sending the response to the browser, Copy the URL below and paste
into a browser that to configured to use Burp as its proxy.
6. Open the browser to see the modified response. An alert message is popup
while opening the website.

Result:
Thus the above vulnerability is successfully executed and verified.
Ex.No: 05

Date:

Aim:

To attach the website using social engineering method

Procedure & Output:


Installation of Social engineering toolkit :
Step 1: Open your Kali Linux Terminal and move to Desktop
>>>cd Desktop

Step 2: As of now you are on a desktop so here you have to create a new
directory named SEToolkit using the following command.
>>>mkdir SEToolkit

Step 3: Now as you are in the Desktop directory however you have created a
SEToolkit directory so move to SEToolkit directory using the following
command
>>>cd SEToolkit

Step 4: Now you are in SEToolkit directory here you have to clone SEToolkit
from GitHub so you can use it.

>>>git clone https://github.com/trustedsec/social-engineer-toolkit


setoolkit/
Step 5: Social Engineering Toolkit has been downloaded in your directory now
you have to move to the internal directory of the social engineering toolkit using
the following command.

>>>cd setoolkit

Step 6: Congratulations you have finally downloaded the social engineering


toolkit in your directory SEToolkit. Now it’s time to install requirements using
the following command.
`pip3 install -r requirements.txt
Step 7: All the requirements have been downloaded in your setoolkit. Now it’s
time to install the requirements that you have downloaded
>>>python setup.py

Step 8: Finally all the processes of installation have been completed now it’s
time to run the social engineering toolkit .to run the SEToolkit type following
command.
>>>Setoolkit

Step 9: At this step, setoolkit will ask you (y) or (n). Type y and your social
Step 10: Now your setoolkit has been downloaded into your system now it’s
time to use it .now you have to choose an option from the following
options .here we are choosing option 2
Website Attack Vector

Option: 2

Step 11: Now we are about to set up a phishing page so here we will choose
option 3 that is the credential harvester attack method.
Option: 3

Step 12: Now since we are creating a Phishing page so here we will choose
option 1 that is web templates.
Option: 1
Step 13: Create a google phishing page so choose option 2 for that then a
phishing page will be generated on your localhost.

Step 14: Social engineering toolkit is creating a phishing page of google.

RESULT:
Thus, the experiment to attach the website using social engineering
method is executed and verified successfully.

You might also like