Skip to content

Feature: Add image hash support#121

Merged
MarioHewardt merged 9 commits into
microsoft:mainfrom
airbus-cert:feature/image-hash-support
Jun 26, 2023
Merged

Feature: Add image hash support#121
MarioHewardt merged 9 commits into
microsoft:mainfrom
airbus-cert:feature/image-hash-support

Conversation

@eeriedusk

@eeriedusk eeriedusk commented Apr 24, 2023

Copy link
Copy Markdown
Contributor

This pull request adds the feature to calculate an event image hash through a new LinuxHelper LinuxGetFileHash.

It allows to configure SHA1, MD5 and/or SHA256 through the HashAlgorithms configuration tag and depends on OpenSSL::Crypto (libssl-dev/openssl-devel). OpenSSL being here an easy solution, it's also possible to replace it by standard headers in case of any licensing difficulties.

As the N_Hash field is handled by eventsCommon.cpp in the SysmonCommon submodule, this pull request fully depends and is directly linked to another PR on the SysmonCommon repository.

@MarioHewardt

Copy link
Copy Markdown
Collaborator

FYI - The "checks" are failing as a result of our build systems not including the new OpenSSL requirements which results in a build break. I'll have to take a look at the licensing requirements but assuming that is all ok, I'll update our build systems to include OpenSSL.

@eeriedusk

Copy link
Copy Markdown
Contributor Author

@MarioHewardt Any update on this request?

@MarioHewardt

Copy link
Copy Markdown
Collaborator

Sorry for the delay (I was out of the office for a bit). I will take a look hopefully by mid next week.

Comment thread linuxHelpers.cpp Outdated
Comment thread linuxHelpers.cpp Outdated
Comment thread linuxHelpers.cpp Outdated
@MarioHewardt

Copy link
Copy Markdown
Collaborator

@eeriedusk We should also add openssl as a dependency to the control.in file.

@eeriedusk

Copy link
Copy Markdown
Contributor Author

@MarioHewardt I moved the hash flag handling from linuxHelpers.cpp to sysmonforlinux.c, handleEvent can now call processProcessCreate to set m_HashType. I also double check stringBuffer[256] for overflow even though it shouldn't happen. I guess the checks failed because of the SysmonCommon dependency 😕

Comment thread sysmonforlinux.c
@eeriedusk

Copy link
Copy Markdown
Contributor Author

I forced OPT_VALUE( HashAlgorithms ) in a unsigned int *hashTypePtr variable to avoid the Dereference of null pointer.
It seems like the other warnings were already occuring on previous SysmonForLinux versions (tested on the main branch
e790b90014595744777b4d7a77804407a008eb1e and the 1.2.0.0 release)
.

@MarioHewardt

Copy link
Copy Markdown
Collaborator

I've approved both PR's. Please merge the SysmonCommon one first and then update this PR with the latest SysmonCommon submodule commit.

@eeriedusk

Copy link
Copy Markdown
Contributor Author

You will have to merge the SysmonCommon PR as I don't have the write access on both repositories

@MarioHewardt

Copy link
Copy Markdown
Collaborator

SysmonCommon has been merged.

@MarioHewardt MarioHewardt merged commit 571692c into microsoft:main Jun 26, 2023
@MarioHewardt

Copy link
Copy Markdown
Collaborator

@eeriedusk Thanks much for the work on this!

@eeriedusk eeriedusk deleted the feature/image-hash-support branch June 27, 2023 13:32
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