Skip to content

libclamav: Harden XLM formula record parsing - #1783

Merged
val-ms merged 2 commits into
Cisco-Talos:mainfrom
jhumlick:CLAM-3011-XLM-out-of-bounds-read
Aug 7, 2026
Merged

libclamav: Harden XLM formula record parsing#1783
val-ms merged 2 commits into
Cisco-Talos:mainfrom
jhumlick:CLAM-3011-XLM-out-of-bounds-read

Conversation

@jhumlick

Copy link
Copy Markdown
Contributor

Validate XLM formula record sizes before parsing and honor the declared token-stream length instead of parsing all trailing record data.

Correct the FORMULA record accounting and add bounds checks for token operands, strings, attributes, function arguments, and cell references. Malformed or truncated tokens now terminate parsing without consuming data beyond the declared formula buffer.

Add unit and clamscan regression tests covering boundary-length records, truncated tokens, malformed strings, and scan-map edge cases.

Reported by Alessandro Greco (GitHub user 'aleff-github').

CLAM-3011

Validate XLM formula record sizes before parsing and honor the declared
token-stream length instead of parsing all trailing record data.

Correct the FORMULA record accounting and add bounds checks for token
operands, strings, attributes, function arguments, and cell references.
Malformed or truncated tokens now terminate parsing without consuming
data beyond the declared formula buffer.

Add unit and clamscan regression tests covering boundary-length records,
truncated tokens, malformed strings, and scan-map edge cases.

Reported by Alessandro Greco (GitHub user 'aleff-github').

CLAM-3011
@jhumlick
jhumlick requested a review from val-ms July 29, 2026 22:43
@jhumlick jhumlick self-assigned this Jul 29, 2026
Comment thread unit_tests/clamscan/xlm_test.py
Add a valid ptgStr regression case and use a signature matching its
disassembled output to verify detection through clamscan and scan-map.

Flush the extracted XLM stream before scanning so buffered formula output
is visible to the scanner.

CLAM-3011

@val-ms val-ms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and local testing went well. I'm waiting for it to run through Jenkins, but I'm happy with it.

@val-ms
val-ms merged commit ce00b3b into Cisco-Talos:main Aug 7, 2026
23 of 24 checks passed
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