Skip to content

Instantly share code, notes, and snippets.

@zdi-team
Created January 20, 2023 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdi-team/1b190468184dc571a02bdd0c70a1dd4a to your computer and use it in GitHub Desktop.
Save zdi-team/1b190468184dc571a02bdd0c70a1dd4a to your computer and use it in GitHub Desktop.
attributes = OBJ_CASE_INSENSITIVE;
ObjectAttributes.Length = 48;
if ( !LdrpUseImpersonatedDeviceMap ) // Note how Microsoft left legacy
// vulnerable behavior available
// via configuration
attributes = OBJ_IGNORE_IMPERSONATED_DEVICEMAP|OBJ_CASE_INSENSITIVE;
ObjectAttributes.RootDirectory = 0i64;
ObjectAttributes.Attributes = attributes;
ObjectAttributes.ObjectName = a2;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
...
ntStatus = NtOpenFile(
&FileHandle,
SYNCHRONIZE|FILE_TRAVERSE|FILE_LIST_DIRECTORY,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_DELETE|FILE_SHARE_READ,
FILE_NON_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment