Skip to content

Commit

Permalink
fix: improve pwnkit detection (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamg committed Mar 9, 2022
1 parent 2c76630 commit 368dee5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 323 deletions.
23 changes: 23 additions & 0 deletions pkg/exploits/cve20214034/exploit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"

"github.com/google/uuid"
"github.com/liamg/traitor/pkg/logger"
Expand Down Expand Up @@ -34,6 +36,27 @@ func (v *cve20214034Exploit) IsVulnerable(ctx context.Context, s *state.State, l
return false
}

data, err := exec.Command("pkexec", "--version").Output()
if err != nil {
return false
}

bits := strings.Split(string(data), " ")
last := bits[len(bits)-1]

versionBits := strings.Split(last, ".")
if versionBits[0] != "0" || len(versionBits) <= 1 {
return false
}
minorStr := strings.Split(versionBits[1], "-")[0]
minor, err := strconv.Atoi(minorStr)
if err != nil {
return false
}
if minor > 105 {
return false
}

if err := v.Exploit(ctx, s, log.Silenced(), payloads.Payload("true")); err != nil {
return false
}
Expand Down
323 changes: 0 additions & 323 deletions pkg/exploits/exploit_docker_socket.go

This file was deleted.

0 comments on commit 368dee5

Please sign in to comment.