-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add PKI (ADCS) support #8
Conversation
Hey thanks for the PR! Do the changes support BloodHound Community Edition (BHCE)? I know Certipy's BloodHound output worked with a fork of legacy BloodHound, but it's been a while since I examined either |
Hello ! Thank you for your response. You were right, the data was not corresponding to Sharphound (2024 April) data. So I did update all data returned by Bofhound in order to make it correspond to the new data schema. The output is now closer to SharpHound output and works in BH CE. |
Starting to review this. When I run the changes, it instantly throws this errror |
### Not supported for the moment | ||
self.Properties['hasspn'] = None | ||
self.Properties['displayname'] = None | ||
self.Properties['email'] = None | ||
self.Properties['title'] = None | ||
self.Properties['homedirectory'] = None | ||
self.Properties['userpassword'] = None | ||
self.Properties['unixpassword'] = None | ||
self.Properties['unicodepassword'] = None | ||
self.Properties['sfupassword'] = None | ||
self.Properties['logonscript'] = None | ||
self.Properties['sidhistory'] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasspn
is supported in the code above and this is always setting it tonull
in the JSON output
Is there a reason these properties are being explicitly set to null? Last I checked data was ingested fine without inclusion. If we want to add them here, we should support them and pull the value from the logs, otherwise we should just delete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you are right. Moreover, hasspn
value is set up earlier during the parsing, that's my bad.
For the rest, I wanted to mention that work had to be done on this part, maybe let them commented ?
'samaccountname', 'distinguishedname', 'isdeleted', 'msds-groupmsamembership', | ||
'serviceprincipalname', 'displayname', | ||
'lastlogon', 'lastlogontimestamp', 'pwdlastset', 'mail', 'title', | ||
'homedirectory', 'description', 'userpassword', 'admincount', | ||
'msds-allowedtodelegateto', 'sidhistory', 'whencreated', 'unicodepwd', 'unixuserpassword', | ||
'domainsid', 'allowedtodelegate', 'name', 'domain', 'admincount', | ||
'highvalue', 'unconstraineddelegation', 'passwordnotreqd', 'enabled', | ||
'dontreqpreauth', 'sensitive', 'trustedtoauth', 'pwdneverexpires', | ||
'dontreqpreauth', 'pwdneverexpires', 'sensitive', | ||
'serviceprincipalnames', 'hasspn', 'email', 'memberof' | ||
'serviceprincipalnames', 'isaclprotected', | ||
'hasspn', 'displayname', 'email', 'title', 'homedirectory', 'userpassword', 'unixpassword', | ||
'unicodepassword', 'sfupassword', 'logonscript', 'sidhistory' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See note later in this file about the property modifications. I explicitly do wish to keep memberof
as a common attribute (something I find personally helpful when manually & iteratively enumerating AD). If you removed this due to UI clog, that can be an issue and I would be open to adding a new CLI flag that turns off memberof
and member
(for group objects) attribute inclusion in common properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your point. My goal was to give a result as close as possible to SharpHound one, because the "memberof" value can be oversizing the Bloodhound GUI. I'll add this again in that case.
We could add --gui-only
flag that only exports necessary information for BloodHound GUI. What do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, a flag to opt out of them would be a nice addition
@Palu08 I completed a review, I'm happy to collaborate to add some of the missing pieces, make these edits and also work in some test cases to help with future additions |
I need to go back and delete commit c122e93 (you might encounter an error with it). My test machine must've had an old bloodhoundpy installed or something when I added that commit. At any rate, the current version of bloodhoundpy seems to return the correct trust attributes now for BHCE |
Added |
@P-aLu Sorry for the lack of activity on this PR; been busy the last few months. I actually used this fork to parse out ADCS objects on a recent red team. Super helpful to have. I think the last thing we need to clean up is the ACL parsing of ADCS objects. I think you brought over a specific function from Certipy that specially parses the template/CA/etc object DACLs. I've noted the the ACL abuse paths over ADCS objects generated by this fork are extremely different from those produced by SharpHound. I think we should remove the function special to ADCS object parsing and modify the main ACL parsing method to include the logic SharpHound uses here: https://github.com/BloodHoundAD/SharpHoundCommon/blob/v4/src/CommonLib/Processors/ACLProcessor.cs There is some stuff we likely won't be able to account for, such as edges/attribute relying on registry values queried from CAs, but I think we can get the ACLs generated by bofhound to align a little more closely than they are now. |
Finally got around to addressing the ACL parsing. Added some stuff and fixed some bugs:
I just need to fix up the test cases now and I think it's close enough to data pulled with SharpHound to merge. Adding some test cases for the ADCS parsing would be nice, but I'll tackle that at a later time I think. |
Add PKI (ADCS) support
Merged Certipy LDAP parsing
Related to Tw1sm/pyldapsearch#2 and trustedsec/CS-Situational-Awareness-BOF#118