-
Notifications
You must be signed in to change notification settings - Fork 309
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
jarm: update jarm to not fail on handshake failure #328
Conversation
|
||
// ret, err = zgrab2.ReadAvailable(conn) | ||
ret, err = zgrab2.ReadAvailableWithOptions(conn, 1484, 500*time.Millisecond, 0, 1484) | ||
if err != io.EOF && err != nil { | ||
rawhashes = append(rawhashes, "") | ||
conn.Close() | ||
continue | ||
} | ||
ret, _ = zgrab2.ReadAvailableWithOptions(conn, 1484, 500*time.Millisecond, 0, 1484) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears to be the case that error responses from the target should still be processed by ParseServerHello
which contains logic for handling the various failure responses appropriately.
@@ -142,12 +130,11 @@ func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, inter | |||
continue | |||
} | |||
|
|||
rawhashes = append(rawhashes, string(ans)) | |||
rawhashes = append(rawhashes, ans) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ans
is already a string. no need to cast.
@@ -120,20 +114,14 @@ func (scanner *Scanner) Scan(target zgrab2.ScanTarget) (zgrab2.ScanStatus, inter | |||
return zgrab2.TryGetScanStatus(err), nil, err | |||
} | |||
|
|||
_, err = conn.Write([]byte(data)) | |||
_, err = conn.Write(jarm.BuildProbe(probe)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data was already a byte slice and was also only used in this function call.
} | ||
if err != nil { | ||
return ret, err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this block err
is ALWAYS nil
so i removed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code cleanup changes look good.
Tested against a known problem host, verified the changes after matched the salesforce jarm tool fingerprint.
This PR removes the error handling for a JARM probe response. The reason is that a handshake failure should still be processed the same as any other response. Currently a handshake failure results in the ZeroHash value being returned. This does not match the salesforce jarm module which should be treated as the correct implementation.
After this change, the salesforce and zgrab2 modules will both return the same fingerprint for services that return a handshake failure to one of the probes.
How to Test
go test ./...
Notes & Caveats
This PR is being created to bring the zgrab2 JARM module in line with the behavior of the salesforce jarm tool.