Skip to content

feat: add initial support for size_t #232

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

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

alexkornitzer
Copy link
Contributor

Heya,

Very happy to finally have something to provide upstream to such a core crate in Chainsaw :)

Someone at work provided me with an evtx file which was failing to parse due to this size_t type.

From looking at an event log which utilises size_t it can be seen to output size_t in hex. This commit adds support for widths 4 & 8, by applying them to the HexInt32 and HexInt64 variants.

HandleId & ProcessId:
Screenshot 2023-02-17 at 10 38 39
Screenshot 2023-02-17 at 10 40 26

The assumptions above would make sense to me as this is usually how size_t is typedef'd. But I fully get if you would not want to merge this as it has only been tested on one sample and some assumptions have been made.

@alexkornitzer alexkornitzer changed the title fix: add initial support for size_t feat: add initial support for size_t Feb 17, 2023
Copy link
Collaborator

@ohadravid ohadravid left a comment

Choose a reason for hiding this comment

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

Hi!
Thanks for this PR 💪

Do you think you could share the sample publicly?

BinXmlValue::HexInt32Type(try_read!(cursor, hex32)?)
}
(BinXmlValueType::SizeTType, Some(8)) => {
BinXmlValue::HexInt64Type(try_read!(cursor, hex64)?)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe also keep the old error in case it's not 4/8?

Copy link
Contributor Author

@alexkornitzer alexkornitzer Feb 17, 2023

Choose a reason for hiding this comment

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

Happy to do whatever the maintainers would like for this as its your domain. The reason I did not keep the old error is that I thought the catch all at the bottom would be sufficient now, as it would be there for edge cases? But I guess if we do that the error type is now redundant and needs to be removed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It will catch it, but keeping the special match arm gives a better error so it's a bit nicer (as we already have an error just for that)

@alexkornitzer
Copy link
Contributor Author

Yep here is the sample, which was taken from here, challenge 1 (https://www.ashemery.com/dfir.html)

Security.evtx.zip

@ohadravid
Copy link
Collaborator

Great! So could you add a test like test_event_json_with_multiple_nodes_same_name or test_issue_65 with this example?

From looking at an event log which utilises size_t it can be seen to
output size_t in hex. This commit adds support for widths 4 & 8, by
applying them to the HexInt32 and HexInt64 variants.
@alexkornitzer
Copy link
Contributor Author

Done and squashed to keep the commit log clean.

@omerbenamram omerbenamram merged commit 9b9ca49 into omerbenamram:master Feb 17, 2023
hitenkoku added a commit to Yamato-Security/hayabusa-evtx that referenced this pull request Aug 15, 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.

3 participants