SlideShare uma empresa Scribd logo
1 de 25
Langara Computer Tech Meetup
February 21, 2014

Simple Principles for Website Security
Lauren Wood
lauren@textuality.com
slideshare.net/laurendw

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

1
Contents

Basics of HTTP and HTTPS
Some common security attacks
Protecting your site
Protecting yourself

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

2
HTTP and HTTPS

Licensed under a Creative Commons Attribution-NoncommercialShare Alike 3.0 Unported License
HTTP Flows
Core HTTP protocol

•
•

Client requests a resource with certain parameters (headers)
Ideally the server responds with the requested resource,
and/or a status code and headers

Client

GET /index.html HTTP/1.1
+ headers

Server

200 OK + headers +
index.html

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

4
HTTP Basic Authentication
Basic authentication - HTTP 1.0, 1999, RFC 2617

•
•
•

widely implemented
not secure, password sent in clear text
protects resources in authentication realm
GET /index.html HTTP/1.1
+ headers

Client

401 unauthorized

Server

username + password
resource + headers
Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

5
HTTP Digest Authentication

•
•
•
•

Encrypts the password using cryptographic hash aka digest

•

Easier to implement/use HTTP Basic over SSL/TLS than HTTP
Digest

Cryptographic hash is effectively impossible to break
Quick to compute the digest from the string
Security further improved by using a nonce (random number,
generated on server, that changes each time the client gets the
401)

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

6
Summary: HTTP Authentication
Based on password authentication

•
•
•
•
•
•
•

weak authentication (only one factor)
people tend to forget their passwords
solutions to forgetting often not secure
easy to implement
suitable for “don't need much protection” resources
Digest more secure but harder to use
Use Basic over SSL for reasonable security

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

7
Data protection (security)

Licensed under a Creative Commons Attribution-NoncommercialShare Alike 3.0 Unported License
Connection-based security
Secures the path between two end-points.
Security is transient, only for the data in motion.
Relatively simple to use, high performance.
Point to point solution, doesn’t work across middle
points.

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

9
HTTPS/TLS/SSL
Adds encryption, signing, records, and session
tracking to the basic HTTP

•

browser sends request to port 443 with session ID, encryption
algorithms it likes, random string, and requested website

•

web site sends back server name, session ID, encryption
algorithm, server version of the string, and server certificate

•

browser decides whether to trust the certificate, checks the
host name

•
•

exchange tokens (secrets) to encrypt the data
start exchanging encrypted data with session IDs and
sequence numbers

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

10
What is a Certificate?

•
•
•
•
•
•
•

Electronic document, typically in X.509 format

•

Signature usually comes from a Certification Authority

Used in PKI (public key infrastructure) systems
Includes a public key
Includes identity information for person or corporation
Includes hostname if intended to be used for TLS
Digitally signed
Signature attests that identity information and public key
belong together

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

11
Certificate Authorities
An aside on certificate authorities

•
•
•

ultimate source of the trust in the system
the authority signs the certificate
what happens if the authority is hacked?

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

12
Message-based security
Ties the security to the message

•
•
•
•
•
•
•

part or all of the message is encrypted
protects the data at rest
remains secure once it's received
can use intermediaries who can't read it
tied to a particular format
computationally expensive
difficult to implement and use

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

13
Some common web site
attacks

Licensed under a Creative Commons Attribution-NoncommercialShare Alike 3.0 Unported License
OWASP Top Ten
List of the top ten attacks, how they work, how to
prevent them. We'll look at three of the top ten:

•
•
•

SQL Injection
Cross-Site Scripting (XSS)
Cross-Site Request Forgery (CSRF)

More details: OWASP.org

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

15
SQL Injection Attacks

http://xkcd.com/327/

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

16
Example Code
String query = "SELECT * FROM accounts WHERE custID='" +
request.getParameter("id") +"'";

The attacker changes the query URL to http://example.com/app/accountView?id=' or '1'='1 which
leads to the complete query being
SELECT * FROM accounts WHERE custID='' or '1'='1'

'1'='1' is always true, so the query returns the entire account list.

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

17
Preventing SQL Injection Attacks

•
•

Stop writing dynamic queries and/or
Ensure malicious user-supplied input can't do anything

•
•
•
•
•

use prepared statements
use stored procedures
escape user-supplied input
principle of least privilege
principle of white list input validation

