Allow toggling the SACL in LDAP queries #20730
Open
+14
−3
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.
The SACL field within security descriptors typically requires elevated privileges to be read. This means that by default if a user queries a security descriptor and does not have the privileges to read the SACL, the entire field is omitted. Microsoft provides a control that can be applied to the query to toggle this, allowing the rest of the security descriptor to be returned where otherwise it'd be omitted. This PR exposes Metasploit's existing control construction as a datastore option so that users may turn this on and off at while. This means that underpriviliged users can not query for security descriptors and get the majority of the data in the field.
Verification
List the steps needed to make sure this thing works
ENUM_ACCOUNTSquery into the local query file at~/.msf4/ldap_queries.yaml, it includes thenTSecurityDescriptorfield.ldap_querymoduleHACKED_ENUM_ACCOUNTSaction with a normal user account andLDAP::QuerySacl=false, see the security descriptor field is presentLDAP::QuerySaclback to true and run it again, see no security descriptor field (this is the old behavior where the SACL is included by default)