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

Fixes Object ACE parsing #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vruello
Copy link

@vruello vruello commented Jun 30, 2020

In the current version, if an object ACE does not contain an InheritedObjectType, the parser fails with IoError { source: Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" } }.

In the Object ACE structure, ObjectType and InheritedObjectType fields are optional. Their presence depends on the value of the Flags field. This is not clearly stated in the documentation but it is implemented in impacket: https://github.com/SecureAuthCorp/impacket/blob/5d4ad6cc26496f6e16e7ec6ab54b631ea98b09c5/impacket/ldap/ldaptypes.py#L249-L259.

Currently, the parser assumes that these fields are always present, which leads to a 16-bytes shift in some cases and the previously mentioned error.

This patch fixes the issue by:

  • using Option<Guid> type instead of Guid for object_type and inherited_type fields
  • checking Flags value before reading ObjectType and InheritedObjectType fields.

I have also added a few tests.

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 this pull request may close these issues.

1 participant