PrivescCheck icon indicating copy to clipboard operation
PrivescCheck copied to clipboard

Unhandled errors caused by COM class CLSIDs with incorrect format

Open itm4n opened this issue 1 month ago • 0 comments

When enumerating COM classes in the registry, some of them may be registered with a CLSID which does not strictly follow the GUID format. Since it is assumed that they are in the correct format, this causes unhandled errors when casting them to a Guid type.

Cannot convert value "{E64169B3-3592-47d2-816E-602C5C13F32}" to type "System.Guid". Error: "Guid should contain 32 digits with 4
dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."
At line:50 char:225
+ ... dProperty "(default)" | ForEach-Object { ([Guid] $_).Guid.ToUpper() }
+                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastParseTargetInvocation

Cannot convert value "" to type "System.Guid". Error: "Unrecognized Guid format."
At line:34 char:162
+ ... xpandProperty "AppId" | ForEach-Object { ([Guid] $_).Guid.ToUpper() }
+                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvalidCastParseTargetInvocation

itm4n avatar Nov 14 '25 15:11 itm4n