CVE-2026-58956 AI-generated analysis
platform/external/avb, libavb RSA PKCS1.5 signature verification (libavb/avb_rsa.c)
Makes libavb's modpowF4 report memory allocation failure to avb_rsa_verify so that RSA signature verification fails instead of silently continuing with the unmodified signature buffer.
Root cause
In libavb/avb_rsa.c, modpowF4 was declared void. It allocates three key->len-sized uint32_t work buffers with avb_malloc. If any allocation returned NULL it jumped to the out label, freed what it had and returned without touching the inout buffer. avb_rsa_verify copied the signature into buf, called modpowF4(parsed_key, buf) with no way to learn of the failure, and then went on to check padding and hash against buf. Per the commit message, buf still held the raw signature bytes instead of the exponentiation result, so a signature block matching the expected padding and hash could potentially pass the check when heap allocation failed during verification.
How the fix works
- libavb/avb_rsa.c:modpowF4: the return type changes from void to bool, and a local `bool success = false` is added before the NULL check on a/aR/aaR. The allocation-failure path still jumps to out but now returns false. `success = true` is set only after the result has been written back into inout. The out label frees the buffers as before and ends with `return success`.
- libavb/avb_rsa.c:avb_rsa_verify: the bare call `modpowF4(parsed_key, buf);` is replaced with `if (!modpowF4(parsed_key, buf)) { avb_error("RSA modulus computation failed.\n"); goto out; }`. When the exponentiation did not run, the padding and hash check is never reached and verification fails, as the commit message states.
Completeness
- Covers the only error path shown inside modpowF4 (any of the three avb_malloc calls returning NULL). The material shows no other failure mode for the arithmetic itself (montMul/montMulAdd/subM).
- The diffs show one call site of modpowF4, in avb_rsa_verify, and the fix checks it. No other caller appears in the material, but the material does not show the whole file.
- The fix does not change the out block of avb_rsa_verify. It relies on reaching out before success yielding a verification failure, as the commit message states. The out block itself is not shown in the material.
Behavior changes
- avb_rsa_verify now fails, and logs "RSA modulus computation failed." via avb_error, when modpowF4 cannot allocate its work buffers. Before the fix it continued and checked the unmodified signature bytes.
- No change to the success path. modpowF4's return type changes from void to bool (internal static function).
Per major
- Android 14: same fix: platform/external/avb d7958a92019b in android-security-14.0.0_r31. The diff is identical to Android 15's (same blob ids f4cb322..1bdc57e, same hunk offsets).
- Android 15: same fix: platform/external/avb d198864453bc in android-security-15.0.0_r19, the reference commit analysed here.
- Android 16: same fix: platform/external/avb 119d66ea3724 in android-security-16.0.0_r10. The diff is identical to Android 15's (same blob ids and hunk offsets).
- Android 17: adapted fix: platform/external/avb 2264ece3807d in android-security-17.0.0_r3. The logic is identical but sits at different offsets (modpowF4 hunk at line 495), in a file where avb_rsa_verify takes an AvbAlgorithmType algorithm parameter and a get_padding helper exists.
Unknowns
- The body of the out label in avb_rsa_verify (cleanup and return value) is not shown. That it yields a verification failure comes from the commit message.
- Which libavb callers on a device (bootloader vs. userspace libavb users) reach avb_rsa_verify, and which are exposed to heap exhaustion during verification, is not described in the material.
- Why the resolver reports 7/8 rather than 8/8 patched lines present at each latest security tag is not explained by the material.