Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scanner finds 2.15 #305

Merged
merged 8 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tools/log4shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ docker run --network=host log4shell

or

Make sure you have Maven installed, then:
```
./build-payload.sh && go build . && ./log4shell
```
Expand Down
2 changes: 1 addition & 1 deletion tools/log4shell/constants/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
//
package constants

const Version = "1.0.0"
const Version = "1.1.0"
197 changes: 102 additions & 95 deletions tools/log4shell/constants/vulnerablehashes.go

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions tools/log4shell/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ func main() {
Name: "output",
Usage: "File path for where to output findings in JSON format.",
},
&cli.BoolFlag{
Name: "verbose",
Usage: "Display verbose information when running commands.",
},
&cli.BoolFlag{
Name: "json",
Usage: "Display findings in json format.",
},
&cli.BoolFlag{
Name: "debug",
Usage: "Display helpful information while debugging the CLI.",
},
},
Action: scanCommand,
},
Expand Down
10 changes: 6 additions & 4 deletions tools/log4shell/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,20 @@ func identifyPotentiallyVulnerableFile(reader io.Reader, path, fileName string,
return
}

if versionInfo, ok := hashLookup[fileHash]; ok {
if vulnerableHash, ok := hashLookup[fileHash]; ok {
log.Info().
Str("fileName", fileName).
Str("path", path).
Str("versionInfo", versionInfo).
Str("fileName", fileName).
Str("versionInfo", vulnerableHash.Name).
Str("severity", vulnerableHash.Severity).
Msg("identified vulnerable path")

finding = &types.Finding{
Path: path,
FileName: fileName,
Hash: fileHash,
VersionInfo: versionInfo,
VersionInfo: vulnerableHash.Name,
Severity: vulnerableHash.Severity,
}
return
}
Expand Down
1 change: 1 addition & 0 deletions tools/log4shell/types/findings.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Finding struct {
FileName string `json:"file_name"`
Hash string `json:"hash"`
VersionInfo string `json:"version_info"`
Severity string `json:"severity"`
}

type FindingsOutput struct {
Expand Down
7 changes: 6 additions & 1 deletion tools/log4shell/types/vulnerablehashes.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@
//
package types

type VulnerableHashLookup map[string]string
type VulnerableHash struct {
Name string `json:"name"`
Severity string `json:"severity"`
}

type VulnerableHashLookup map[string]VulnerableHash