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

Clam 1607 fix benign overflow & leaks loading PDB & WDB databases #530

Merged
merged 1 commit into from
May 17, 2022

Conversation

ragusaa
Copy link
Contributor

@ragusaa ragusaa commented Apr 4, 2022

Fixes a benign overflow loading PDB or WDB databases, reported by Michał Dardas.

This fix also resolves:

This commit also fixes a minor leak of pattern matching trans nodes that was observed when testing with the MPOOL module disabled.

The fix changed const char pointers to uint8_t pointers when they are to be used with data, as well as removing asserts and adding additional error checking.

@ragusaa
Copy link
Contributor Author

ragusaa commented Apr 4, 2022

This PR replaces #462

@val-ms val-ms self-requested a review April 4, 2022 22:32
@val-ms val-ms self-assigned this Apr 4, 2022
@ragusaa ragusaa force-pushed the CLAM-1607-LoadingSig3 branch from c806c45 to 0fa734a Compare April 5, 2022 01:37
libclamav/regex_list.c Outdated Show resolved Hide resolved
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.

1 error handling thing to tidy up, otherwise is good

@ragusaa ragusaa force-pushed the CLAM-1607-LoadingSig3 branch from 1d18874 to ef717ae Compare April 13, 2022 19:54
@val-ms val-ms force-pushed the CLAM-1607-LoadingSig3 branch from ef717ae to cda9fd5 Compare April 14, 2022 20:37
@val-ms
Copy link
Contributor

val-ms commented Apr 26, 2022

From offline conversations: this PR is presently held up because the cleanup code added is slow and is causing timeouts in the test environment. @ragusaa is working on finding a faster way to track those pointers for cleanup.

@ragusaa ragusaa force-pushed the CLAM-1607-LoadingSig3 branch 4 times, most recently from 6060484 to 496b4f6 Compare May 12, 2022 16:17
@ragusaa ragusaa force-pushed the CLAM-1607-LoadingSig3 branch from 36ee4bd to 9fc8db7 Compare May 12, 2022 18:11
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.

With exception to these minor changes requested, this all looks really great. It went through the test pipelines nicely. I used the internal-fuzz-corpus PR to verify that it resolves CLAM-1607 and the related ones (1642, 1649, 1653) and with manual testing, confirmed that 1691 is resolved as well.

libclamav/matcher-ac.c Outdated Show resolved Hide resolved
libclamav/matcher-ac.c Outdated Show resolved Hide resolved
libclamav/regex_list.c Outdated Show resolved Hide resolved
libclamav/regex_list.c Outdated Show resolved Hide resolved
@val-ms val-ms force-pushed the CLAM-1607-LoadingSig3 branch from 9fc8db7 to cb85b4b Compare May 14, 2022 17:19
@val-ms
Copy link
Contributor

val-ms commented May 14, 2022

Just rebased for you to same some effort, since I did it for testing locally.

There is a possible overflow read when loading PDB and WDB phishing
signatures.

This issue is not a vulnerability.

Changed const char pointers to uint8_t pointers when they are to be used
with data, as well as removing asserts and adding additional error
checking.

Thank you Michał Dardas for reporting this issue.
@ragusaa ragusaa force-pushed the CLAM-1607-LoadingSig3 branch from d0de311 to 5ccb0c3 Compare May 16, 2022 22:33
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.

lgtm!

@val-ms val-ms merged commit 1c67468 into Cisco-Talos:main May 17, 2022
@val-ms val-ms changed the title Changed data pointers to use unsigned types Clam 1607 fix benign overflow & leaks loading PDB & WDB databases May 28, 2022
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