Skip to content

Added checks for MaxRecursion#1264

Merged
val-ms merged 2 commits intoCisco-Talos:mainfrom
ragusaa:CLAM-2602-ValidateMaxRecursion
Sep 9, 2024
Merged

Added checks for MaxRecursion#1264
val-ms merged 2 commits intoCisco-Talos:mainfrom
ragusaa:CLAM-2602-ValidateMaxRecursion

Conversation

@ragusaa
Copy link
Contributor

@ragusaa ragusaa commented May 7, 2024

This change sets a limit on the max-recursion config option. Users will no longer be able to set max-recursion higher than 100.

Setting max-recursion to high may memory allocation errors on startup and attempting to scan a file with too many layers of recursion may cause a stack overflow crash.

@ragusaa ragusaa force-pushed the CLAM-2602-ValidateMaxRecursion branch from 2b09e8a to 324d06b Compare May 7, 2024 16:12
@ragusaa ragusaa force-pushed the CLAM-2602-ValidateMaxRecursion branch 4 times, most recently from fbfedaf to 4c9709a Compare May 15, 2024 20:19
@ragusaa ragusaa force-pushed the CLAM-2602-ValidateMaxRecursion branch 3 times, most recently from ac78ae8 to c866085 Compare June 28, 2024 19:46
val-ms
val-ms previously approved these changes Jul 17, 2024
Copy link
Contributor

@val-ms val-ms left a comment

Choose a reason for hiding this comment

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

Looks good to me.

There is presently no limit for the max-recursion scan option.
Selecting a max-recursion limit that is too high will cause confusing
errors. E.g.:

/home/aragusa/install.alz/bin/clamscan -d clamav.hdb . --max-recursion=9999999999

LibClamAV Error: fmap_fd: Attempted to get fd for NULL fmap
/home/aragusa/issue/clamav.hdb: Can't allocate memory ERROR
LibClamAV Error: fmap_fd: Attempted to get fd for NULL fmap
/home/aragusa/issue/test.sh: Can't allocate memory ERROR

This commit prevents setting the max-recursion limit higher than 100.
@val-ms val-ms force-pushed the CLAM-2602-ValidateMaxRecursion branch from c866085 to 29987c0 Compare September 9, 2024 16:41
@val-ms val-ms merged commit 51e2390 into Cisco-Talos:main Sep 9, 2024
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