NtCreateFile: Does OBJECT_ATTRIBUTES.SecurityDescriptor accept absolute or self-relative security descriptors for directory creation?

olawuyi 0 Reputation points
2026-11-18T15:55:15.97+00:00

Proposed category: Windows development / Windows SDK, subject to confirmation of available Microsoft Q&A tags.

I'm seeking clarification of the documented Windows native API contract for NtCreateFile when called from user mode to create a filesystem directory.

The proposed operation uses:

API: NtCreateFile

CreateDisposition: FILE_CREATE

CreateOptions: FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT (0x00000021)

DesiredAccess: Includes SYNCHRONIZE

OBJECT_ATTRIBUTES.RootDirectory: An already-open parent-directory handle

OBJECT_ATTRIBUTES.Attributes: Includes OBJ_DONT_REPARSE

OBJECT_ATTRIBUTES.SecurityDescriptor: A valid security descriptor containing an explicitly supplied, protected, non-null DACL

The objective is to apply the intended DACL as part of directory creation, rather than creating the directory with a default DACL and subsequently replacing it.

Primary question

For this specific user-mode NtCreateFile operation, which security-descriptor representations are supported through OBJECT_ATTRIBUTES.SecurityDescriptor?

Absolute security descriptor only?

Self-relative security descriptor only?

Both representations?

Additional clarification

Does the supported representation depend on Windows version, filesystem or other documented conditions?

Is a valid protected DACL supplied through this field applied during creation without an intermediate default-DACL exposure?

Are there relevant documented limitations involving object-relative creation or OBJ_DONT_REPARSE?

Is there an official Microsoft specification or API reference explicitly establishing these guarantees?

I'm looking for the supported interface contract, rather than a workaround or a conclusion based solely on observed behavior.

An answer referencing official Microsoft documentation would be particularly helpful.

Thank you.

NtCreateFile: Does OBJECT_ATTRIBUTES.SecurityDescriptor accept absolute or self-relative security descriptors for directory creation?

Proposed category: Windows development / Windows SDK, subject to confirmation of available Microsoft Q&A tags.

I'm seeking clarification of the documented Windows native API contract for NtCreateFile when called from user mode to create a filesystem directory.

The proposed operation uses:

API: NtCreateFile

CreateDisposition: FILE_CREATE

CreateOptions: FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT (0x00000021)

DesiredAccess: Includes SYNCHRONIZE

OBJECT_ATTRIBUTES.RootDirectory: An already-open parent-directory handle

OBJECT_ATTRIBUTES.Attributes: Includes OBJ_DONT_REPARSE

OBJECT_ATTRIBUTES.SecurityDescriptor: A valid security descriptor containing an explicitly supplied, protected, non-null DACL

The objective is to apply the intended DACL as part of directory creation, rather than creating the directory with a default DACL and subsequently replacing it.

Primary question

For this specific user-mode NtCreateFile operation, which security-descriptor representations are supported through OBJECT_ATTRIBUTES.SecurityDescriptor?

Absolute security descriptor only?

Self-relative security descriptor only?

Both representations?

Additional clarification

Does the supported representation depend on Windows version, filesystem or other documented conditions?

Is a valid protected DACL supplied through this field applied during creation without an intermediate default-DACL exposure?

Are there relevant documented limitations involving object-relative creation or OBJ_DONT_REPARSE?

Is there an official Microsoft specification or API reference explicitly establishing these guarantees?

I'm looking for the supported interface contract, rather than a workaround or a conclusion based solely on observed behavior.

An answer referencing official Microsoft documentation would be particularly helpful.

Thank you.

Windows development | Windows API - Win32
0 comments No comments

2 answers

