CVE-2023-4039: gcc-12-base -fstack-protector fails to guard dynamic stack allocations on ARM64

gcc Updated 02 Oct 2025

Summary

13/09/2023
Yes i
Medium
4.8

CVE-2023-4039: 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 th... Affects gcc versions < 13.2.1_git20231014-r0. Fixed in 13.2.1_git20231014-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

gcc-12-base is a package that provides the base runtime library for the GNU Compiler Collection (GCC) version 12.2.0-14. It is used to compile and run C and C++ programs. The package is vulnerable to a specific issue related to the -fstack-protector feature when targeting AArch64 architecture. This vulnerability allows an attacker to exploit buffer overflows in dynamically-sized local variables without detection. It primarily affects C99-style dynamically-sized local variables or those created using alloca(). Statically-sized local variables are not affected by this vulnerability.

Vulnerability Detail

The -fstack-protector feature in GCC-based toolchains targeting AArch64 architecture has a failure that allows an attacker to exploit buffer overflows in dynamically-sized local variables without detection. This vulnerability can be leveraged to cause a controlled loss of availability or potentially affect confidentiality and integrity. The stack-protector feature is designed to terminate the application upon detecting an overflow, but this failure allows the attacker to bypass it. The GCC project argues that this is a missed hardening bug rather than a vulnerability in itself.

How To Fix

Minimum fixed version

13.2.1_git20231014-r0

This is the first release that contains the fix.

sudo apk add --upgrade gcc

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no specific workaround mentioned for this vulnerability. However, users can consider implementing additional security measures such as input validation and proper bounds checking in their applications to minimize the risk of buffer overflows.

Conclusion

The gcc-12-base package is vulnerable to a failure in the -fstack-protector feature when targeting AArch64 architecture. This vulnerability allows an attacker to exploit buffer overflows in dynamically-sized local variables without detection. It is recommended to update the package to a fixed version once it becomes available. Regularly updating systems and applying security patches is crucial to mitigate the risk of exploitation. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for gcc →

Share this vulnerability

FAQ

gcc-12-base is the base runtime library for the GNU Compiler Collection (GCC) version 12.2.0-14. It is used to compile and run C and C++ programs.

The vulnerability affects gcc-12-base version 12.2.0-14.

The vulnerability allows an attacker to exploit buffer overflows in dynamically-sized local variables without detection. It can lead to a controlled loss of availability and potentially affect confidentiality and integrity.

A fix for this vulnerability is expected to be released by the package maintainers. It is recommended to update to the latest version of gcc-12-base once the fix is available.

No, statically-sized local variables are not affected by this vulnerability. The vulnerability primarily affects C99-style dynamically-sized local variables or those created using alloca().

Related vulnerabilities

Recent vulnerabilities recorded for gcc.

How To Fix

Minimum fixed version

13.2.1_git20231014-r0

This is the first release that contains the fix.

sudo apk add --upgrade gcc

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback