-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
file/swf: Use lzma-rs decompression instead of libhtp. #7625
Conversation
Use the lzma-rs create for decompressing swf/lzma files instead of the lzma decompressor in libhtp. This decouples suricata from libhtp except for actual http parsing, and means libhtp no longer has to export a lzma decompression interface.
Codecov Report
@@ Coverage Diff @@
## master #7625 +/- ##
==========================================
+ Coverage 75.73% 75.80% +0.06%
==========================================
Files 659 659
Lines 185740 185727 -13
==========================================
+ Hits 140669 140783 +114
+ Misses 45071 44944 -127
Flags with carried forward coverage won't be shown. Click here to find out more. |
Thanks Todd. How does this deal with the issue of lzma preallocating some attacker controlled u32 value? The reason we vendored the lzma code was to address this. |
@victorjulien if I remember correctly, you mentioned that this whole code (SWF decompression) should be deprecated/removed at some point. Should it be removed now ? |
We actually sent the lzma-rs project some patches to add limits to prevent this kind of attack. It was part of our assessment for whether or not we could use this crate in libhtp-rs for lzma decompression. |
Looks like we could drop the check for zlib in configure.ac? |
Why ? zlib will still be used in libhtp |
libhtp has its own check for zlib which in the end results in |
util-file-swf-decompression still uses zlib to decompress CWS compressed swf archives. This PR only changes the lzma decompression path. zlib is still directly used for the CWS path, and this file includes zlib.h. |
|
||
#include <htp/lzma/LzmaDec.h> | ||
#include <zlib.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the zlib.h include be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. It is still used in the CWS decompression path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, make sense. Even if removed from this file, its pulled in via one of the other includes, so we shouldn't remove it.
Reposting as it is lost in GitHub flow : @victorjulien if I remember correctly, you mentioned that this whole code (SWF decompression) should be deprecated/removed at some point. Should it be removed now ? |
I don't think so, but it should probably not be enabled (at runtime) by default as flash is supposed to be a thing of the past. |
@cccs-rtmorti could you add that to your PR ? That is change the default suricata.yaml config option for |
Yeah, no problem. |
Updated in #8132 |
Use the lzma-rs crate for decompressing swf/lzma files instead of
the lzma decompressor in libhtp. This decouples suricata from libhtp
except for actual http parsing, and means libhtp no longer has to
export a lzma decompression interface.
Make sure these boxes are signed before submitting your Pull Request -- thank you.
Reference libhtp-rs PR comment suggesting this change.
Describe changes: