Skip to content

Commit

Permalink
Fix the process handle leak when using ps command on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: SpadesA99 <[email protected]>
  • Loading branch information
SpadesA99 authored Sep 1, 2023
1 parent f623b0c commit f9c5dae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions implant/sliver/ps/ps_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,14 @@ func getProcessOwner(pid uint32) (owner string, err error) {
if err != nil {
return
}
defer syscall.CloseHandle(handle)

var token syscall.Token
if err = syscall.OpenProcessToken(handle, syscall.TOKEN_QUERY, &token); err != nil {
return
}
defer token.Close()

tokenUser, err := getTokenOwner(token)
if err != nil {
return
Expand Down

0 comments on commit f9c5dae

Please sign in to comment.