Secure Coding Frameworks for the Development of Safe, Secure and Reliable Code

Secure Coding Frameworks for the Development of Safe, Secure and Reliable Code

Building Cybersecurity from the Ground Up Secure Coding Frameworks For the Development of Safe, Secure and Reliable Code Tim Kertis October 2015 The 27 th Annual IEEE Software Technology Conference Copyright © 2015 Raytheon Company. All rights reserved. Customer Success Is Our Mission is a registered trademark of Raytheon Company. Who Am I? Tim Kertis, Software Engineer/Software Architect Chief Software Architect, Raytheon IIS, Indianapolis Master of Science, Computer & Information Science, Purdue Software Architecture Professional through the Software Engineering Institute (SEI), Carnegie-Mellon University (CMU) 30 years of diverse Software Engineering Experience Advocate for Secure Coding Frameworks (SCFs) Author of the JAVA Secure Coding Framework (JSCF) Inventor of Cybersecurity thru Lexical And Symbolic Proxy (CLaSP) technology (patent pending) Secure Coding Frameworks 10/22/2015 2 Top 5 Cybersecurity Concerns … 1 - Application According to the 2015 ISC(2) Vulnerabilities Global Information Security 2 - Malware Workforce Study (Paresh 3 - Configuration Mistakes Rathod) 4 - Mobile Devices 5 - Hackers Secure Coding Frameworks 10/22/2015 3 Worldwide Market Indicators 2014 … Number of Software Total Cost of Cyber Crime: Developers: $500B (McCafee) 18,000,000+ (www.infoq.com) Cost of Cyber Incidents: Number of Java Software Low $1.6M Developers: Average $12.7M 9,000,000+ (www.infoq.com) High $61.0M (Ponemon Institute) Software with Vulnerabilities: 96% (www.cenzic.com) Secure Coding Frameworks 10/22/2015 4 Research Conducted SEI Secure Coding Top 10 Programming Standard Languages – Rules and Recommendations – C, C++, C#, Objective-C, Java, – Priorities and Levels JavaScript, Perl, PHP, Python, – Vulnerabilities and Remedies VB – Primitives, Operators and Common Weakness Standard Libraries Enumeration (CWE) The Ada Programming – Common Software Weaknesses Language Open Web Application – Range Constraints Security Project (OWASP) – Real-Time Constructs – Language-Agnostic/ Framework-Agnostic Developer Guide Secure Coding Frameworks 10/22/2015 5 SEI CERT Coding Standards Overview Website – This site supports the development – https://www.securecoding.cert.or of coding standards for commonly g/confluence/display/seccode/SE used programming languages such I+CERT+Coding+Standards as C, C++, Java, and Perl, and the Android TM platform. – These standards are developed through a broad-based community effort by members of the software development and software security communities. Secure Coding Frameworks 10/22/2015 6 SEI Secure Coding Standard for Java Rules Recommendations – 00 Input Validation and Data Sanitization (IDS) – 00 Input Validation and Data Sanitization (IDS) – 01 Declarations and Initialization (DCL) – 01 Declarations and Initialization (DCL) – 02 Expressions (EXP) – 02 Expressions (EXP) 03 Numeric Types and Operations (NUM) – 03 Numeric Types and Operations (NUM) – 04 Characters and Strings (STR) – 04 Characters and Strings (STR) – 05 Object Orientation (OBJ) – 05 Object Orientation (OBJ) – 06 Methods (MET) – 06 Methods (MET) – 07 Exceptional Behavior (ERR) – 07 Exceptional Behavior (ERR) – 08 Visibility and Atomicity (VNA) – 13 Input Output (FIO) – 09 Locking (LCK) – 15 Platform Security (SEC) – 10 Thread APIs (THI) – 18 Concurrency (CON) – 11 Thread Pools (TPS) – 49 Miscellaneous (MSC) – 12 Thread-Safety Miscellaneous (TSM) – 13 Input Output (FIO) – AA References – 14 Serialization (SER) – BB Definitions – 15 Platform Security (SEC) – CC Analyzers – 16 Runtime Environment (ENV) – 17 Java Native Interface (JNI) – 49 Miscellaneous (MSC) – 50 Android (DRD) Secure Coding Frameworks 10/22/2015 7 Rule 03: Numeric Types and Operations (NUM) Rules NUM00-J. Detect or prevent integer overflow – NUM01-J. Do not perform bitwise and arithmetic operations on the same data – NUM02-J. Ensure that division and remainder operations do not result in divide-by-zero errors – NUM03-J. Use integer types that can fully represent the possible range of unsigned data – NUM04-J. Do not use floating-point numbers if precise computation is required – NUM07-J. Do not attempt comparisons with NaN – NUM08-J. Check floating point inputs for exceptional values – NUM09-J. Do not use floating point numbers as loop counters – NUM10-J. Do not construct BigDecimal objects from floating-point literals – NUM11-J. Do not compare or inspect the string representation of floating-point values – NUM12-J. Ensure conversions of numeric types to narrower types do not result in lost or misinterpreted data – NUM14-J. Use shift operators correctly Secure Coding Frameworks 10/22/2015 8 NUM00-J. Detect or prevent integer overflow Programs must not allow The built-in integer operators do mathematical operations to not indicate overflow or exceed the integer ranges underflow in any way . provided by their primitive integer Integer operators can throw a data types. According to The Java NullPointerException if unboxing Language Specification (JLS), conversion of a null reference is §4.2.2, "Integer Operations" [JLS required. 2015 ]: Other than that, the only integer operators that can throw an exception are the integer divide operator / and the integer remainder operator %, which throw an ArithmeticException if the right-hand operand is zero, and the increment and decrement operators ++ and -- which can throw an OutOfMemoryError if boxing conversion is required and there is insufficient memory to perform the conversion. Secure Coding Frameworks 10/22/2015 9 Root Cause Analysis & Resolution Issue Conclusion – Integer Overflow/Underflow is Ignored – Integer overflow/underflow indicator bits (in Java) provided in IEEE 754 are ignored in the Java Programming Language Possible Root Cause Specification – Java Application Source Code – Java has flaws in INT primitive and – Java Programming Language operators +, -, *, /, >>>, >>, <<, etc. Implementation – Java Programming Language Resolution(s) Specification – Use an infinitely ranged integer – Java Virtual Machine Implementation – Raise a run-time constraint violation – Java Virtual Machine Specification – Integer Math Processor Unit SEI provides a full discussion of the – IEEE Standard 754 Integer vulnerability and remedy in: As-If Infinitely Ranged Integer Model, Second Edition, April 2010 Secure Coding Frameworks 10/22/2015 10 Top 10 Programming Languages TIOBE Index (2015) PYPL Index (2014) – #1 Java (19.565%) – #1 Java (25.5%) – #3 C++ (15.621%) – #2 PHP (11.4%) – #4 C# (6.782%) – #3 Python (11.1%) – #5 Python (3.664%) – #4 C# (9.2%) – #6 PHP (2.530%) – #5 C++ (7.7%) – #7 JavaScript (2.342%) – #6 JavaScript (7.3%) – #8 VB .NET (2.062%) – #7 Objective-C (5.3%) – #9 Perl (1.899%) – #13 VB .NET (2.1%) – #10 Objective-C (1.821%) – #15Perl (1.3%) http://www.tiobe.com/index.php/content/paper https://sites.google.com/site/pydatalog/pypl/pyt info/tpci/index.html hon-blog/pythonisthelanguageoftheyear … based on number of web page references. … based on number of Google searches. Secure Coding Frameworks 10/22/2015 11 Conclusions The following problems were diagnosed as Programming Language the root cause of the majority of cybersecurity vulnerability types (and Weaknesses safety/reliability issues) in software – Lack of user-defined range constraints applications: and subsequent bounds checking on numeric data types to support input Programming Language validation Flaws – Lack of bounds checking on array – Silent integer underflow/overflow in indexing resulting in buffer overflow math operations – Lack of adequate built-in memory – Silent floating point floors/ceilings in management of primitives to eliminate math operations null pointer dereferencing – Silent loss of magnitude, sign and/or Standard Library precision in numeric type casts Weaknesses – Lack of specialized strings for filtering and validating characters and sequences in character stings (filenames, database names, SQL, URL, HTTP, LDAP, XSS, etc.) Secure Coding Frameworks 10/22/2015 12 The Secure Coding Framework Problem: Solution: Mainstream programming languages Provide developers with a Secure have significant security Coding Framework (SCF) protecting vulnerabilities and weaknesses and against the programming language’s their component libraries also have inherent security vulnerabilities and weaknesses that can be exploited component library flaws and/or misuse To remedy this, developers can apply Replace (by wrapping) primitives and static analysis tools and rework operators with secure classes and software in accordance with the SEI methods Secure Coding Standards Use the SCF to simplify and expedite Developing secure code this way can the development of safe, secure and be prohibitively difficult and expensive reliable code Mainstream programming languages Provide developers with a platform for were not designed for the the development of safe, secure and development of secure applications reliable software applications from the ground up Secure Coding Frameworks 10/22/2015 13 Mainstream Programming Language Lexical vs. JSCF Class Substitute … Lexical (Primitives): Classes: byte, byte[] SecureByte, SecureByteArray char, char[] SecureCharacter, short, short[] SecureCharacterArray int, int[] SecureShort, SecureShortArray long, long[] SecureInteger, SecureIntegerArray float, float[] SecureLong, SecureLongArray double, double[] SecureFloat, SecureFloatArray String (class) SecureDouble, SecureDoubleArray SecureString, SecureSQLString, SecureURLString, etc. Secure Coding Frameworks 10/22/2015 14

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    27 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us