Overview
ISO/IEC TS 17961:2013 - C secure coding rules - is an international Technical Specification that defines a catalogue of enforceable secure-coding rules for the C programming language. Its purpose is to provide a minimum, machine-checkable set of rules (designed for static analysis) that detect language constructs commonly associated with security vulnerabilities. The document does not mandate a coding style or an enforcement mechanism; instead it targets analyzers (static analysis tools), compiler vendors, and toolchains that wish to issue diagnostics for insecure C code.
Each rule is illustrated with noncompliant examples (expected to elicit a diagnostic) and compliant examples (not expected to elicit a diagnostic), helping implementers and developers understand precise, testable behavior.
Key Topics
- Scope and conformance: Rules are intended to be enforceable by static analysis; conformance requires that violations produce diagnostics from a complying analyzer.
- Practical rule set: The specification enumerates many concrete rules addressing real-world flaws, including (selection):
- Accessing freed memory, null or out-of-domain pointers, and uninitialized memory
- Buffer and pointer bounds violations, insufficient memory allocation
- Integer overflow, division errors, and signed/unsigned conversions
- Unsafe use of standard library functions, format-string vulnerabilities, tainted input handling
- Signal-safety issues, improper use of errno, file/stream misuses, double free
- Examples and identifiers: Every rule has a unique identifier (e.g., [ptrcomp], [dblfree]) and paired code examples to reduce ambiguity.
- Annexes: Informative material covers interprocedural analysis considerations, undefined behavior, related guidelines/references, and decidability of rules.
Applications
- Static Application Security Testing (SAST): Integrate ISO/IEC TS 17961 rules into SAST tools to reliably detect security-relevant C defects.
- Compiler diagnostics: Compiler and tool vendors can adopt the rules to provide standardized security warnings.
- Secure development lifecycle (SDL): Use the specification as a baseline for secure-coding policies, code review checklists, and automated CI gates.
- Procurement and compliance: Specify conformance to TS 17961 in contracts or security requirements to ensure minimum analyzer coverage.
- Training and auditing: Teach developers concrete unsafe patterns and provide auditors with objective criteria for assessment.
Who Should Use It
- C developers and architects aiming to reduce exploitable defects
- Security engineers and QA teams integrating static analysis into CI/CD
- Tool and compiler vendors implementing secure-coding diagnostics
- Auditors and procurement officers defining security requirements
Related Standards
- Complements language standard (ISO/IEC 9899 C) and other secure-coding guidelines such as CERT C and MISRA C; see Annex C of TS 17961 for references.
Keywords: ISO/IEC TS 17961:2013, C secure coding rules, static analysis, secure coding in C, SAST, C vulnerabilities, secure-coding standard.