VYPR
Unrated severityNVD Advisory· Published Jul 14, 2021· Updated Aug 3, 2024

CVE-2021-24117

CVE-2021-24117

Description

In Apache Teaclave Rust SGX SDK 1.1.3, a side-channel vulnerability in base64 PEM file decoding allows system-level (administrator) attackers to obtain information about secret RSA keys via a controlled-channel and side-channel attack on software running in isolated environments that can be single stepped, especially Intel SGX.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

2

Patches

Vulnerability mechanics

Root cause

"Direct table lookup in base64 decoding (`decode_table[input[N] as usize]`) creates a cache-timing side channel that leaks secret key bytes."

Attack vector

An attacker with system-level (administrator) access to the same physical machine can exploit the Intel SGX side channel by single-stepping the enclave or observing cache-timing variations during PEM file decoding [ref_id=1]. The base64 decoder's table lookup (`decode_table[input[N] as usize]`) leaks the secret key bytes through memory access patterns. This is a controlled-channel attack where the attacker monitors which cache lines are accessed, thereby recovering the RSA private key being decoded [CWE-203].

Affected code

The vulnerability resides in the base64 decoding logic of the `rust-base64` crate used by Apache Teaclave Rust SGX SDK. The `decode_chunk` function directly indexes into a `decode_table` with the input byte (`decode_table[input[N] as usize]`), which creates a cache-timing side channel because the memory access pattern depends on the secret byte value. The patch introduces a `decode_aligned` function (gated behind `slow_but_safe` feature) that replaces the direct table lookup with a constant-time alternative.

What the fix does

The patch introduces a new `decode_aligned` function (enabled via the `slow_but_safe` feature flag) that performs the table lookup in constant time [ref_id=1]. Instead of directly indexing `decode_table[input[N] as usize]`, it computes two candidate indices (`b64ch % 64` and `b64ch % 64 + 64`) and uses a mask to select the correct result without branching on secret data. This eliminates the cache-timing side channel by ensuring the same memory locations are accessed regardless of the input byte value.

Preconditions

  • authAttacker must have system-level (administrator) access to the same physical machine as the victim enclave
  • configThe target enclave must be using the vulnerable base64 decoder to decode PEM-encoded RSA private keys
  • networkAttacker must be able to observe cache-timing or single-step the enclave (e.g., via Intel SGX side-channel techniques)

Generated on May 29, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

3

News mentions

0

No linked articles in our index yet.