Krishna Mohan Koyya Glarimy Technology Services

Slides:



Advertisements
Similar presentations
Nick Feamster CS 6262 Spring 2009
Advertisements

The OWASP Foundation Web Application Security Host Apps Firewall Host Apps Database Host Web serverApp serverDB server Securing the.
0 The Past, Present and Future of XSS Defense Jim Manico 2011 OWASP Brussels.
I'll see your cross site scripting and raise you a Content Security Policy Lou Leone :: Rochester OWASP.
EECS 354 Network Security Cross Site Scripting (XSS)
Blackbox Reversing of XSS Filters Alexander Sotirov ekoparty 2008.
IDAsec copyright - all rights reserved1 Web Vulnerabilities in the real world.
It’s always better live. MSDN Events Security Best Practices Part 2 of 2 Reducing Vulnerabilities using Visual Studio 2008.
Web Security Model CSE 591 – Security and Vulnerability Analysis Spring 2015 Adam Doupé Arizona State University
Introduction to the OWASP Top 10. Cross Site Scripting (XSS)  Comes in several flavors:  Stored  Reflective  DOM-Based.
CROSS SITE SCRIPTING..! (XSS). Overview What is XSS? Types of XSS Real world Example Impact of XSS How to protect against XSS?
Injection Attacks by Example SQL Injection and XSS Adam Forsythe Thomas Hollingsworth.
 A cookie is a piece of text that a Web server can store on a user's hard disk.  Cookie data is simply name-value pairs stored on your hard disk by.
Introduction to InfoSec – Recitation 10 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Workshop 3 Web Application Security Li Weichao March
Cosc 4765 Server side Web security. Web security issues From Cenzic Vulnerability report
Origins, Cookies and Security – Oh My! John Kemp, Nokia Mobile Solutions.
Prevent Cross-Site Scripting (XSS) attack
WEB SECURITY WEEK 3 Computer Security Group University of Texas at Dallas.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
BLUEPRINT: Robust Prevention of Cross-site Scripting Attacks for Existing Browsers Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago.
© All rights reserved. Zend Technologies, Inc. PHP Security Kevin Schroeder Zend Technologies.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. 1 RubyJax Brent Morris/
Chapter 6 Server-side Programming: Java Servlets
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program.
Building Secure Web Applications With ASP.Net MVC.
University of Central Florida The Postman Always Rings Twice: Attacking & Defending postMessage in HTML5 Websites Ankur Verma University of Central Florida,
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
Safe browsing - is an ad-blocker extension enough? AIMILIOS TSOUVELEKAKIS IT-DI-CSO IT LIGHTNING TALK – 12/
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflow Analysis of Buffer Overflow Attacks.
Front end (user interfaces) Facilitating the user‘s interaction with the SandS services and processes I. Mlakar, D. Ceric, A. Lipaj Valladolid, 17/12/2014.
Securing Angular Apps Brian Noyes
CSRF Attacks Daniel Chen 11/18/15. What is CSRF?  Cross Site Request Forgery (Sea-Surf)  AKA XSRF/ One Click / Sidejacking / Session Riding  Exploits.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
Browser code isolation John Mitchell CS 155 Spring 2016.
By Collin Donaldson. Hacking is only legal under the following circumstances: 1.You hack (penetration test) a device/network you own. 2.You gain explicit,
Page 1 Ethical Hacking by Douglas Williams. Page 2 Intro Attackers can potentially use many different paths through your application to do harm to your.
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
SECURE DEVELOPMENT. SEI CERT TOP 10 SECURE CODING PRACTICES Validate input Use strict compiler settings and resolve warnings Architect and design for.
Web Security (cont.) 1. Referral issues r HTTP referer (originally referrer) – HTTP header that designates calling resource  Page on which a link is.
How Angular Protects Us From XSS Attacks? XSS (Cross-Site Scripting) is one of the assaults that can influence your site. So as to adapt to the attack,
Introduction to Information Security
NodeJS Security Using PassportJS and HelmetJS:
An Introduction to Web Application Security
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
TOPIC: Web Security (Part-4)
World Wide Web policy.
API Security Auditing Be Aware,Be Safe
What is REST API ? A REST (Representational State Transfer) Server simply provides access to resources and the REST client accesses and presents the.
Cross-Site Forgery
Less Known Web Application Vulnerabilities
Browser code isolation
Riding Someone Else’s Wave with CSRF
CSC 495/583 Topics of Software Security Intro to Web Security
WWW安全 國立暨南國際大學 資訊管理學系 陳彥錚.
HTTP Security Headers Explained
Cross Site Request Forgery New Attacks and Defenses
Client-Server Model: Requesting a Web Page
Cross-Site Scripting Attack (XSS)
Cross Site Request Forgery (CSRF)
Presentation transcript:

Krishna Mohan Koyya Glarimy Technology Services

Security with AngularJS Web Security Model Content Security Policy Sanitzation Strict Contextual Escaping Cross-Site Request Forgery Expression Sandboxing

Web Security Model Same Origin Policy (SOP) Code from a specific domain can access only resources from the same domain can not access SOP is the basis for Web Security Model Cross Site Scripting (XSS) is a trick to violate SOP A dynamically added tag can access any resource Dynamic Templates exposes this kind of risks Content Security Policy (CSP) is a guard against XSS White-listing or black-listing resources Preventing/controlling inline code execution Encoding and etc., A must for security, but may not be just sufficient

Content Security Policy White-listing the sources Provide a direction to the browser about trusted sources Some-of the CSP Directives script-src, connect-src, child-src and etc., Keywords: none, self, unsafe-inline, unsafe-eval The Best Practices Avoid eval, inline styles, inline scripts and etc., Applying CSP: HTTP Header: Content-Security-Policy HTML Meta Tag:

AngularJS support for CSP The Angular Directive: ng-csp Usually while declaring ng-app Enables CSP mode of Angular implementation Forbids use of eval and Function constructors Execution is 30% slower Performance Vs Security Forbids use of inline stylesheet rules ng-show, ng-hide fails to work The stylesheets needs to be added manually ng-csp NOT APPLICABLE to your own code The eval and other continue to work in your own code The normal CSP directives should take care of them

AngularJS support for CSP Security | AngularJS | Glarimy <linkhref=' rel='stylesheet'> AngularJS Services var app = angular.module(‘app’, []); App.controller(‘ctrl’, function($scope)){ $scope.show = false; });

Sanitization in AngularJS HTML Sanitization Supported by ngSanitization module Needs to be downloaded the.js file separately $sanitize(markup) returns the sanitized string Removes the inline code Removes the inline styling Directives ng-bind automatically escapes the value ng-bind-html automatically sanitizes the value Needs to be trusted (using SCE) to get original HTML If really needed! JSON-P Response with “)]}',\n” Angular safely handles the response

Contextual Escaping in AngularJS Strict Contextual Escaping $sce is a service that provides strict contextual escaping Trusted contexts and corresponding methods HTML – trustAsHtml() CSS – trustAsCss() JS – trustAsJs() URL – trustAsUrl() RESOURCE_URL – turstAsResourceUrl() Can be disabled, but not suggested! angular.module(‘app', []).config( function($sceProvider) { $sceProvider.enabled(false); });

Contextual Escaping in AngularJS The Markup The Script var app = angular.module("app", [ 'ngSanitize' ]); app.controller("ctrl", function($scope, $sanitize, $sce) { $scope.html = " Contact Us "; $scope.risky = $sce.trustAsHtml($scope.html); });

Cross-Site Request Forgery The Problem Unauthorized commands to a server that trusts the client The Solution The server generates a CSRF Token and sends to the client By setting in the cookie As a hidden field in a form page The client receives the token Records the token Sends it back to the server via an HTTP header in PUT/DELETE/POST requests The server processes the header Reads the HTTP header Compares it to the known CSRF Token for that session Allows the request to go through if it matches. AngularJS $http built-in Token: X-XSRF-TOKEN