Cert Secure Coding Standards
Cert Secure Coding Standards
Robert C. Seacord
Announcements
Assignment #3 Should be graded today and returned tomorrow (or Wednesday at the latest). Im presenting at NASA on Wednesday, so Chad will be giving the lecture on Protecting Sensitive Data Final will be Tues. May 13 01:00pm-04:00pm room BH A53 The deadline for submissions of corrected Assignment #1 is midnight, Thursday May 1st (11:59PM), same as assignment #4. If you submitted a corrected version your Assignment #1, please resubmit it to Chad, [email protected] who may have inadvertently deleted a few resubmissions. The University Course Assessment is open for Spring Semester courses through Monday, May 5 at 8 a.m. It is important that you provide feedback. Link to the Carnegie Mellon portal at https://my.cmu.edu/site/main/page.academics and click on University Course Assessment under Courses
2
Assignment #4
Students should turn in the following:
their checker function (eg any checker functions they write) any additional compliant & non-compliant code examples they choose to write. A document saying what weaknesses their function has (eg what cases does it NOT handle?)
Assignment #4
Your code does not need to handle EVERY possible case, but it should handle at least one pair of compliant and noncompliant code examples in each rule. They could turn in their assignment by emailing me a ZIP file or tarball. Or, if they have no extra examples, they could send me a single C++ file of their code (eg POS.C if they implemented POS34-C). Do not implement a checker on EXP09-A because the "Working with Rose" slides contains a complete implementation and design.
Scope
The secure coding standards proposed by CERT are based on documented standard language versions as defined by official or de facto standards organizations. Secure coding standards are under development for:
C programming language (ISO/IEC 9899:1999) C++ programming language (ISO/IEC 14882-2003 )
Applicable technical corrigenda and documented language extensions such as the ISO/IEC TR 24731 extensions to the C library are also included.
www.securecoding.cert.org
Rules
Coding practices are defined to be rules when all of the following conditions are met:
Violation of the coding practice is likely to result in a security flaw that may result in an exploitable vulnerability. There is a denumerable set of conditions for which violating the coding practice is necessary to ensure correct behavior. Conformance to the coding practice can be determined through automated analysis, formal methods, or manual inspection techniques.
Conformance to secure coding rules must be demonstrated to claim compliance with this standard unless an exceptional condition exists. If an exceptional condition is claimed, the exception must correspond to a predefined exceptional condition and the application of this exception must be documented in the source code.
Recommendations
Recommendations are guidelines or suggestions. Coding practices are defined to be recommendations when all of the following conditions are met:
Application of the coding practice is likely to improve system security. One or more of the requirements necessary for a coding practice to be considered a rule cannot be met.
Compliance with recommendations is not necessary to claim compliance with this standard. It is possible, however, to claim compliance with recommendations (especially in cases in which compliance can be verified). The set of recommendations that a particular development effort adopts depends on the security requirements of the final software product. Projects with high-security requirements can dedicate more resources to security and are thus likely to adopt a larger set of recommendations.
Threaded discussions used for public vetting Candidate coding practices are moved into a secure coding standard when consensus is reached
10
L2 P6-P9
L3 P1-P4
11
12
Examples of vulnerabilities resulting from the violation of this recommendation can be found on the CERT website .
13
Train software professionals Certify programmers Establish requirements for software analysis tools Certify software systems
14
15
Tool-generated, hand-maintained
code that is specified and maintained in a higher level format, from which language-specific source code is generated. It is expected or anticipated, however, that at some point in the development cycle the tool will cease to be used and the generated source code will be visually inspected and/or manually modified and maintained.
Hand-coded-code
has been manually written by a programmer using a text editor or interactive development environment in which the programmer maintains source code directly in the source code format provided to the compiler.
16
Hand-coded-code
Source code that is written and maintained by hand must have the following properties:
readability program comprehension
These requirements are not applicable for source code that is never directly handled by a programmer, although requirements for correct behavior still apply. Reading and comprehension requirements apply to code that is tool-generated and hand-maintained but does not apply to code that is tool-generated and tool-maintained. Tool-generated, tool-maintained code can impose consistent constraints that ensure the safety of some constructs that are risky in hand-generated code.
17