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

thread 'main' panicked at 'invalid or out-of-range date' #209

Comments

Copy link

Hello !

We stumbled upon an error thread 'main' panicked at 'invalid or out-of-range date' while using the evtx library.
We are wondering if it's the expected behavior, and if not, is there a workaround ?
It seems that when the evtx library processes a "faulty" event, it fails and returns by throwing the aformentioned error.

Used command:
./evtx_dump-v0.7.2-x86_64-unknown-linux-gnu <filename>.evtx -f <filename>.json --no-confirm-overwrite -ojson --no-indent

Error:

thread '<unnamed>' panicked at 'invalid or out-of-range date', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.19/src/naive/date.rs:173:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'invalid or out-of-range date', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.19/src/naive/date.rs:173:51
thread '<unnamed>' panicked at 'invalid or out-of-range date', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.19/src/naive/date.rs:173:51

We looked inside our evtx file with Windows Event Viewer. We found that the evtx command failed on events containing the following data:

<EventData>
    <Data Name="IdentificationGUID">{00280040-0022-0049-6400-65006e007400}</Data>
    <Data Name="ProtectorGUID">{00660069-0069-0063-6100-740069006f00}</Data>
    <Data Name="ProtectorType">0x47006e</Data>
    <Data Name="UnlockTime">1601-01-01T00:00:00.0000000Z</Data>
</EventData>

specifically on the "UnlockTime" field (see the attached image).

Things look fine by viewing the associated scheme though:

Template    : <template xmlns="http://schemas.microsoft.com/win/2004/08/events">
                <data name="IdentificationGUID" inType="win:GUID" outType="xs:GUID"/>
                <data name="ProtectorGUID" inType="win:GUID" outType="xs:GUID"/>
                <data name="ProtectorType" inType="win:HexInt32" outType="win:HexInt32"/>
                <data name="UnlockTime" inType="win:SYSTEMTIME" outType="xs:dateTime"/>
              </template>

We found topics similar to this case:

Therefore, we supposed that the raw evtx file contains an "UnlockTime" event date with a raw value of 0.
Windows Event Viewer support and display the value "1601-01-01T00:00:00.0000000Z" while the evtx library don't.
By looking at the code, we found that the library use the rust function from_ymd that can throw this error.
In this case, if any event has a wrong "UnlockTime" value, the whole evtx file cannot be processed.
If it's the expected behavior, is adding an option that allows the user to process the whole file while skipping faulty events possible as a workaround ?
If not, can an update to this using from_ymd_opt instead of from_ymd fix it ? Events will have empty "UnlockTime" data value.

In any case, thank you for your work !

Regards.

windows_event_viewer

Copy link
Author

Mar 22, 2022

Hello !

Thank you very much. Tested it. It seems to work as expected. It generates an output file without "faulty" events while displaying relevant warnings.

Best regards,
DB-37.

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 a pull request may close this issue.

1 participant