Secure by Design Alert: Eliminating Buffer Overflow Vulnerabilities
Secure by Design Alert: Eliminating Buffer Overflow Vulnerabilities
This document is marked TLP:CLEAR. Disclosure is not limited. Sources may use TLP:CLEAR when information carries minimal or no
foreseeable risk of misuse, in accordance with applicable rules and procedures for public release. Subject to standard copyright
rules, TLP:CLEAR information may be distributed without restriction. For more information on the Traffic Light Protocol, see
cisa.gov/tlp.
TLP:CLEAR
CVE-2023-6549
CVE-2022-0185
The authoring agencies urge manufacturers to take immediate action to prevent these vulnerabilities from being
introduced into their products. Manufacturers can prevent buffer overflow vulnerabilities by using the secure by design
practices listed in this Alert. Software manufacturer senior executives and business leaders should ask their product and
development teams to document past buffer overflow vulnerabilities and how they are working to eliminate this class of
defect.
CISA and FBI also recommend that software customers ensure manufacturers demonstrate adherence to the safe
software development practices contained in this Alert by requesting that manufacturers provide a Software Bill of
Materials (SBOM) and a secure software development attestation. 4
To prevent buffer overflow vulnerabilities, technical leaders should implement the following secure by design practices.
(Note: This is not a comprehensive list of methodologies for mitigating and preventing buffer overflow vulnerabilities but
contains those CISA identified as the most effective and feasible.)
Where feasible, use memory-safe languages when developing software to shift the burden of memory
management from the developer to the programming language’s built-in safety features. 5
Note: It is possible to disable or override the memory safety guarantees of some memory-safe languages;
developers must avoid doing so to prevent buffer overflow vulnerabilities. Also, using a memory-safe language for
one part of a software package does not fix memory-unsafe code in other libraries.
○ The authoring agencies recognize there is significant effort required to rewrite codebases in memory-safe
languages. Therefore, we recommend manufacturers develop and implement a phased transition plan for
increasing memory-safe language usage. Ideally, this plan should include using memory-safe languages to
develop new code and—over time and when feasible—transition their software’s most highly
privileged/exposed code to memory-safe languages. 6 While transitioning to memory-safe languages,
manufacturers should also consider leveraging technologies to limit memory safety vulnerabilities in their
existing code bases.
Enable compiler flags that implement compile time and runtime protections against buffer overflows 7 (to the
maximum extent possible given the application’s performance requirements) and implement canaries that alert if
an overflow occurs. 8
Regularly run unit tests with an instrumented toolchain such as AddressSanitizer and MemorySanitizer that
exercises source code with runtime checks for buffer overflows and other memory safety issues. In a codebase
with significant unit test coverage, such tools can detect many (but not all) memory safety related issues before
they become a vulnerability.
Conduct aggressive adversarial product testing, including static analysis, fuzzing, and manual reviews (as
needed) to ensure the quality and security of code throughout the development lifecycle. 9
Publish a memory-safety roadmap outlining how the manufacturer plans to develop new products with memory-
safe languages and migrate code to memory safe languages in a prioritized manner.
Conduct root cause analysis of past vulnerabilities, including buffer overflows, to spot trends and patterns. Where
possible, take actions to eliminate entire classes of vulnerabilities across products, rather than the superficial
causes.
2
TLP:CLEAR
Where feasible, manufacturers should work to eliminate buffer overflow vulnerabilities by developing new software using
memory-safe languages and the best practices described in this Alert. Furthermore, eliminating buffer overflow
vulnerabilities can help reduce the prevalence of other memory safety issues, such as format string, off-by-one, and use-
after-free vulnerabilities. For more information on memory safety and transitioning to using memory-safe languages,
review the following resources:
CISA and FBI’s The Case for Memory Safe Roadmaps, Exploring Memory Safety in Critical Open Source Projects,
and Product Security Bad Practices.
White House Office of the National Cyber Director’s (ONCD) Back to the Building Blocks report.
National Security Agency’s (NSA) Software Memory Safety.
Google’s Perspective on Memory Safety and Eliminating Memory Safety Vulnerabilities at the Source, Microsoft’s
We Need a Safer Systems Programming Language, Amazon Web Service’s (AWS) Sustainability with Rust, and
Mozilla’s Implications of Rewriting a Browser Component in Rust.
Disclaimer
The information in this report is being provided “as is” for informational purposes only. The authoring organizations do not
endorse any commercial entity, product, company, or service, including any entities, products, or services linked within
this document. Any reference to specific commercial entities, products, processes, or services by service mark,
trademark, manufacturer, or otherwise, does not constitute or imply endorsement, recommendation, or favoring by the
authoring organizations.
1
See MITRE’s Unforgivable Vulnerabilities and CWE Top 25 Most Dangerous Software Weaknesses.
2
See CISA’s Product Security Bad Practice Guidance.
3
See OWASP Foundation’s Buffer Overflow and Fortinet’s What Is Buffer Overflow? Attacks, Types & Vulnerabilities.
4
See NIST’s Special Publication (SP) 800-218, Secure Software Development Framework (SSDF) Version 1.1:
Recommendations for Mitigating the Risk of Software Vulnerabilities for manufacturer and vendor responsibilities for
attesting to adhering to secure software development practices.
5
See OWASP Foundation’s Buffer Overflow.
6
See CISA’s Product Security Bad Practices guidance and Google’s case study Eliminating Memory Safety Vulnerabilities at the
Source for how Google’s Android team greatly reduced the prevalence of memory safety vulnerabilities in Android by
switching to using a memory-safe language.
7
See examples for compiler flags that prevent buffer overflows listed in Red Flag Developer’s Use Source-Level Annotations to
Help GCC Detect Buffer Overflows and Use Compiler Flags for Stack Protection in GCC and Clang. Note that these flags are not
necessarily implemented in all C compilers.
8
See OWASP Foundation’s CWE-119.
9
See NIST’s SSDF.
10
See Google’s Eliminating Memory Safety Vulnerabilities at the Source.
11
See Microsoft’s We Need a Safer Systems Programming Language, Mozilla’s Implications of Rewriting a Browser Component
in Rust, and AWS’s Sustainability with Rust.
4
TLP:CLEAR