Skip to content

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