CVE-2026-89720: ubifs: fix out-of-bounds read in signature length check
In the Linux kernel, the following vulnerability has been resolved:
ubifs: fix out-of-bounds read in signature length check
ubifssbverifysignature() bounds the on-disk ubifssignode->len field before handing the signature payload to verifypkcs7signature(), but the check has the wrong sign:
if (le32tocpu(signode->len) > snod->len + sizeof(struct ubifssignode))
The signature bytes start sizeof(struct ubifssignode) (UBIFSSIGNODESZ, 64 bytes) into the node, so the payload is at most
snod->len - sizeof(struct ubifssignode)
bytes long. Adding the header size instead of subtracting it accepts a declared length up to 2 UBIFSSIGNODESZ larger than the node actually holds -- past the end of c->sbuf, which is vmalloc(c->lebsize). verifypkcs7signature() -> pkcs7parsemessage() -> asn1berdecoder() is then handed that inflated length and reads beyond the allocation while walking the DER headers. The node length comes straight from the mounted image, so a crafted signed UBIFS image reaches this via ubifsreadsuperblock() before the signature is cryptographically checked.
snod->len is guaranteed to be >= UBIFSSIGNODESZ by the node scanner (c->ranges[UBIFSSIGNODE].minlen == UBIFSSIGNODESZ), so the corrected subtraction cannot underflow. Legitimately signed images are unaffected: a correct superblock never declares a signature longer than the node it is embedded in.
Event History
Frequently Asked Questions
What must an attacker control to trigger this issue?
The attacker must be able to cause the system to mount a crafted UBIFS image containing a manipulated signature node length. The length value is taken directly from the mounted image.
Does the signature need to pass cryptographic verification?
No. The malformed length reaches PKCS#7 and ASN.1 parsing during superblock processing before the signature is cryptographically checked.
When in the mount process is the vulnerable path reached?
The path is reached through ubifs_read_superblock() while processing the mounted image. The inflated signature length can cause parsing code to read beyond the vmalloc allocation used for the UBIFS buffer.
How much can the declared signature payload exceed the data available in the node?
The incorrect check can accept a declared length up to twice UBIFS_SIG_NODE_SZ larger than the node actually contains. UBIFS_SIG_NODE_SZ is 64 bytes, so the excess can be up to 128 bytes.