Check the OWASP SQL Injection Cheat Sheet for
more details

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

18
XSS Attacks
Cross-site scripting (aka CSS)

•

Malicious script tricks user’s browser into thinking it comes
from a trusted source

•

Can access cookies, security tokens, etc, as fully trusted

Example:

•
•

comment site allows full HTML

•

comment is on same site, so can access cookies etc defined by
that site, including, e.g., login info

attacking comment includes javascript that runs when victim
loads the page

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

19
Variations of XSS

•

Attacker crafts query URI and cons the victim into clicking on
it from email

•

Attacker (mis)uses some HTML element

•
•
•
•
•

script element, to load external script
add onload attribute to body element
put a script in the src attribute of an img element
put script in rel=“stylesheet” attribute of link element
put script in background attribute of table element

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

20
Preventing XSS Attacks
Multi-layer prevention is best

•

only allow characters that make sense in the context

•
•

e.g., don't allow input into a script
don't allow non-printable characters in name fields

•
•

ensure input data can't change the HTML DOM tree

•

consider escaping all “special” characters with the right
character or numeric entity (ASCII code under 256)

•

escape JavaScript, CSS, and URIs appropriately

escape all HTML/XML significant characters with entities, e.g.,
<

Check the OWASP XSS Prevention Cheat Sheet
Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

21
WordPress
Basic security for WordPress sites:
http://codex.wordpress.org/Hardening_WordPress
(go to codex.wordpress.org and follow the links)
Data validation:
http://codex.wordpress.org/Data_Validation
Check plugins and themes to see if they use the
right functions
Other systems (Drupal, etc) have similar functions
Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

22
CSRF Attacks
Cross-Site Request Forgery

•
•
•

victim is logged in somewhere
attacker convinces victim to run a script
script action is carried out, since victim is logged in

Prevention

•
•

add a random token to forms in a hidden field
for WordPress, use wp_nonce functions (e.g. at
http://crunchify.com/how-to-secure-your-wordpress-pluginprevent-csrf-vulnerability/)

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

23
While you're on the web
Good measures to not become a victim

•
•

load up your main browser with prevention plugins

•
•
•

use that browser for important sites

consider using NoScript or other XSS warning plugin/extension (http://noscript.net/faq#qa4_2)

log out of your bank site when you're finished
use a different browser for random surfing

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

24
Langara Computer Tech Meetup
February 21, 2014

Simple Principles for Website Security
Lauren Wood
lauren@textuality.com
slideshare.net/laurendw

Licensed under a Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License

25
25

Mais conteúdo relacionado

Mais procurados

Securing RESTful APIs using OAuth 2 and OpenID Connect
Securing RESTful APIs using OAuth 2 and OpenID ConnectSecuring RESTful APIs using OAuth 2 and OpenID Connect
Securing RESTful APIs using OAuth 2 and OpenID ConnectJonathan LeBlanc
 
Common Web Application Attacks
Common Web Application Attacks Common Web Application Attacks
Common Web Application Attacks Ahmed Sherif
 
Secure code practices
Secure code practicesSecure code practices
Secure code practicesHina Rawal
 
Elegant Rest Design Webinar
Elegant Rest Design WebinarElegant Rest Design Webinar
Elegant Rest Design WebinarStormpath
 
Best Practices in Building an API Security Ecosystem
Best Practices in Building an API Security EcosystemBest Practices in Building an API Security Ecosystem
Best Practices in Building an API Security EcosystemPrabath Siriwardena
 
Web application security: Threats & Countermeasures
Web application security: Threats & CountermeasuresWeb application security: Threats & Countermeasures
Web application security: Threats & CountermeasuresAung Thu Rha Hein
 
Design and Analyze Secure Networked Systems - 3
Design and Analyze Secure Networked Systems - 3Design and Analyze Secure Networked Systems - 3
Design and Analyze Secure Networked Systems - 3Don Kim
 
Website Hacking and Preventive Measures
Website Hacking and Preventive MeasuresWebsite Hacking and Preventive Measures
Website Hacking and Preventive MeasuresShubham Takode
 
Web application attack Presentation
Web application attack PresentationWeb application attack Presentation
Web application attack PresentationKhoa Nguyen
 
Scratching Your Brain into Dark Web by Arpit Maheshwari
Scratching Your Brain into Dark Web by Arpit MaheshwariScratching Your Brain into Dark Web by Arpit Maheshwari
Scratching Your Brain into Dark Web by Arpit MaheshwariOWASP Delhi
 
JWT Authentication with AngularJS
JWT Authentication with AngularJSJWT Authentication with AngularJS
JWT Authentication with AngularJSrobertjd
 
Building an API Security Ecosystem
Building an API Security EcosystemBuilding an API Security Ecosystem
Building an API Security EcosystemPrabath Siriwardena
 
Adding Identity Management and Access Control to your Application, Authorization
Adding Identity Management and Access Control to your Application, AuthorizationAdding Identity Management and Access Control to your Application, Authorization
Adding Identity Management and Access Control to your Application, AuthorizationFernando Lopez Aguilar
 
Post XSS Exploitation : Advanced Attacks and Remedies
Post XSS Exploitation : Advanced Attacks and RemediesPost XSS Exploitation : Advanced Attacks and Remedies
Post XSS Exploitation : Advanced Attacks and RemediesAdwiteeya Agrawal
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Jeremiah Grossman
 
OWASP San Diego Training Presentation
OWASP San Diego Training PresentationOWASP San Diego Training Presentation
OWASP San Diego Training Presentationowaspsd
 
Web application attacks
Web application attacksWeb application attacks
Web application attackshruth
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application SecurityRob Ragan
 

Mais procurados (20)

Securing RESTful APIs using OAuth 2 and OpenID Connect
Securing RESTful APIs using OAuth 2 and OpenID ConnectSecuring RESTful APIs using OAuth 2 and OpenID Connect
Securing RESTful APIs using OAuth 2 and OpenID Connect
 
Common Web Application Attacks
Common Web Application Attacks Common Web Application Attacks
Common Web Application Attacks
 
Secure code practices
Secure code practicesSecure code practices
Secure code practices
 
Lets Make our Web Applications Secure
Lets Make our Web Applications SecureLets Make our Web Applications Secure
Lets Make our Web Applications Secure
 
Elegant Rest Design Webinar
Elegant Rest Design WebinarElegant Rest Design Webinar
Elegant Rest Design Webinar
 
Best Practices in Building an API Security Ecosystem
Best Practices in Building an API Security EcosystemBest Practices in Building an API Security Ecosystem
Best Practices in Building an API Security Ecosystem
 
Web application security: Threats & Countermeasures
Web application security: Threats & CountermeasuresWeb application security: Threats & Countermeasures
Web application security: Threats & Countermeasures
 
Design and Analyze Secure Networked Systems - 3
Design and Analyze Secure Networked Systems - 3Design and Analyze Secure Networked Systems - 3
Design and Analyze Secure Networked Systems - 3
 
Website Hacking and Preventive Measures
Website Hacking and Preventive MeasuresWebsite Hacking and Preventive Measures
Website Hacking and Preventive Measures
 
Web application attack Presentation
Web application attack PresentationWeb application attack Presentation
Web application attack Presentation
 
Scratching Your Brain into Dark Web by Arpit Maheshwari
Scratching Your Brain into Dark Web by Arpit MaheshwariScratching Your Brain into Dark Web by Arpit Maheshwari
Scratching Your Brain into Dark Web by Arpit Maheshwari
 
JWT Authentication with AngularJS
JWT Authentication with AngularJSJWT Authentication with AngularJS
JWT Authentication with AngularJS
 
Building an API Security Ecosystem
Building an API Security EcosystemBuilding an API Security Ecosystem
Building an API Security Ecosystem
 
Adding Identity Management and Access Control to your Application, Authorization
Adding Identity Management and Access Control to your Application, AuthorizationAdding Identity Management and Access Control to your Application, Authorization
Adding Identity Management and Access Control to your Application, Authorization
 
Post XSS Exploitation : Advanced Attacks and Remedies
Post XSS Exploitation : Advanced Attacks and RemediesPost XSS Exploitation : Advanced Attacks and Remedies
Post XSS Exploitation : Advanced Attacks and Remedies
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008
 
OWASP San Diego Training Presentation
OWASP San Diego Training PresentationOWASP San Diego Training Presentation
OWASP San Diego Training Presentation
 
Web application attacks
Web application attacksWeb application attacks
Web application attacks
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Intro to Web Application Security
Intro to Web Application SecurityIntro to Web Application Security
Intro to Web Application Security
 

Destaque

Implementation Of real testbed of DDOS
Implementation Of real testbed of DDOSImplementation Of real testbed of DDOS
Implementation Of real testbed of DDOSJatin Singh
 
Final presentation some title
Final presentation some titleFinal presentation some title
Final presentation some titlebezomaxo
 
Implementation of intelligent wide area network(wan)
Implementation of intelligent wide area network(wan)Implementation of intelligent wide area network(wan)
Implementation of intelligent wide area network(wan)Jatin Singh
 
INSA - Java in da Cloud - 06/2016
INSA - Java in da Cloud - 06/2016INSA - Java in da Cloud - 06/2016
INSA - Java in da Cloud - 06/2016Alexis Hassler
 
Implementation of intelligent wide area network(wan)- report
Implementation of intelligent wide area network(wan)- reportImplementation of intelligent wide area network(wan)- report
Implementation of intelligent wide area network(wan)- reportJatin Singh
 
Resistors in series and parallel circuits
Resistors in series and parallel circuitsResistors in series and parallel circuits
Resistors in series and parallel circuitsManzar Memon
 
Phân tích-báo-cáo-tài-chính-của-ngân-hàng-thương-mại-cổ-phần-thương-mại-ngoại...
Phân tích-báo-cáo-tài-chính-của-ngân-hàng-thương-mại-cổ-phần-thương-mại-ngoại...Phân tích-báo-cáo-tài-chính-của-ngân-hàng-thương-mại-cổ-phần-thương-mại-ngoại...
Phân tích-báo-cáo-tài-chính-của-ngân-hàng-thương-mại-cổ-phần-thương-mại-ngoại...Nguyễn Ngọc Phan Văn
 
Rehiyon IX( lalawigan, kasaysayan, laki at populasyon)
Rehiyon IX( lalawigan, kasaysayan, laki at populasyon)Rehiyon IX( lalawigan, kasaysayan, laki at populasyon)
Rehiyon IX( lalawigan, kasaysayan, laki at populasyon)Kimberly Jones Cuaresma
 
Presentación1
Presentación1Presentación1
Presentación1adricar12
 
Tipos de ecosistemas
Tipos de ecosistemasTipos de ecosistemas
Tipos de ecosistemasanelicecalu
 
LA ACTITUD MENTAL POSITIVA Un camino hacia el éxito NAPOLEÓN HILL W. CLEMENT ...
LA ACTITUD MENTAL POSITIVA Un camino hacia el éxito NAPOLEÓN HILL W. CLEMENT ...LA ACTITUD MENTAL POSITIVA Un camino hacia el éxito NAPOLEÓN HILL W. CLEMENT ...
LA ACTITUD MENTAL POSITIVA Un camino hacia el éxito NAPOLEÓN HILL W. CLEMENT ...Máster Coach YLICH TARAZONA
 

Destaque (17)

Poland
PolandPoland
Poland
 
Implementation Of real testbed of DDOS
Implementation Of real testbed of DDOSImplementation Of real testbed of DDOS
Implementation Of real testbed of DDOS
 
K r-engineering-works
K r-engineering-worksK r-engineering-works
K r-engineering-works
 
Final presentation some title
Final presentation some titleFinal presentation some title
Final presentation some title
 
Implementation of intelligent wide area network(wan)
Implementation of intelligent wide area network(wan)Implementation of intelligent wide area network(wan)
Implementation of intelligent wide area network(wan)
 
INSA - Java in da Cloud - 06/2016
INSA - Java in da Cloud - 06/2016INSA - Java in da Cloud - 06/2016
INSA - Java in da Cloud - 06/2016
 
Implementation of intelligent wide area network(wan)- report
Implementation of intelligent wide area network(wan)- reportImplementation of intelligent wide area network(wan)- report
Implementation of intelligent wide area network(wan)- report
 
Monopsony
MonopsonyMonopsony
Monopsony
 
Resistors in series and parallel circuits
Resistors in series and parallel circuitsResistors in series and parallel circuits
Resistors in series and parallel circuits
 
Monopsony
MonopsonyMonopsony
Monopsony
 
Phân tích-báo-cáo-tài-chính-của-ngân-hàng-thương-mại-cổ-phần-thương-mại-ngoại...
Phân tích-báo-cáo-tài-chính-của-ngân-hàng-thương-mại-cổ-phần-thương-mại-ngoại...Phân tích-báo-cáo-tài-chính-của-ngân-hàng-thương-mại-cổ-phần-thương-mại-ngoại...
Phân tích-báo-cáo-tài-chính-của-ngân-hàng-thương-mại-cổ-phần-thương-mại-ngoại...
 
Rehiyon IX( lalawigan, kasaysayan, laki at populasyon)
Rehiyon IX( lalawigan, kasaysayan, laki at populasyon)Rehiyon IX( lalawigan, kasaysayan, laki at populasyon)
Rehiyon IX( lalawigan, kasaysayan, laki at populasyon)
 
Niit
NiitNiit
Niit
 
Presentación1
Presentación1Presentación1
Presentación1
 
Tipos de ecosistemas
Tipos de ecosistemasTipos de ecosistemas
Tipos de ecosistemas
 
La materia
La materiaLa materia
La materia
 
LA ACTITUD MENTAL POSITIVA Un camino hacia el éxito NAPOLEÓN HILL W. CLEMENT ...
LA ACTITUD MENTAL POSITIVA Un camino hacia el éxito NAPOLEÓN HILL W. CLEMENT ...LA ACTITUD MENTAL POSITIVA Un camino hacia el éxito NAPOLEÓN HILL W. CLEMENT ...
LA ACTITUD MENTAL POSITIVA Un camino hacia el éxito NAPOLEÓN HILL W. CLEMENT ...
 

Semelhante a Simple Principles for Website Security

Why You Need A Web Application Firewall
Why You Need A Web Application FirewallWhy You Need A Web Application Firewall
Why You Need A Web Application FirewallPort80 Software
 
Lesson 6 web based attacks
Lesson 6 web based attacksLesson 6 web based attacks
Lesson 6 web based attacksFrank Victory
 
Detailed Developer Report.pdf
Detailed Developer Report.pdfDetailed Developer Report.pdf
Detailed Developer Report.pdfnalla14
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Jay Nagar
 
Hacking_Environment_Web_Application_updated.pptx
Hacking_Environment_Web_Application_updated.pptxHacking_Environment_Web_Application_updated.pptx
Hacking_Environment_Web_Application_updated.pptxshibabrataghosh1
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applicationsSatish b
 
DEF CON 24 - workshop - Craig Young - brainwashing embedded systems
DEF CON 24 - workshop - Craig Young - brainwashing embedded systemsDEF CON 24 - workshop - Craig Young - brainwashing embedded systems
DEF CON 24 - workshop - Craig Young - brainwashing embedded systemsFelipe Prado
 
Oauth Nightmares Abstract OAuth Nightmares
Oauth Nightmares Abstract OAuth Nightmares Oauth Nightmares Abstract OAuth Nightmares
Oauth Nightmares Abstract OAuth Nightmares Nino Ho
 
Module 13 (web based password cracking techniques)
Module 13 (web based password cracking techniques)Module 13 (web based password cracking techniques)
Module 13 (web based password cracking techniques)Wail Hassan
 
Web Hacking Series Part 5
Web Hacking Series Part 5Web Hacking Series Part 5
Web Hacking Series Part 5Aditya Kamat
 
Web Server Web Site Security
Web Server Web Site SecurityWeb Server Web Site Security
Web Server Web Site SecuritySteven Cahill
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encodingEoin Keary
 
O auth2 with angular js
O auth2 with angular jsO auth2 with angular js
O auth2 with angular jsBixlabs
 
OAuth with AngularJS and WebAPI - SoCal Code Camp 2015
OAuth with AngularJS and WebAPI - SoCal Code Camp 2015OAuth with AngularJS and WebAPI - SoCal Code Camp 2015
OAuth with AngularJS and WebAPI - SoCal Code Camp 2015Stuart
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10bilcorry
 

Semelhante a Simple Principles for Website Security (20)

Why You Need A Web Application Firewall
Why You Need A Web Application FirewallWhy You Need A Web Application Firewall
Why You Need A Web Application Firewall
 
Lesson 6 web based attacks
Lesson 6 web based attacksLesson 6 web based attacks
Lesson 6 web based attacks
 
Securing RESTful API
Securing RESTful APISecuring RESTful API
Securing RESTful API
 
Anatomy of a Cloud Hack
Anatomy of a Cloud HackAnatomy of a Cloud Hack
Anatomy of a Cloud Hack
 
Detailed Developer Report.pdf
Detailed Developer Report.pdfDetailed Developer Report.pdf
Detailed Developer Report.pdf
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )
 
Spa Secure Coding Guide
Spa Secure Coding GuideSpa Secure Coding Guide
Spa Secure Coding Guide
 
Hacking_Environment_Web_Application_updated.pptx
Hacking_Environment_Web_Application_updated.pptxHacking_Environment_Web_Application_updated.pptx
Hacking_Environment_Web_Application_updated.pptx
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
 
Intro webapps
Intro webappsIntro webapps
Intro webapps
 
DEF CON 24 - workshop - Craig Young - brainwashing embedded systems
DEF CON 24 - workshop - Craig Young - brainwashing embedded systemsDEF CON 24 - workshop - Craig Young - brainwashing embedded systems
DEF CON 24 - workshop - Craig Young - brainwashing embedded systems
 
Oauth Nightmares Abstract OAuth Nightmares
Oauth Nightmares Abstract OAuth Nightmares Oauth Nightmares Abstract OAuth Nightmares
Oauth Nightmares Abstract OAuth Nightmares
 
Module 13 (web based password cracking techniques)
Module 13 (web based password cracking techniques)Module 13 (web based password cracking techniques)
Module 13 (web based password cracking techniques)
 
Web Hacking Series Part 5
Web Hacking Series Part 5Web Hacking Series Part 5
Web Hacking Series Part 5
 
Web Server Web Site Security
Web Server Web Site SecurityWeb Server Web Site Security
Web Server Web Site Security
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
O auth2 with angular js
O auth2 with angular jsO auth2 with angular js
O auth2 with angular js
 
OAuth with AngularJS and WebAPI - SoCal Code Camp 2015
OAuth with AngularJS and WebAPI - SoCal Code Camp 2015OAuth with AngularJS and WebAPI - SoCal Code Camp 2015
OAuth with AngularJS and WebAPI - SoCal Code Camp 2015
 
HTTP
HTTPHTTP
HTTP
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 

Último

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 

Último (20)

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 

Simple Principles for Website Security

  • 1. Langara Computer Tech Meetup February 21, 2014 Simple Principles for Website Security Lauren Wood lauren@textuality.com slideshare.net/laurendw Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 1
  • 2. Contents Basics of HTTP and HTTPS Some common security attacks Protecting your site Protecting yourself Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 2
  • 3. HTTP and HTTPS Licensed under a Creative Commons Attribution-NoncommercialShare Alike 3.0 Unported License
  • 4. HTTP Flows Core HTTP protocol • • Client requests a resource with certain parameters (headers) Ideally the server responds with the requested resource, and/or a status code and headers Client GET /index.html HTTP/1.1 + headers Server 200 OK + headers + index.html Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 4
  • 5. HTTP Basic Authentication Basic authentication - HTTP 1.0, 1999, RFC 2617 • • • widely implemented not secure, password sent in clear text protects resources in authentication realm GET /index.html HTTP/1.1 + headers Client 401 unauthorized Server username + password resource + headers Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 5
  • 6. HTTP Digest Authentication • • • • Encrypts the password using cryptographic hash aka digest • Easier to implement/use HTTP Basic over SSL/TLS than HTTP Digest Cryptographic hash is effectively impossible to break Quick to compute the digest from the string Security further improved by using a nonce (random number, generated on server, that changes each time the client gets the 401) Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 6
  • 7. Summary: HTTP Authentication Based on password authentication • • • • • • • weak authentication (only one factor) people tend to forget their passwords solutions to forgetting often not secure easy to implement suitable for “don't need much protection” resources Digest more secure but harder to use Use Basic over SSL for reasonable security Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 7
  • 8. Data protection (security) Licensed under a Creative Commons Attribution-NoncommercialShare Alike 3.0 Unported License
  • 9. Connection-based security Secures the path between two end-points. Security is transient, only for the data in motion. Relatively simple to use, high performance. Point to point solution, doesn’t work across middle points. Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 9
  • 10. HTTPS/TLS/SSL Adds encryption, signing, records, and session tracking to the basic HTTP • browser sends request to port 443 with session ID, encryption algorithms it likes, random string, and requested website • web site sends back server name, session ID, encryption algorithm, server version of the string, and server certificate • browser decides whether to trust the certificate, checks the host name • • exchange tokens (secrets) to encrypt the data start exchanging encrypted data with session IDs and sequence numbers Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 10
  • 11. What is a Certificate? • • • • • • • Electronic document, typically in X.509 format • Signature usually comes from a Certification Authority Used in PKI (public key infrastructure) systems Includes a public key Includes identity information for person or corporation Includes hostname if intended to be used for TLS Digitally signed Signature attests that identity information and public key belong together Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 11
  • 12. Certificate Authorities An aside on certificate authorities • • • ultimate source of the trust in the system the authority signs the certificate what happens if the authority is hacked? Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 12
  • 13. Message-based security Ties the security to the message • • • • • • • part or all of the message is encrypted protects the data at rest remains secure once it's received can use intermediaries who can't read it tied to a particular format computationally expensive difficult to implement and use Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 13
  • 14. Some common web site attacks Licensed under a Creative Commons Attribution-NoncommercialShare Alike 3.0 Unported License
  • 15. OWASP Top Ten List of the top ten attacks, how they work, how to prevent them. We'll look at three of the top ten: • • • SQL Injection Cross-Site Scripting (XSS) Cross-Site Request Forgery (CSRF) More details: OWASP.org Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 15
  • 16. SQL Injection Attacks http://xkcd.com/327/ Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 16
  • 17. Example Code String query = "SELECT * FROM accounts WHERE custID='" + request.getParameter("id") +"'"; The attacker changes the query URL to http://example.com/app/accountView?id=' or '1'='1 which leads to the complete query being SELECT * FROM accounts WHERE custID='' or '1'='1' '1'='1' is always true, so the query returns the entire account list. Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 17
  • 18. Preventing SQL Injection Attacks • • Stop writing dynamic queries and/or Ensure malicious user-supplied input can't do anything • • • • • use prepared statements use stored procedures escape user-supplied input principle of least privilege principle of white list input validation Check the OWASP SQL Injection Cheat Sheet for more details Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 18
  • 19. XSS Attacks Cross-site scripting (aka CSS) • Malicious script tricks user’s browser into thinking it comes from a trusted source • Can access cookies, security tokens, etc, as fully trusted Example: • • comment site allows full HTML • comment is on same site, so can access cookies etc defined by that site, including, e.g., login info attacking comment includes javascript that runs when victim loads the page Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 19
  • 20. Variations of XSS • Attacker crafts query URI and cons the victim into clicking on it from email • Attacker (mis)uses some HTML element • • • • • script element, to load external script add onload attribute to body element put a script in the src attribute of an img element put script in rel=“stylesheet” attribute of link element put script in background attribute of table element Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 20
  • 21. Preventing XSS Attacks Multi-layer prevention is best • only allow characters that make sense in the context • • e.g., don't allow input into a script don't allow non-printable characters in name fields • • ensure input data can't change the HTML DOM tree • consider escaping all “special” characters with the right character or numeric entity (ASCII code under 256) • escape JavaScript, CSS, and URIs appropriately escape all HTML/XML significant characters with entities, e.g., < Check the OWASP XSS Prevention Cheat Sheet Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 21
  • 22. WordPress Basic security for WordPress sites: http://codex.wordpress.org/Hardening_WordPress (go to codex.wordpress.org and follow the links) Data validation: http://codex.wordpress.org/Data_Validation Check plugins and themes to see if they use the right functions Other systems (Drupal, etc) have similar functions Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 22
  • 23. CSRF Attacks Cross-Site Request Forgery • • • victim is logged in somewhere attacker convinces victim to run a script script action is carried out, since victim is logged in Prevention • • add a random token to forms in a hidden field for WordPress, use wp_nonce functions (e.g. at http://crunchify.com/how-to-secure-your-wordpress-pluginprevent-csrf-vulnerability/) Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 23
  • 24. While you're on the web Good measures to not become a victim • • load up your main browser with prevention plugins • • • use that browser for important sites consider using NoScript or other XSS warning plugin/extension (http://noscript.net/faq#qa4_2) log out of your bank site when you're finished use a different browser for random surfing Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 24
  • 25. Langara Computer Tech Meetup February 21, 2014 Simple Principles for Website Security Lauren Wood lauren@textuality.com slideshare.net/laurendw Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 25 25