Skip to content

Commit

Permalink
Add string-based indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
hillu committed Dec 13, 2021
1 parent 04734b5 commit a10ce4d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions log4j-vuln-finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ func handleJar(path string, ra io.ReaderAt, sz int64) {
sum := hex.EncodeToString(hasher.Sum(nil))
if desc, ok := vulnVersions[sum]; ok {
fmt.Printf("indicator for vulnerable component found in %s (%s): %s\n", path, file.Name, desc)
continue
}
if strings.ToLower(filepath.Base(file.Name)) == "jndimanager.class" {
buf := make([]byte, sz)
if _, err := ra.ReadAt(buf, 0); err != nil {
fmt.Printf("can't read JAR file member: %s (%s): %v\n", path, file.Name, err)
continue
}
if !bytes.Contains(buf, []byte("Invalid JNDI URI - {}")) {
fmt.Printf("indicator for vulnerable component found in %s (%s): %s\n",
path, file.Name, "JndiManager class missing new error message string literal")
}
}
case ".jar", ".war", ".ear":
fr, err := file.Open()
Expand Down

0 comments on commit a10ce4d

Please sign in to comment.