Comments (7)
The original doesn't work on Windows 10 because it is hard coded to use wininit.exe, which is a protected process in Windows 10. It's necessary to find another process to use. Better to check all available processes and find one that works than to use a hard coded process name.
I overlooked the fact that -IncludeUserName is PowerShell 4+ when I modified it. Obviously that breaks it on earlier versions. Will need to figure out another way to accomplish this.
from powersploit.
Understood!
from powersploit.
The below code should get the username for the processes on versions of PowerShell lower than 4:
[psobject]$AllProcessesFromWMI = Get-WmiObject -Class Win32_Process -ErrorAction 'SilentlyContinue'
[psobject[]]$AllProcessUserNames = @()
ForEach ($Process in $AllProcessesFromWMI) {
Try { $ProcessOwnerInfo = $Process.GetOwner() } Catch { Continue }
[psobject]$ProcessUserNameInfo = New-Object -TypeName 'PSObject' -Property @{
PID = $Process.ProcessId
NTAccount = If ($ProcessOwnerInfo.User) { "$($ProcessOwnerInfo.Domain)\$($ProcessOwnerInfo.User)" } Else { [string]::Empty }
}
[psobject[]]$AllProcessUserNames += $ProcessUserNameInfo
}
[string]$LocalSystemNTAccount = (New-Object -TypeName 'System.Security.Principal.SecurityIdentifier' -ArgumentList ([Security.Principal.WellKnownSidType]::'LocalSystemSid', $null)).Translate([Security.Principal.NTAccount]).Value
[int32[]]$AllSystemAccountProcessesIDs = $AllProcessUserNames | Where-Object { $_.NTAccount -eq $LocalSystemNTAccount} | Select-Object -ExpandProperty 'PID'
$SystemTokens = Get-Process | Where { $AllSystemAccountProcessesIDs -contains $_.Id }
I guess a nicer way would be to create a function that extends the results of the Get-Process function by adding a NoteProperty called NTAccount that contains the Domain\Username. But the above does the trick.
from powersploit.
Of course WMI is kind of slow. The Win32 method for getting a process username is much faster. Linking to an article about that here:
http://www.codeproject.com/Articles/14828/How-To-Get-Process-Owner-ID-and-Current-User-SID
from powersploit.
Sorry for the delay on this. Does anyone want to validate the fix?
from powersploit.
Thank you sir, fix verified!
from powersploit.
Thanks for bringing this to our attention!
from powersploit.
Related Issues (20)
- Powerup missing security check
- Invoke-ReflectivePEInjection Cascade of errors HOT 5
- Full QualifiedErrorId when using the command 'get-Netuser' : BadEnumeration HOT 1
- Invoke-Mimikatz + Windows 10 (1909) HOT 2
- It is possible to use Invoke-ReflectivePEInjection with Pyinstaller .exe?
- Get-ObjectAcl resolve SID in SecurityIdentifier
- Simple authentication instead of SASL
- PowerUp gives a lot of errors HOT 2
- Get-NetLocalGroup access
- delete
- Searching files by content
- Constrained Delegation
- Invoke-mimikatz in one ligne
- Cryptodome error?
- Get-NetLoggedon and Get-NetSession data displayed incorrectly
- Invoke-ReflectivePEInjection with meterpreter exe payload quits powershell
- Get-DomainPolicyData is not recognized when importing PowerSploit.psm1 module HOT 1
- The Commands (for example Get-NetDomain, Get-DomainPolicy) don't show any output, and continue to the next command line HOT 1
- please can we get an update on invoke-mimikatz?
- Remove-Comment doesnt seem to work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from powersploit.