Skip to content

attributeSchema object without attributeID cause crash when processing NTDS #21

@william-billaud

Description

@william-billaud

When loading schema index :

, we may have to deal with attributeSchema object without attributeID. I'm not sure if the missing attributeID is caused by a data corruption, or is a Windows weirdness.

if I add the following two line just before the self._add_attribute

            if obj.get("attributeID", raw=True) is None:
                print(f"Weird attributes : {obj.get('lDAPDisplayName')}")
                print(obj.as_dict())

I got the following error

Weird attributes : msExchHttpDeliveryConnector
{'DNT': 83280, 'Pdnt': 2014, 'Obj': True, 'RdnType': 'cn', 'CNT': 2, 'AB_cnt': 0, 'Time': None, 'Ncdnt': 2014, 'IsVisibleInAB': None, 'RecycleTime': None, 'Ancestors': [2, 2006, 2007, 2008, 2014, 83280], 'lDAPDisplayName': 'msExchHttpDeliveryConnector', 'objectClass': ['classSchema', 'top'], 'governsID': 752256038, 'name': 'ms-Exch-Http-Delivery-Connector', 'cn': 'ms-Exch-Http-Delivery-Connector', 'instanceType': <InstanceType.Writable: 4>}
Traceback (most recent call last):
  File "/home/USERNAME/Documents/tools/github/dissect.database/dissect/database/ese/tools/ntds.py", line 28, in <module>
    main()
  File "/home/USERNAME/Documents/tools/github/dissect.database/dissect/database/ese/tools/ntds.py", line 18, in main
    ntds = NTDS(fh)
           ^^^^^^^^
  File "/home/USERNAME/Documents/tools/github/dissect.database/dissect/database/ese/ntds/ntds.py", line 31, in __init__
    self.db = Database(fh)
              ^^^^^^^^^^^^
  File "/home/USERNAME/Documents/tools/github/dissect.database/dissect/database/ese/ntds/database.py", line 37, in __init__
    self.data.schema.load(self)
  File "/home/USERNAME/Documents/tools/github/dissect.database/dissect/database/ese/ntds/schema.py", line 177, in load
    self._add_attribute(
  File "/home/USERNAME/Documents/tools/github/dissect.database/dissect/database/ese/ntds/schema.py", line 224, in _add_attribute
    column=f"ATT{OID_TO_TYPE[type_oid]}{id}",
                 ~~~~~~~~~~~^^^^^^^^^^
KeyError: 'NONE'

A quick win would be to juste ignore this kind of entry, but I'm still trying to identify the impact.

NTDS is from a 2012 R2 server (not shareable) .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions