SlideShare una empresa de 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

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 

Destacado

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
 

Destacado (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 ...
 

Similar 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
 
How the SSL/TLS protocol works (very briefly) How to use HTTPS
How the SSL/TLS protocol works  (very briefly) How to use HTTPSHow the SSL/TLS protocol works  (very briefly) How to use HTTPS
How the SSL/TLS protocol works (very briefly) How to use HTTPSwhj76337
 
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
 

Similar 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 )
 
How the SSL/TLS protocol works (very briefly) How to use HTTPS
How the SSL/TLS protocol works  (very briefly) How to use HTTPSHow the SSL/TLS protocol works  (very briefly) How to use HTTPS
How the SSL/TLS protocol works (very briefly) How to use HTTPS
 
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
 

Último

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Último (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

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