Handle empty or malformed cacertificate attribute in CA objects#55
Open
0x4meliorate wants to merge 1 commit intocoffeegist:mainfrom
Open
Handle empty or malformed cacertificate attribute in CA objects#550x4meliorate wants to merge 1 commit intocoffeegist:mainfrom
0x4meliorate wants to merge 1 commit intocoffeegist:mainfrom
Conversation
If a snapshot contains a CA object whose cacertificate attribute is empty or malformed, BOFHound will crash when it tries to parse it as a valid X.509 certificate. This edge case can occur when a CA is partially configured, decommissioned, or when the snapshot tool is unable to retrieve the full certificate blob and substitutes a placeholder value instead. The fix wraps the parsing attempt in a try/except block so that if parsing fails, BOFHound falls back to using the certificate's SHA1 thumbprint as the name instead and continues processing, rather than throwing an unhandled exception and dying.
|
Thank you for the patch, I had this crash in my context, but it also failed afterward in the code, at https://github.com/coffeegist/bofhound/blob/main/bofhound/ad/adds.py#L1353, it seems related to the underlying issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a snapshot contains a CA object whose cacertificate attribute is empty or malformed, BOFHound will crash when it tries to parse it as a valid X.509 certificate. This edge case can occur when a CA is partially configured, decommissioned, or when the snapshot tool is unable to retrieve the full certificate blob and substitutes a placeholder value instead. The fix wraps the parsing attempt in a try/except block so that if parsing fails, BOFHound falls back to using the certificate's SHA1 thumbprint as the name instead and continues processing, rather than throwing an unhandled exception and dying.