Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.

Slides:



Advertisements
Similar presentations
OWASP Secure Coding Practices Quick Reference Guide
Advertisements

Composition CMSC 202. Code Reuse Effective software development relies on reusing existing code. Code reuse must be more than just copying code and changing.
LV2IDL, a software package for automatic data transfer between LabVIEW and IDL Gelu M. Nita New Jersey Institute of Technology.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Principles of Computer Security: CompTIA Security + ® and Beyond, Third Edition © 2012 Principles of Computer Security: CompTIA Security+ ® and Beyond,
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
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 Issues and Challenges in Cloud Computing
Stack-Based Buffer Overflows Attacker – Can take over a system remotely across a network. local malicious users – To elevate their privileges and gain.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
It’s always better live. MSDN Events Security Best Practices Part 2 of 2 Reducing Vulnerabilities using Visual Studio 2008.
Information Networking Security and Assurance Lab National Chung Cheng University The Ten Most Critical Web Application Security Vulnerabilities Ryan J.W.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Information Networking Security and Assurance Lab National Chung Cheng University 1 Top Vulnerabilities in Web Applications (I) Unvalidated Input:  Information.
ASP.NET 2.0 Chapter 6 Securing the ASP.NET Application.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
ASP.NET Programming with C# and SQL Server First Edition
Security in SQL Jon Holmes CIS 407 Fall Outline Surface Area Connection Strings Authenticating Permissions Data Storage Injections.
Jonas Thomsen, Ph.d. student Computer Science University of Aarhus Best Practices and Techniques for Building Secure Microsoft.
Dec 13 th CS555 presentation1 Yiwen Wang --“Securing the DB may be the single biggest action an organization can take to protect its assets” David C. Knox.
Designing Security In Web Applications Andrew Tomkowiak 10/8/2013 UW-Platteville Software Engineering Department
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
Review of C++ Programming Part II Sheng-Fang Huang.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
OWASP Zed Attack Proxy Project Lead
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
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 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Copyright 2007 © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
State Management. What is State management Why State management ViewState QueryString Cookies.
Computer Security and Penetration Testing
Software Security Testing Vinay Srinivasan cell:
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Oracle Application Express Security. © 2009 Oracle Corporation Authentication Out-of-the-Box Pre-Configured Schemes LDAP Directory credentials Oracle.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
© Wiley Inc All Rights Reserved. MCSE: Windows Server 2003 Active Directory Planning, Implementation, and Maintenance Study Guide, Second Edition.
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
OWASP Top Ten #1 Unvalidated Input. Agenda What is the OWASP Top 10? Where can I find it? What is Unvalidated Input? What environments are effected? How.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Effective Security in ASP.Net Applications Jatin Sharma: Summer 2005.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Pointers OVERVIEW.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
ADO.NET AND STORED PROCEDURES - Swetha Kulkarni. RDBMS ADO.NET Provider  SqlClient  OracleClient  OleDb  ODBC  SqlServerCE System.Data.SqlClient.
Security Issues with PHP  PHP installation  PHP programming Willa Zhu & Eugene Burger.
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.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
1 Classes II Chapter 7 2 Introduction Continued study of –classes –data abstraction Prepare for operator overloading in next chapter Work with strings.
Security Attacks Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
Programming Fundamentals1 Chapter 7 INTRODUCTION TO CLASSES.
ASP.NET 2.0 Security Alex Mackman CM Group Ltd
Chapter 29: Program Security Dr. Wayne Summers Department of Computer Science Columbus State University
Secure Coding Rules for C++ Copyright © 2016 Curt Hill
Content Coverity Static Analysis Use cases of Coverity Examples
SE-1021 Software Engineering II
SQL Server Security & Intrusion Prevention
CMSC 345 Defensive Programming Practices from Software Engineering 6th Edition by Ian Sommerville.
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
SQL INJECTION ATTACKS.
Security mechanisms and vulnerabilities in .NET
Secure Coding Rules for C++ Copyright © Curt Hill
Designing IIS Security (IIS – Internet Information Service)
Presentation transcript:

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation OWASP Secure Coding Fundamentals Richard Lewis Tech Mahindra Ltd June 24th 2006

OWASP 2 Session Contents  Secure Code Characteristics  Costs of Insecure Coding  Threats to Code  Secure Coding – General Principles  Secure Coding – C and C++  Secure Coding – ASP.NET  Secure Coding – Java  Summary

OWASP 3 Defining Secure Coding  Secure code must have the following properties SECURESECURE eamless ognizant of attacks asy to Understand nobtrusive esilient rror Tolerant

OWASP 4 Genesis of a Secure Application Slide taken from Security Engineering for Software, Dimitry Averin “Secure” Application Robust Programming Practices Good design and coding practices Design and implementation of security features. From the Requirements

OWASP 5 Cost of Insecure Code  Spot the difference WCHAR wcsAttribute[200]; if ( cchAttribute >= sizeof wcsAttribute) THROW( CException( DB_E_ERRORSINCOMMAND ) ); DecodeURLEscapes( (BYTE *) pszAttribute, cchAttribute, wcsAttribute,web- Server.CodePage()); WCHAR wcsAttribute[200]; if ( cchAttribute >= sizeof wcsAttribute THROW( CException( DB_E_ERRORSINCOMMAND ) ); DecodeURLEscapes( (BYTE *) pszAttribute, cchAttribute, wcsAttribute,web- Server.CodePage()); / sizeof WCHAR) Damages: Network costs = $1.2 billion Affected 360,000 servers Productivity cost = $750 million

OWASP 6 Threats to Code  We, the programmers  Bad Inputs (and Outputs)  API Abuse  Environment and Configuration  Time and State

OWASP 7 Secure Coding – General Principles  Validate inputs and outputs FLTR principle – Format, Length, Type, Range  Reduce attack surface Running Code Entry Points (UI, ports, files, database, API calls) Reduce Privilege  Operate at least privilege Open files/registry with required access rights Don’t write data in protected portions of the Operating System  Apply Defense-in-depth Use gatekeeper paradigm  Use APIs correctly String functions in C, Java,.NET  Detect attacks and fail securely Phishing attacks  Observe vendor’s recommendations

OWASP 8 Secure Coding – C and C++  Ensure that input is bounded – Prevents buffer overflow attacks char buf [64], memcpy(buf, user input, sizeof(user input));  Use variadic functions properly – Prevents format string attacks. printf(string) printf(“%s”,string)  Check for integer overflow  Ensure proper memory management  Free data allocated on the heap/free store  Avoid double free. Zero the pointer after the first free.  Don’t mix new, delete with calloc,free  Don’t store secrets in memory allocated with realloc  Don’t forget the [ ] operator when deleting arrays

OWASP 9 Secure Coding – ASP.NET  Don’t hard-code passwords in code or in Web.config / Machine.config Use aspnet_setreg.exe to store encrypted credentials in the registry.  Validate input automatically Use validateRequest=true.  Dynamic SQL Creation "SELECT * FROM items WHERE owner = '" + userName + "' AND itemname = '" + ItemName.Text + "'"; What if "name' OR 'a'='a" is passed for itemname? SELECT * FROM items WHERE owner = 'wiley' AND itemname = 'name' OR 'a'='a'; This maps to: SELECT * FROM items;  Strong-name assemblies Use strong name as evidence for running assemblies  Implement custom-error pages Make changes to the customErrors element in the Web.config. Configure to show detailed messages to local users only.  Protect the ViewState Difference between using ViewStateEncryptionMode and SSL  Set the HttpOnly option for cookies Prevents cookie-stealing scripts from reading the cookie

OWASP 10 Secure Coding – Java  Avoid using inner classes Compiler translates the class and private variables to package scope access. Make private if required.  Don’t compare classes by name. Use class equality instead. Malicious code could be running with the same name  “Turn off” cloning by implementing clone() and making it final Attacker could instantiate your class without a constructor.  “Turn off” serialisation by implementing writeObject() it and making it final Attacker could instantiate your class without a constructor.  Seal your Java packages Prevents attackers from adding a class to the package  Don’t return references to mutable objects Prevents attackers from changing the internal state of the object.

OWASP 11 Thank you!