Cloudanix VulnDB

CVE-2024-31852

Medium · 5.9

CVSS

5.9

EPSS

1.0%

Published

Apr 5, 2024

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A compiler error can produce ARM software that behaves incorrectly and may let an attacker take control or crash the program, so teams must rebuild affected software with a corrected compiler version.

Chainable
Exploitation
Remote Unauthenticated
Attacker needs
None
Complexity
High
Impact
Denial Of Service
Component
Library
Class
Memory Corruption
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

LLVM ARM backend miscompiles code such that the LR register can be clobbered without a prior stack save, creating a potential jump-oriented programming gadget that alters control flow.

Why it matters to the business

Organizations shipping ARM binaries risk silent introduction of control-flow errors that may cause application crashes or, in rare cases, allow an attacker to redirect execution; the defect affects any downstream product built with affected LLVM versions.

How an attack unfolds

An attacker supplies specially crafted source or IR to Clang that triggers the miscompile; the resulting binary contains an unsaved LR overwrite that, when combined with attacker-controlled data, forms a usable JOP sequence; exploitation remains difficult because most inputs cause an immediate crash rather than a stable gadget.

How to fix it

Upgrade llvm-project to a build containing commit c13b7485b87909fcf739f62cfa382b55407433c0 (or 0e16af8e4cf3a66ad5d078d52744ae2776f9c4b2 for llvmbot forks) and rebuild all affected ARM targets; recompile and retest any previously compiled binaries.

How to confirm the fix worked

Confirm the updated LLVM revision is in use, rebuild a known-triggering test case, and verify that the generated assembly now contains a proper stack save of LR before any potential overwrite.

Typical attack path

  1. Identify a function whose compilation triggers the LR miscompile in the ARM backend
  2. Craft input that produces a binary containing the unsaved LR overwrite gadget
  3. Combine the gadget with attacker-controlled memory or registers to redirect control flow
  4. Trigger the vulnerable function with attacker-supplied data to achieve code execution or denial of service

How to detect it

Review build logs and binary analysis for functions compiled with pre-fix LLVM that exhibit LR clobber patterns; monitor runtime crashes in ARM binaries that occur on previously tested inputs after recompilation with older toolchains.

What your security team should do

  • Immediately update all build pipelines to the fixed LLVM revision and rebuild ARM-targeted artifacts
  • Add the miscompile test case to CI regression suites for ARM backends
  • Prioritize rebuilds for any security-sensitive or network-facing ARM binaries

The record

LLVM before 18.1.3 generates code in which the LR register can be overwritten without data being saved to the stack, and thus there can sometimes be an exploitable error in the flow of control. This affects the ARM backend and can be demonstrated with Clang. NOTE: the vendor perspective is "we don't have strong objections for a CVE to be created ... It does seem that the likelihood of this miscompile enabling an exploit remains very low, because the miscompile resulting in this JOP gadget is such that the function is most likely to crash on most valid inputs to the function. So, if this function is covered by any testing, the miscompile is most likely to be discovered before the binary is shipped to production."

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 llvm-toolchain-16 0 No fix
Debian:12 llvm-toolchain-14 0 No fix
Debian:12 llvm-toolchain-15 0 No fix
Debian:12 llvm-toolchain-16 0 No fix
Debian:13 llvm-toolchain-15 0 No fix
Debian:13 llvm-toolchain-16 0 No fix
Debian:13 llvm-toolchain-17 0 No fix
Debian:13 llvm-toolchain-18 0 1:18.1.3-1
Ubuntu:14.04:LTS llvm-toolchain-3.6 0 No fix
Ubuntu:14.04:LTS llvm-toolchain-3.8 0 No fix
Ubuntu:14.04:LTS llvm-toolchain-3.9 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-3.5 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-3.6 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-3.7 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-3.8 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-3.9 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-4.0 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-5.0 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-6.0 0 No fix
Ubuntu:16.04:LTS llvm-toolchain-8 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-10 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-3.7 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-3.9 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-4.0 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-5.0 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-6.0 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-7 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-8 0 No fix
Ubuntu:18.04:LTS llvm-toolchain-9 0 No fix
Ubuntu:20.04:LTS llvm-toolchain-10 0 No fix
Ubuntu:20.04:LTS llvm-toolchain-11 0 No fix
Ubuntu:20.04:LTS llvm-toolchain-12 0 No fix
Ubuntu:20.04:LTS llvm-toolchain-6.0 0 No fix
Ubuntu:20.04:LTS llvm-toolchain-7 0 No fix
Ubuntu:20.04:LTS llvm-toolchain-8 0 No fix
Ubuntu:20.04:LTS llvm-toolchain-9 0 No fix
Ubuntu:22.04:LTS llvm-toolchain-11 0 No fix
Ubuntu:22.04:LTS llvm-toolchain-12 0 No fix
Ubuntu:Pro:14.04:LTS llvm-toolchain-3.6 0 No fix
Ubuntu:Pro:14.04:LTS llvm-toolchain-3.8 0 No fix
Ubuntu:Pro:14.04:LTS llvm-toolchain-3.9 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-3.5 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-3.6 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-3.7 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-3.8 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-3.9 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-4.0 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-5.0 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-6.0 0 No fix
Ubuntu:Pro:16.04:LTS llvm-toolchain-8 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-10 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-3.7 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-3.9 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-4.0 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-5.0 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-6.0 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-7 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-8 0 No fix
Ubuntu:Pro:18.04:LTS llvm-toolchain-9 0 No fix
Ubuntu:Pro:20.04:LTS llvm-toolchain-10 0 No fix
Ubuntu:Pro:20.04:LTS llvm-toolchain-11 0 No fix
Ubuntu:Pro:20.04:LTS llvm-toolchain-12 0 No fix
Ubuntu:Pro:20.04:LTS llvm-toolchain-6.0 0 No fix
Ubuntu:Pro:20.04:LTS llvm-toolchain-7 0 No fix
Ubuntu:Pro:20.04:LTS llvm-toolchain-8 0 No fix
Ubuntu:Pro:20.04:LTS llvm-toolchain-9 0 No fix

Related vulnerabilities