Sort by: Most helpful
  1. olawuyi 0 Reputation points
    2026-11-18T16:15:33.9133333+00:00

    Thank you for the response and supporting references.

    The remaining question is specifically about the supported API contract, rather than the general differences between absolute and self-relative security descriptors.

    Could a Microsoft Windows API or Windows SDK engineer please clarify the following?

    For a user-mode NtCreateFile call with CreateDisposition = FILE_CREATE and CreateOptions = FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT (0x00000021), does OBJECT_ATTRIBUTES.SecurityDescriptor accept:

    An absolute security descriptor;

      A self-relative security descriptor; or
      
         Both representations?
         
         Is the accepted representation explicitly documented in an official Microsoft specification, Windows SDK contract or other authoritative reference?
         
         Are there any Windows-version, filesystem or interface-specific limitations affecting the accepted representation?
         
         When a valid descriptor containing a protected, non-null DACL is supplied at creation time, what guarantee does the supported interface provide regarding application of that DACL before the newly created directory becomes accessible? In particular, is there a documented guarantee against intermediate exposure under a default DACL?
         
    

    The proposed operation also uses an existing parent-directory handle through RootDirectory and includes OBJ_DONT_REPARSE in the object attributes. Please identify any relevant contract limitations introduced by those settings.

    We are seeking an authoritative, documented interface guarantee rather than an inference based on observed behavior.

    If the public documentation does not establish these guarantees, please confirm that limitation and identify the appropriate Microsoft technical authority or specification that could resolve it.

    Thank you.

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-11-18T15:55:42.0733333+00:00

    The documented contract in the provided material does not explicitly state that OBJECT_ATTRIBUTES.SecurityDescriptor for NtCreateFile accepts only absolute security descriptors, only self-relative security descriptors, or both for user-mode directory creation.

    Supported facts from the documentation are:

    • NtCreateFile has a PSECURITY_DESCRIPTOR SecurityDescriptor parameter that optionally specifies a security descriptor to be applied to a file, and ACLs from that descriptor are applied only when the file is created.
    • If that value is NULL when a file is created, the ACL placed on the file is file-system-dependent; most file systems propagate some part of the ACL from the parent directory combined with the caller's default ACL.
    • More generally for securable objects, when a security descriptor is supplied at creation time, it is assigned to the new object; if no security descriptor is supplied, the system uses inherited or default security information.
    • For files and directories created through CreateFile, CreateDirectory, or CreateDirectoryEx, specifying NULL causes a default security descriptor to be assigned, and the ACLs in that default descriptor are inherited from the parent directory.

    On security-descriptor representation, the provided documentation states:

    • A security descriptor can be in absolute or self-relative format.
    • Except for MakeAbsoluteSD, functions that return a security descriptor do so in self-relative format.
    • Security descriptors passed as arguments to a function can be either self-relative or absolute form, and the documentation for the specific function must be consulted for more information.
    • Low-level functions for initializing and setting components of a security descriptor work only with absolute-format security descriptors.

    That last point applies to the low-level security-descriptor construction APIs such as InitializeSecurityDescriptor and related setter functions. It does not establish the accepted representation for NtCreateFile's SecurityDescriptor parameter.

    Therefore, from the provided documentation:

    • The representation accepted by NtCreateFile for OBJECT_ATTRIBUTES.SecurityDescriptor is not explicitly specified.
    • No supported Windows-version, filesystem, or OBJ_DONT_REPARSE qualification for descriptor representation is established.
    • No explicit statement is provided here that object-relative creation through RootDirectory changes the accepted descriptor format.
    • No explicit statement is provided here that OBJ_DONT_REPARSE changes the accepted descriptor format.

    On creation-time application versus intermediate default-DACL exposure, the documented contract does support this narrower conclusion:

    • When a security descriptor is supplied during object creation, that descriptor is the one applied to the new object at creation.
    • The default or inherited descriptor path is described for the case where no security descriptor is supplied (NULL).

    So the provided documentation supports that supplying a security descriptor at creation is the documented mechanism for applying the intended ACL at creation time rather than relying on the default descriptor path. However, it does not provide an explicit object-creation sequencing guarantee phrased as "no intermediate default-DACL exposure."

    In short:

    • NtCreateFile creation-time application of a supplied security descriptor: documented.
    • Exact accepted representation for OBJECT_ATTRIBUTES.SecurityDescriptor in this call: not documented in the provided material.
    • Version/filesystem/RootDirectory/OBJ_DONT_REPARSE limitations for descriptor representation: not documented in the provided material.
    • An official specification explicitly establishing absolute-only, self-relative-only, or both for this NtCreateFile scenario: not present in the provided material.

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.