Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bounds check in OLE2 decryption #1458

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

val-ms
Copy link
Contributor

@val-ms val-ms commented Feb 24, 2025

The bounds check for the loop iterating an OLE2 block during decryption may have an integer underflow if the leftover + bytesToWrite is less than 16. That results in a significant buffer over read and a segfault.

The fix is simply to do addition on the left side of the check instead of subtraction on the right.

Fixes https://issues.oss-fuzz.com/issues/372544101

Note: This is the fix from 1.4.2 and 1.0.8 (e.g. a copy of 935b2fe) for main / 1.5.

The bounds check for the loop iterating an OLE2 block during decryption
may have an integer unerflow if the `leftover + bytesToWrite` is less
than 16. That results in a significant buffer over read and a segfault.

The fix is simply to do addition on the left side of the check instead
of subtraction on the right.

Fixes https://issues.oss-fuzz.com/issues/372544101
@val-ms val-ms merged commit 492e505 into Cisco-Talos:main Feb 24, 2025
23 of 24 checks passed
@val-ms val-ms deleted the CLAM-2696-ole2-decrypt-overread branch February 24, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants