Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in Get-NetLocalGroupMember #4

Open
rcaroncd opened this issue Nov 17, 2020 · 0 comments
Open

Exception in Get-NetLocalGroupMember #4

rcaroncd opened this issue Nov 17, 2020 · 0 comments

Comments

@rcaroncd
Copy link

Hello,

I am using the Get-NetLocalGroupMember command to get the users of a certain group from a remote machine and I get the following error:

Screenshot

I have tried with Sharpview and Powerview to compare if there was any problem in the command entered but, after debugging, I have located the line where the exception is generated:

// try to extract out the machine SID by using the -500 account as a reference
var MachineSid = (Members.FirstOrDefault(x => (x as LocalGroupMemberAPI).SID.IsRegexMatch(".*-500") || (x as LocalGroupMemberAPI).SID.IsRegexMatch(".*-501")) as LocalGroupMemberAPI).SID;

https://github.com/tevora-threat/SharpView/blob/master/SharpView/PowerView.cs#L7208

This happens because (as I understand it), it is iterated over the users obtained, looking for the local administrator of the machine (SID ending in "-500"), because the SID of the machine corresponds to the SID of the account of the local administrator user without the "-500" (I detail it in case someone reading the issue doesn't understand the error).

The problem is that it is expected that in that result there is a local administrator user to extract the SID of the machine (which in my case doesn't exist), that's why the exception is generated. I have commented this part, and the command is executed correctly and the expected results are obtained.

I'm going to see if I can change this and make a pull request.
Greetings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant