Skip to content

Commit

Permalink
Merge pull request #1399 from SpadesA99/SpadesA99-patch-1
Browse files Browse the repository at this point in the history
Fix the process handle leak when using ps command on Windows
  • Loading branch information
moloch-- authored Sep 1, 2023
2 parents f623b0c + f9c5dae commit f32d9a9
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 f32d9a9

Please sign in to comment.