The CERT C Coding Standard, Second Edition
Secure programming in C can be more difficult than even many experienced programmers realize. To help programmers write more secure code, The CERT C Coding Standard, Second Edition, fully documents the second official release of the CERT standard for secure coding in C. The rules laid forth in this new edition help programmers ensure that their code fully complies with the new C11 standard; it also addresses earlier versions, including C99.
The new standard itemizes coding errors that are the root causes of current software vulnerabilities in C, prioritizing them by severity, likelihood of exploitation, and remediation costs. Each of the text's 98 guidelines includes examples of insecure code as well as secure, C11-conforming, alternative implementations. If uniformly applied, these guidelines eliminate critical coding errors that lead to buffer overflows, format-string vulnerabilities, integer overflow, and other common vulnerabilities.
Author Robert C. Seacord covers all aspects of the new standard, including best solutions, compliant solutions, and pertinent language and library extensions. He also offers advice on issues ranging from tools and testing to risk assessment.
This book reflects numerous experts' contributions to the open development and review of the rules and recommendations that comprise this standard. Coverage includes proprocessor, declarations and initialization, expressions, integers, floating point, arrays, characters and strings, memory management, input/output, environment, signals, error handling, concurrency, and miscellaneous issues.
Read the book's preface to learn more about the book and if it will meet your needs.
In Accessing Shared Atomic Objects from within a Signal Handler in C, an informIT article from April 2014, Robert Seacord describes how accessing shared objects in signal handlers can result in race conditions that can leave data in an inconsistent state.
Related Training, Products, and Tools
Secure Coding in C and C++ Training Course
This four-day course provides a detailed explanation of common programming errors in C and C++ and describes how these errors can lead to code that is vulnerable to exploitation. The course concentrates on security issues intrinsic to the C and C++ programming languages and associated libraries. The intent is for this course to be useful to anyone involved in developing secure C and C++ programs regardless of the specific application.
Secure Coding Training Course
An ongoing development effort in collaboration with the Software Engineering Institute's CERT Division, this course focuses on common security issues in C and C++ development. With security expert Robert Seacord serving as lead content author, the course addresses a key need in professional education for software developers. Topics to be covered include the secure and insecure use of integers, arrays, strings, dynamic memory, formatted input/output functions, and file I/O. Continued development is being funded by partnerships with industry.
Source Code Analysis Laboratory (SCALe)
SCALe consists of commercial, open source, and experimental analysis that is used to analyze various code bases, including those from the DoD, energy delivery systems, medical devices, and more. SCALe provides value to the customer, but it also aids research into the effectiveness of coding rules and analysis.
The CERT Division's Rosecheckers tool performs static analysis on C/C++ source files. It is designed to enforce the rules in the CERT C Coding standard.
Integer Security Tool
The CERT Division's Secure Coding researchers are working on a number of solutions for addressing the issue of integer security, including our prototype tool and a secure integer library.