CVE-2023-4039: GCC's-fstack-protector fails to guard dynamically-sized local variables on AArch64
DISPUTEDA failure in the -fstack-protector feature in GCC-based toolchains that target AArch64 allows an attacker to exploit an existing buffer overflow in dynamically-sized local variables in your application without this being detected. This stack-protector failure only applies to C99-style dynamically-sized local variables or those created using alloca(). The stack-protector operates as intended for statically-sized local variables.
The default behavior when the stack-protector detects an overflow is to terminate your application, resulting in controlled loss of availability. An attacker who can exploit a buffer overflow without triggering the stack-protector might be able to change program flow control to cause an uncontrolled loss of availability or to go further and affect confidentiality or integrity. NOTE: The GCC project argues that this is a missed hardening bug and not a vulnerability by itself.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Avoid C99-style dynamically-sized local variables and usages of alloca(); refactor code to remove variable-length automatic arrays or alloca() calls so that overflows are not undetected by -fstack-protector.
- Operational
Recompile vulnerable code using an updated toolchain.
Event History
Frequently Asked Questions
What is CVE-2023-4039?
CVE-2023-4039 is a vulnerability that affects GCC-based toolchains targeting AArch64, allowing an attacker to exploit buffer overflows in dynamically-sized local variables.
What does the -fstack-protector feature in GCC-based toolchains do?
The -fstack-protector feature in GCC-based toolchains provides protection against stack buffer overflows by adding canaries, or integrity checks, to the stack.
What is the impact of CVE-2023-4039?
The impact of CVE-2023-4039 is that an attacker can exploit buffer overflows in dynamically-sized local variables without detection.
How can I protect my application from CVE-2023-4039?
To protect your application from CVE-2023-4039, make sure to update your GCC-based toolchain to a version that includes the fix for this vulnerability.
Where can I find more information about CVE-2023-4039?
You can find more information about CVE-2023-4039 on the Arm Security Center website and the GitHub Advisory database.