SlideShare a Scribd company logo
FINAL PROJECT
SAN JOSE STATE UNIVERSITY
CS166 SPRING 2017
KAYA OTA
CONTENT
1. Behind the scene
tour of this site.
2. SQL Injection
3. XSS (Cross Site
Scripting)
4. Cookie Stealing
5. Protocol
1. Authentication
6. CSRF
BEHIND THE SCENE TOUR OF THIS SITE
ENTRY URL FOR CS166 BLOG
• Prevented codes are running at:
• http://ec2-34-208-99-244.us-west-
2.compute.amazonaws.com:8080/CS166_Final_Project/Project_Code
/prevented/index.html
• The given codes are running at:
• http://ec2-34-208-99-244.us-west-
2.compute.amazonaws.com:8080/CS166_Final_Project/Project_Code
/attackable/index.html
HOW TO BUILD THIS SITE
• Download source code from the git hub:
https://github.com/28kayak/CS166_Final_Project.git
• Set up AWS windows server with the following security group.
HOW TO BUILD THIS SITE
• Set up XAMPP with Tomcat and
Maria DB.
• Check Windows server side of fire
wall's setting. (image on the left)
• Tomcat entry is on port 8080.
SQL TABLE – LOGIN –
• Use Maria DB
• Login table contains user information
• Fullname – user’s name
• User – user ID
• Pass – password
• Random – salt for the password
Fullname User pass role Random
SQL TABLE –BLOG–
• Blog table contains posts for the blog.
• Title is title of the post
• Content is the articles in the post
• ID is the post id and is the primary key
title content id
SQL INJECTION
SQL INJECTION – OVERVIEW –
• A type of injection attack
• A SQL injection attack is by “injection” of SQL query via input
data from the client to the application.
• When SQL succeed the followings could happen
• Read sensitive data
• Modify DB data
• Run administrative operation
SQL INJECTION – THREAD MODELING –
• SQL Injection lets attackers to spoof identity, and temper data in
database.
• SQL Injection lets cause repudiation issues
• Voiding transaction
• Changing balance
• SQL injection is common with PHP and ASP
• Because these older functional interfaces are widely used.
• Nature of programmatic interface available
• J2EE and ASP.NET application are less likely to have easily
exploited SQL injection.
SQL INJECTION – PREVENTION –
I. Use prepared statement / parameterized queries
I. Prepared statement force the developers to first define all SQL code
and then pass the required parameters later to the query.
II. This allows DB to distinguish between code and data, independent
from user-input.
SQL INJECTION – PREVENTION –
String user = request.getParameter( "user" );
String pass = request.getParameter( "pass" );
String sqlStr = "SELECT fullname FROM login WHERE user='" + user + "' and pass = sha2('"+
pass + "', 256)";
String sqlStr = "SELECT count(*) FROM login WHERE user=? and pass = sha2(?, 256)";
PreparedStatement stmt = con.prepareStatement(sqlStr);
stmt.setString(1,name);
stmt.setString(2,pwd);
ResultSet rs = stmt.executeQuery();
No Use of Prepared
Statement
Use of Prepared
Statement
SQL INJECTION – PREVENTION –
II. Use Stored Procedure
I. Not always safe from SQL Injection
II. Certain Stored Procedures have the similar effect as use of
parameterized query
III. It requires to build SQL query with parameters that are automatically
parametrized unless the developer does something out of norm.
SQL INJECTION – DEMONSTRATION –
• Not Preventing Site
• http://ec2-34-208-99-244.us-west-
2.compute.amazonaws.com:8080/CS166_Final_Project/Project_Code/att
ackable/login_form.html
• Preventing Site
• Running here
XSS – CROSS SITE SCRIPTING –
XSS – OVERVIEW –
• A type of injection attack
• Injects malicious script into benign and trusted website.
• Occurs when an attacker users a web application to send
malicious code
• Generally in the form of a browser side script to different end
user.
XSS – THREAD MODELING –
• XSS lets attackers do the followings
• Identity Thrift (fraud)
• Redirect traffic by altering URL
• Session Hijacking
• Storing sensitive information in JavaScript variables
XSS – PREVENTION –
• Never accepts to insert untrusted data except in allowed location
• Deny all – do not put untrusted data into your html document unless it is
within one of the slot of defined in rule #1
• Most importantly, never accept actual JavaScript code
from an untrusted data and then run it.
•Escape XML sequences
• Using Escape sequences
• http://www.avajava.com/tutorials/lessons/how-do-i-
escape-a-string-for-xml.html
SCREEN SHOT FOR XSS
ATTACKED PREVENTED
XSS –DEMONSTRATION–
• Demonstration running at
• http://ec2-34-208-99-244.us-west-
2.compute.amazonaws.com:8080/CS166_Final_Project/Project_Code/att
ackable/login_form.html
CSRF (CROSS SITE REQUEST FORGERY)
CSRF –OVERVIEW–
• CSRF is a type of attacks
• Force user to run unwelcome action on web-applications where
he/she is authorized currently.
• Whereby, HTTP requests are transmitted from a user that the web
site trusts or has
authenticated (e.g., via HTTP redirects or HTML forms).
• CSRF can be caused by:
• Building an exploit URL or Script
http://bank.com/transfer.do?acct=MARIA&amount=100000
Attacker can monaurally change
values to request the service.
CSRF –THREAD MODEL–
• Impact: user may access resource on behalf of the attacker.
• User may upload private image to attacker’s server.
• When using 3rd party login, the user may associate with his
client account with attacker’s identity at an identity provider.
CSRF –PREVENTION–
• Use synchronized token pattern
• Never use get method in html form
REFERENCE
• https://www.owasp.org/index.php/SQL_Injection
• https://tools.ietf.org/html/rfc6819#section-4.4.1.8

