peass-ng/PEASS-ng · error · ArgumentNullException

Value cannot be null. Parameter name: path

Error message

Value cannot be null.
Parameter name: path

What it means

An ArgumentNullException guard on the sole 'path' parameter: HasInheritedPermissions delegates to the overload with PathFormat.RelativePath, and the .NET argument validation rejects a null path before any filesystem access occurs. It fires only when the caller passes null instead of a directory path string.

Source

Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/Directory Class/Directory.HasInheritedPermissions.cs:45

   public static partial class Directory
   {
      /// <summary>[AlphaFS] Checks if the directory has permission inheritance enabled.</summary>
      /// <param name="path">The full path to the directory to check.</param>
      /// <returns><c>true</c> if permission inheritance is enabled, <c>false</c> if permission inheritance is disabled.</returns>
      public static bool HasInheritedPermissions(string path)
      {
         return HasInheritedPermissions(path, PathFormat.RelativePath);
      }


      /// <summary>[AlphaFS] Checks if the directory has permission inheritance enabled.</summary>
      /// <returns><c>true</c> if permission inheritance is enabled, <c>false</c> if permission inheritance is disabled.</returns>
      /// <param name="path">The full path to the directory to check.</param>
      /// <param name="pathFormat">Indicates the format of the path parameter(s).</param>
      public static bool HasInheritedPermissions(string path, PathFormat pathFormat)
      {
         if (Utils.IsNullOrWhiteSpace(path))
            throw new ArgumentNullException("path");


         var acl = File.GetAccessControlCore<DirectorySecurity>(true, path, AccessControlSections.Access | AccessControlSections.Group | AccessControlSections.Owner, pathFormat);

         var rawBytes = acl.GetSecurityDescriptorBinaryForm();

         var rsd = new RawSecurityDescriptor(rawBytes, 0);


         // "Include inheritable permissions from this object's parent" is unchecked.
         var inheritanceDisabled = (rsd.ControlFlags & ControlFlags.DiscretionaryAclProtected) == ControlFlags.DiscretionaryAclProtected;

         return !inheritanceDisabled;
      }
   }
}

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Pass a non-null full path string to HasInheritedPermissions
  2. Guard the call site: check string.IsNullOrWhiteSpace(path) before invoking and skip or report
  3. Resolve paths from a verified source (e.g. Directory.EnumerateDirectories output) rather than possibly-null variables
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/AlphaFS/Filesystem/Directory Class/Directory.HasInheritedPermissions.cs:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/6cac8aebd1b2ff2c. Report an issue: GitHub.