Skip to content

Commit 368dee5

Browse files
authored
fix: improve pwnkit detection (#79)
1 parent 2c76630 commit 368dee5

File tree

2 files changed

+23
-323
lines changed

2 files changed

+23
-323
lines changed

pkg/exploits/cve20214034/exploit.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10+
"strconv"
11+
"strings"
1012

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

39+
data, err := exec.Command("pkexec", "--version").Output()
40+
if err != nil {
41+
return false
42+
}
43+
44+
bits := strings.Split(string(data), " ")
45+
last := bits[len(bits)-1]
46+
47+
versionBits := strings.Split(last, ".")
48+
if versionBits[0] != "0" || len(versionBits) <= 1 {
49+
return false
50+
}
51+
minorStr := strings.Split(versionBits[1], "-")[0]
52+
minor, err := strconv.Atoi(minorStr)
53+
if err != nil {
54+
return false
55+
}
56+
if minor > 105 {
57+
return false
58+
}
59+
3760
if err := v.Exploit(ctx, s, log.Silenced(), payloads.Payload("true")); err != nil {
3861
return false
3962
}

pkg/exploits/exploit_docker_socket.go

Lines changed: 0 additions & 323 deletions
This file was deleted.

0 commit comments

Comments
 (0)