More Related Content

What's hot

Introduction to Mod security session April 2016
Introduction to Mod security session April 2016Introduction to Mod security session April 2016
Introduction to Mod security session April 2016
Rahul
 
[Wroclaw #2] Web Application Security Headers
[Wroclaw #2] Web Application Security Headers[Wroclaw #2] Web Application Security Headers
[Wroclaw #2] Web Application Security Headers
OWASP
 
Why you should use true single-sign-on in Icinga Web 2 - Icinga Camp Stockhol...
Why you should use true single-sign-on in Icinga Web 2 - Icinga Camp Stockhol...Why you should use true single-sign-on in Icinga Web 2 - Icinga Camp Stockhol...
Why you should use true single-sign-on in Icinga Web 2 - Icinga Camp Stockhol...
Icinga
 
Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?
Yassine Aboukir
 
Apache Struts2 CVE-2017-5638
Apache Struts2 CVE-2017-5638Apache Struts2 CVE-2017-5638
Apache Struts2 CVE-2017-5638
Riyaz Walikar
 
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolfDefeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolfdrewz lin
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)OWASP Khartoum
 
Black magic of web attacks Detection and Prevention
Black magic of web attacks Detection and PreventionBlack magic of web attacks Detection and Prevention
Black magic of web attacks Detection and Prevention
Nazar Tymoshyk, CEH, Ph.D.
 
SSL Pinning and Bypasses: Android and iOS
SSL Pinning and Bypasses: Android and iOSSSL Pinning and Bypasses: Android and iOS
SSL Pinning and Bypasses: Android and iOS
Anant Shrivastava
 
[Wroclaw #7] AWS (in)security - the devil is in the detail
[Wroclaw #7] AWS (in)security - the devil is in the detail[Wroclaw #7] AWS (in)security - the devil is in the detail
[Wroclaw #7] AWS (in)security - the devil is in the detail
OWASP
 
Android Tamer: Virtual Machine for Android (Security) Professionals
Android Tamer: Virtual Machine for Android (Security) ProfessionalsAndroid Tamer: Virtual Machine for Android (Security) Professionals
Android Tamer: Virtual Machine for Android (Security) Professionals
Anant Shrivastava
 
[Wroclaw #7] Security test automation
[Wroclaw #7] Security test automation[Wroclaw #7] Security test automation
[Wroclaw #7] Security test automation
OWASP
 
Xssya
XssyaXssya
Same Origin Policy Weaknesses
Same Origin Policy WeaknessesSame Origin Policy Weaknesses
Same Origin Policy Weaknesses
kuza55
 
New Insights into Clickjacking
New Insights into ClickjackingNew Insights into Clickjacking
New Insights into Clickjacking
Marco Balduzzi
 
Beyond OWASP Top 10 - TASK October 2017
Beyond OWASP Top 10 - TASK October 2017Beyond OWASP Top 10 - TASK October 2017
Beyond OWASP Top 10 - TASK October 2017
Aaron Hnatiw
 
[OWASP Poland Day] Saving private token
[OWASP Poland Day] Saving private token[OWASP Poland Day] Saving private token
[OWASP Poland Day] Saving private token
OWASP
 
MITM Attacks on HTTPS: Another Perspective
MITM Attacks on HTTPS: Another PerspectiveMITM Attacks on HTTPS: Another Perspective
MITM Attacks on HTTPS: Another Perspective
GreenD0g
 

What's hot (20)

Introduction to Mod security session April 2016
Introduction to Mod security session April 2016Introduction to Mod security session April 2016
Introduction to Mod security session April 2016
 
Mod Security
Mod SecurityMod Security
Mod Security
 
[Wroclaw #2] Web Application Security Headers
[Wroclaw #2] Web Application Security Headers[Wroclaw #2] Web Application Security Headers
[Wroclaw #2] Web Application Security Headers
 
Why you should use true single-sign-on in Icinga Web 2 - Icinga Camp Stockhol...
Why you should use true single-sign-on in Icinga Web 2 - Icinga Camp Stockhol...Why you should use true single-sign-on in Icinga Web 2 - Icinga Camp Stockhol...
Why you should use true single-sign-on in Icinga Web 2 - Icinga Camp Stockhol...
 
Cross site scripting XSS
Cross site scripting XSSCross site scripting XSS
Cross site scripting XSS
 
Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?Hacking WebApps for fun and profit : how to approach a target?
Hacking WebApps for fun and profit : how to approach a target?
 
Apache Struts2 CVE-2017-5638
Apache Struts2 CVE-2017-5638Apache Struts2 CVE-2017-5638
Apache Struts2 CVE-2017-5638
 
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolfDefeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Black magic of web attacks Detection and Prevention
Black magic of web attacks Detection and PreventionBlack magic of web attacks Detection and Prevention
Black magic of web attacks Detection and Prevention
 
SSL Pinning and Bypasses: Android and iOS
SSL Pinning and Bypasses: Android and iOSSSL Pinning and Bypasses: Android and iOS
SSL Pinning and Bypasses: Android and iOS
 
[Wroclaw #7] AWS (in)security - the devil is in the detail
[Wroclaw #7] AWS (in)security - the devil is in the detail[Wroclaw #7] AWS (in)security - the devil is in the detail
[Wroclaw #7] AWS (in)security - the devil is in the detail
 
Android Tamer: Virtual Machine for Android (Security) Professionals
Android Tamer: Virtual Machine for Android (Security) ProfessionalsAndroid Tamer: Virtual Machine for Android (Security) Professionals
Android Tamer: Virtual Machine for Android (Security) Professionals
 
[Wroclaw #7] Security test automation
[Wroclaw #7] Security test automation[Wroclaw #7] Security test automation
[Wroclaw #7] Security test automation
 
Xssya
XssyaXssya
Xssya
 
Same Origin Policy Weaknesses
Same Origin Policy WeaknessesSame Origin Policy Weaknesses
Same Origin Policy Weaknesses
 
New Insights into Clickjacking
New Insights into ClickjackingNew Insights into Clickjacking
New Insights into Clickjacking
 
Beyond OWASP Top 10 - TASK October 2017
Beyond OWASP Top 10 - TASK October 2017Beyond OWASP Top 10 - TASK October 2017
Beyond OWASP Top 10 - TASK October 2017
 
[OWASP Poland Day] Saving private token
[OWASP Poland Day] Saving private token[OWASP Poland Day] Saving private token
[OWASP Poland Day] Saving private token
 
MITM Attacks on HTTPS: Another Perspective
MITM Attacks on HTTPS: Another PerspectiveMITM Attacks on HTTPS: Another Perspective
MITM Attacks on HTTPS: Another Perspective
 

Similar to CS166 Final project

Web security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersWeb security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsers
Phú Phùng
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application Defense
Frank Kim
 
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
LogeekNightUkraine
 
Web vulnerabilities
Web vulnerabilitiesWeb vulnerabilities
Web vulnerabilities
Oleksandr Kovalchuk
 
The path of secure software by Katy Anton
The path of secure software by Katy AntonThe path of secure software by Katy Anton
The path of secure software by Katy Anton
DevSecCon
 
API SECURITY
API SECURITYAPI SECURITY
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
Devnology
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
bilcorry
 
How do JavaScript frameworks impact the security of applications?
How do JavaScript frameworks impact the security of applications?How do JavaScript frameworks impact the security of applications?
How do JavaScript frameworks impact the security of applications?
Ksenia Peguero
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
Niyas Nazar
 
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
Aditya K Sood
 
Cross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning CenterCross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning Center
Michael Coates
 
Secure coding in C#
Secure coding in C#Secure coding in C#
Secure coding in C#
Siddharth Bezalwar
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2
Jim Manico
 
Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12
Jim Manico
 
OWASP London - So you thought you were safe using AngularJS.. Think again!
OWASP London - So you thought you were safe using AngularJS.. Think again!OWASP London - So you thought you were safe using AngularJS.. Think again!
OWASP London - So you thought you were safe using AngularJS.. Think again!
Lewis Ardern
 
OWASP top 10-2013
OWASP top 10-2013OWASP top 10-2013
OWASP top 10-2013
tmd800
 
Vulnerabilities in data processing levels
Vulnerabilities in data processing levelsVulnerabilities in data processing levels
Vulnerabilities in data processing levelsbeched
 

Similar to CS166 Final project (20)

Web security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersWeb security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsers
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application Defense
 
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
Dmytro Kochergin - "The OWASP TOP 10 - Typical Attacks on Web Applications an...
 
Web vulnerabilities
Web vulnerabilitiesWeb vulnerabilities
Web vulnerabilities
 
The path of secure software by Katy Anton
The path of secure software by Katy AntonThe path of secure software by Katy Anton
The path of secure software by Katy Anton
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 
How do JavaScript frameworks impact the security of applications?
How do JavaScript frameworks impact the security of applications?How do JavaScript frameworks impact the security of applications?
How do JavaScript frameworks impact the security of applications?
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
 
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
 
a
aa
a
 
Cross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning CenterCross Site Scripting - Mozilla Security Learning Center
Cross Site Scripting - Mozilla Security Learning Center
 
Secure coding in C#
Secure coding in C#Secure coding in C#
Secure coding in C#
 
SQL Injection
SQL InjectionSQL Injection
SQL Injection
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2
 
Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12
 
OWASP London - So you thought you were safe using AngularJS.. Think again!
OWASP London - So you thought you were safe using AngularJS.. Think again!OWASP London - So you thought you were safe using AngularJS.. Think again!
OWASP London - So you thought you were safe using AngularJS.. Think again!
 
OWASP top 10-2013
OWASP top 10-2013OWASP top 10-2013
OWASP top 10-2013
 
Vulnerabilities in data processing levels
Vulnerabilities in data processing levelsVulnerabilities in data processing levels
Vulnerabilities in data processing levels
 

More from Kaya Ota

Solr 勉強会 20191028
Solr 勉強会 20191028Solr 勉強会 20191028
Solr 勉強会 20191028
Kaya Ota
 
Privacy statement
Privacy statementPrivacy statement
Privacy statement
Kaya Ota
 
Cs166 mynote
Cs166 mynoteCs166 mynote
Cs166 mynote
Kaya Ota
 
Cs166 hw1
Cs166 hw1Cs166 hw1
Cs166 hw1
Kaya Ota
 
Edited keeping happiness
Edited keeping happinessEdited keeping happiness
Edited keeping happiness
Kaya Ota
 
Database Management System Review
Database Management System ReviewDatabase Management System Review
Database Management System Review
Kaya Ota
 
javascript
javascript javascript
javascript Kaya Ota
 
Math178 hw7
Math178 hw7Math178 hw7
Math178 hw7
Kaya Ota
 
CS152 Programming Paradigm
CS152 Programming Paradigm CS152 Programming Paradigm
CS152 Programming Paradigm
Kaya Ota
 
Umap traversabilityin graph
Umap traversabilityin graphUmap traversabilityin graph
Umap traversabilityin graphKaya Ota
 
Price Distribution and Consumer Surplus
Price Distribution and Consumer Surplus Price Distribution and Consumer Surplus
Price Distribution and Consumer Surplus
Kaya Ota
 
Midterm review for CS156
Midterm review for CS156Midterm review for CS156
Midterm review for CS156
Kaya Ota
 
Jit complier
Jit complierJit complier
Jit complier
Kaya Ota
 
Methodologies of Software Engineering
Methodologies of Software EngineeringMethodologies of Software Engineering
Methodologies of Software Engineering
Kaya Ota
 

More from Kaya Ota (14)

Solr 勉強会 20191028
Solr 勉強会 20191028Solr 勉強会 20191028
Solr 勉強会 20191028
 
Privacy statement
Privacy statementPrivacy statement
Privacy statement
 
Cs166 mynote
Cs166 mynoteCs166 mynote
Cs166 mynote
 
Cs166 hw1
Cs166 hw1Cs166 hw1
Cs166 hw1
 
Edited keeping happiness
Edited keeping happinessEdited keeping happiness
Edited keeping happiness
 
Database Management System Review
Database Management System ReviewDatabase Management System Review
Database Management System Review
 
javascript
javascript javascript
javascript
 
Math178 hw7
Math178 hw7Math178 hw7
Math178 hw7
 
CS152 Programming Paradigm
CS152 Programming Paradigm CS152 Programming Paradigm
CS152 Programming Paradigm
 
Umap traversabilityin graph
Umap traversabilityin graphUmap traversabilityin graph
Umap traversabilityin graph
 
Price Distribution and Consumer Surplus
Price Distribution and Consumer Surplus Price Distribution and Consumer Surplus
Price Distribution and Consumer Surplus
 
Midterm review for CS156
Midterm review for CS156Midterm review for CS156
Midterm review for CS156
 
Jit complier
Jit complierJit complier
Jit complier
 
Methodologies of Software Engineering
Methodologies of Software EngineeringMethodologies of Software Engineering
Methodologies of Software Engineering
 

Recently uploaded

Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 

Recently uploaded (20)

Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 

CS166 Final project

  • 1. FINAL PROJECT SAN JOSE STATE UNIVERSITY CS166 SPRING 2017 KAYA OTA
  • 2. CONTENT 1. Behind the scene tour of this site. 2. SQL Injection 3. XSS (Cross Site Scripting) 4. Cookie Stealing 5. Protocol 1. Authentication 6. CSRF
  • 3. BEHIND THE SCENE TOUR OF THIS SITE
  • 4. ENTRY URL FOR CS166 BLOG • Prevented codes are running at: • http://ec2-34-208-99-244.us-west- 2.compute.amazonaws.com:8080/CS166_Final_Project/Project_Code /prevented/index.html • The given codes are running at: • http://ec2-34-208-99-244.us-west- 2.compute.amazonaws.com:8080/CS166_Final_Project/Project_Code /attackable/index.html
  • 5. HOW TO BUILD THIS SITE • Download source code from the git hub: https://github.com/28kayak/CS166_Final_Project.git • Set up AWS windows server with the following security group.
  • 6. HOW TO BUILD THIS SITE • Set up XAMPP with Tomcat and Maria DB. • Check Windows server side of fire wall's setting. (image on the left) • Tomcat entry is on port 8080.
  • 7. SQL TABLE – LOGIN – • Use Maria DB • Login table contains user information • Fullname – user’s name • User – user ID • Pass – password • Random – salt for the password Fullname User pass role Random
  • 8. SQL TABLE –BLOG– • Blog table contains posts for the blog. • Title is title of the post • Content is the articles in the post • ID is the post id and is the primary key title content id
  • 10. SQL INJECTION – OVERVIEW – • A type of injection attack • A SQL injection attack is by “injection” of SQL query via input data from the client to the application. • When SQL succeed the followings could happen • Read sensitive data • Modify DB data • Run administrative operation
  • 11. SQL INJECTION – THREAD MODELING – • SQL Injection lets attackers to spoof identity, and temper data in database. • SQL Injection lets cause repudiation issues • Voiding transaction • Changing balance • SQL injection is common with PHP and ASP • Because these older functional interfaces are widely used. • Nature of programmatic interface available • J2EE and ASP.NET application are less likely to have easily exploited SQL injection.
  • 12. SQL INJECTION – PREVENTION – I. Use prepared statement / parameterized queries I. Prepared statement force the developers to first define all SQL code and then pass the required parameters later to the query. II. This allows DB to distinguish between code and data, independent from user-input.
  • 13. SQL INJECTION – PREVENTION – String user = request.getParameter( "user" ); String pass = request.getParameter( "pass" ); String sqlStr = "SELECT fullname FROM login WHERE user='" + user + "' and pass = sha2('"+ pass + "', 256)"; String sqlStr = "SELECT count(*) FROM login WHERE user=? and pass = sha2(?, 256)"; PreparedStatement stmt = con.prepareStatement(sqlStr); stmt.setString(1,name); stmt.setString(2,pwd); ResultSet rs = stmt.executeQuery(); No Use of Prepared Statement Use of Prepared Statement
  • 14. SQL INJECTION – PREVENTION – II. Use Stored Procedure I. Not always safe from SQL Injection II. Certain Stored Procedures have the similar effect as use of parameterized query III. It requires to build SQL query with parameters that are automatically parametrized unless the developer does something out of norm.
  • 15. SQL INJECTION – DEMONSTRATION – • Not Preventing Site • http://ec2-34-208-99-244.us-west- 2.compute.amazonaws.com:8080/CS166_Final_Project/Project_Code/att ackable/login_form.html • Preventing Site • Running here
  • 16. XSS – CROSS SITE SCRIPTING –
  • 17. XSS – OVERVIEW – • A type of injection attack • Injects malicious script into benign and trusted website. • Occurs when an attacker users a web application to send malicious code • Generally in the form of a browser side script to different end user.
  • 18. XSS – THREAD MODELING – • XSS lets attackers do the followings • Identity Thrift (fraud) • Redirect traffic by altering URL • Session Hijacking • Storing sensitive information in JavaScript variables
  • 19. XSS – PREVENTION – • Never accepts to insert untrusted data except in allowed location • Deny all – do not put untrusted data into your html document unless it is within one of the slot of defined in rule #1 • Most importantly, never accept actual JavaScript code from an untrusted data and then run it. •Escape XML sequences • Using Escape sequences • http://www.avajava.com/tutorials/lessons/how-do-i- escape-a-string-for-xml.html
  • 20. SCREEN SHOT FOR XSS ATTACKED PREVENTED
  • 21. XSS –DEMONSTRATION– • Demonstration running at • http://ec2-34-208-99-244.us-west- 2.compute.amazonaws.com:8080/CS166_Final_Project/Project_Code/att ackable/login_form.html
  • 22. CSRF (CROSS SITE REQUEST FORGERY)
  • 23. CSRF –OVERVIEW– • CSRF is a type of attacks • Force user to run unwelcome action on web-applications where he/she is authorized currently. • Whereby, HTTP requests are transmitted from a user that the web site trusts or has authenticated (e.g., via HTTP redirects or HTML forms). • CSRF can be caused by: • Building an exploit URL or Script http://bank.com/transfer.do?acct=MARIA&amount=100000 Attacker can monaurally change values to request the service.
  • 24. CSRF –THREAD MODEL– • Impact: user may access resource on behalf of the attacker. • User may upload private image to attacker’s server. • When using 3rd party login, the user may associate with his client account with attacker’s identity at an identity provider.
  • 25. CSRF –PREVENTION– • Use synchronized token pattern • Never use get method in html form