Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Conversation

@ash47
Copy link

@ash47 ash47 commented Mar 15, 2021

Added exception handling for a System.FormatException that occurs when a property looks like a timestamp (ends with 0Z) but isn't actually a timestamp

This is fixed via a try catch to handle the uncaught exception, and a comment to explain what's actually going on :)

The following exception occurs under very specific AD configurations:

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.FormatException: String was not recognized as a valid DateTime.
   at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
   at System.DateTime.ParseExact(String s, String format, IFormatProvider provider)
   at SharpHound3.Tasks.ObjectPropertyTasks.BestGuessConvert(String property)
   at SharpHound3.Tasks.ObjectPropertyTasks.ParseAllProperties(LdapWrapper wrapper)
   at SharpHound3.Tasks.ObjectPropertyTasks.<ResolveObjectProperties>d__2.MoveNext()
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at SharpHound3.SharpHound.<Main>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at SharpHound3.SharpHound.<Main>(String[] args)

ash47 added 2 commits March 15, 2021 11:02
Added exception handling for a System.FormatException that occurs when a property looks like a timestamp (ends with 0Z) but isn't actually a timestamp
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant