Skip to content

Commit

Permalink
badkeys: handle hostkey reports for unpublished keys (analyzer)
Browse files Browse the repository at this point in the history
  • Loading branch information
hdm committed Jan 17, 2025
1 parent 7c0bd8e commit 3e75ec2
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions cmd/cmd_analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"encoding/base64"
"encoding/csv"
"encoding/hex"
"encoding/json"
"io"
"os"
Expand Down Expand Up @@ -301,11 +302,21 @@ func isBadKey(conf *ScanConfig, res *auth.AuthResult) bool {
if err != nil {
continue
}
res.AddVuln(auth.VulnResult{
ID: "badkeys-" + bkr.RepoType + "-" + bkr.Repo + "-" + bkr.RepoPath + "-" + hkt,
Ref: "https://badkeys.info/",
Proof: bkr.ToURL(),
})
if bkr.Private {
repStr := strconv.FormatUint(uint64(bkr.RepoID), 10)
hexPre := hex.EncodeToString(hpre)
res.AddVuln(auth.VulnResult{
ID: "badkeys-private-" + repStr + "-" + hexPre,
Ref: "https://badkeys.info/",
Proof: repStr + "-" + hexPre,
})
} else {
res.AddVuln(auth.VulnResult{
ID: "badkeys-" + bkr.RepoType + "-" + bkr.Repo + "-" + bkr.RepoPath + "-" + hkt,
Ref: "https://badkeys.info/",
Proof: bkr.ToURL(),
})
}
found++
}
return found != 0
Expand Down

0 comments on commit 3e75ec2

Please sign in to comment.