Commit Graph

216 Commits

Author SHA1 Message Date
Silas Cutler
9a23e804e3
Added JARM fingerprinting module (#282)
JARM is an active-fingerprinting technique developed by Salesforce. It was released https://github.com/salesforce/jarm and a write-up on it can be found at: https://engineering.salesforce.com/easily-identify-malicious-servers-on-the-internet-with-jarm-e095edac525a

Co-authored-by: Silas Cutler <silas@blacklab.io>
2021-06-06 19:15:28 -06:00
AG
ecd32d0d5d
Feature fail http to https for known status code and substrings (#308)
* Add `--fail-http-to-https` to retry as HTTPS when --retry-https is used and certain known responses are encountered indicating HTTPS should be used

* Apache: HTTP/400, substring "You're speaking plain HTTP to an SSL-enabled server port"
* NGINX: HTTP/400, substring "The plain HTTP request was sent to HTTPS port"

* Add additional substring observed indicating http->https

* Add another observed substring, adjust whitespace

* Use go-ism for slicing implicitly from index 0

Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
2021-06-06 11:31:36 -07:00
Anthr@X
fcd8f0dc1c
Read probe from file (hex probe support) (#269)
* Adds TLS connection to banner module

* Adds support to read probe from file

Co-authored-by: AnthraX <anthrax1@users.noreply.github.com>
2021-06-06 11:25:09 -07:00
AG
3c55bbe861
Specify arbitrary HTTP headers (#284)
* Add support for specifying arbitrary HTTP headers

* * (Minor, Comment) Fix incorrect comment, replace with more helpful (and accurate) comment
* (Minor, Linting) Rename raw_hash => rawHash, 4 occurences (linter)
* (Minor, Linting) Rename s -> scanner, 1 occurence (linter)
* (Sanity Checking) Prevent duplicate custom headers
* (Sanity Checking) Prevent attempts to set known immutable headers (host, content-length)

* Add --custom-header-delimeter for convenience, in practice, quoting the header values that contain comma can be problematic

* Make the separator consistent for both custom-headers-names and custom-headers-values. It's just weird having them be different :>

* Spelling delimiter correctly would probably help...

* Update modules/http/scanner.go

Co-authored-by: engn33r <engn33r@users.noreply.github.com>

Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
Co-authored-by: Zakir Durumeric <zakird@gmail.com>
Co-authored-by: engn33r <engn33r@users.noreply.github.com>
2021-06-06 11:17:33 -07:00
AG
5e9507cacf
[BUGFIX] Set SNI on each redirect to avoid handshake failures / incorrect server name (#306)
* Set SNI explicitly, in case it's a redirect (fix for #300)

* Fix the SNI issue correctly, using the host portion of addr, while respecting --server-name and --no-sni

* Clean up double error logging pointed out by dadrien

* Comply with RFC4366, do not set SNI server name for IP address

Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
https://github.com/zmap/zgrab2/pull/306
2021-04-09 13:36:07 -06:00
vl4deee11
d3d2a3746a
Fix null results in fox module (#294)
Co-authored-by: vl4deee11 <boi4enkovlad@yandex.ru>
Co-authored-by: vl4deee11 <boi4chenkovlad@yandex.ru>
Co-authored-by: vl4deee11 <boi4enkovlad@yandex>
2021-03-12 19:49:37 -07:00
vl4deee11
0d51d0d401
fix issue 288 (#289)
Co-authored-by: vl4deee11 <boi4enkovlad@yandex.ru>
2021-03-05 09:42:32 -07:00
aspacewalz
d25b7ad901
fix for smtp module (#297)
The SMTP module was matching on "STMP" when verifying the contents of the scan response. This PR fixes the typo and adds a test for the VerifySMTPContents() function.
2021-02-05 07:29:14 -05:00
Benjamin Wireman
d9ed4f141d
improves http body decoding and enforces max length (#295)
https://github.com/zmap/zgrab2/pull/295
2021-02-03 10:56:32 -05:00
Jeff Cody
3613392bf0
telnet: Optionally return result even on error (#277)
Even if the server does not respond to the telnet commands, the
banner may have useful information.  Add the option "--force-banner"
so that the banner string may be returned even on failure.
2020-10-30 10:06:46 -04:00
grace-murphy
8aa9230e29
[DATA-970] Increase buffer size in FTP scanner (#279) 2020-10-21 14:25:43 -04:00
Tim Schumacher
66c842d234 Put body_length behind flag to zschema 2020-09-18 11:01:46 -04:00
Tim Schumacher
c034bb26a1 Use hash setting on getCheckRedirect 2020-09-17 17:14:23 -04:00
Tim Schumacher
fc82b6b673 Capture BodyTextLength 2020-09-17 15:01:27 -04:00
Tim Schumacher
a7ad9a27d2 Combine to single option 2020-09-17 14:08:02 -04:00
Tim Schumacher
40ebf2ae9c Spelling 2020-09-17 13:21:03 -04:00
Tim Schumacher
7c61e14cfc Fix test 2020-09-17 12:15:07 -04:00
Tim Schumacher
f96339b30b Add BodyHashAlgorithm option 2020-09-17 11:31:31 -04:00
Tim Schumacher
8f4f1bb1ec Types 2020-09-17 11:08:26 -04:00
Tim Schumacher
30e6cdb73f Add BodyHash field with hash type prefix 2020-09-17 11:04:27 -04:00
Tim Schumacher
4775cf85f4 Add option to compute http BodySHA256 on decoded BodyText 2020-09-17 10:13:52 -04:00
Benjamin Wireman
6eaaa2fa00
add implicit tls bool to smtp (#266)
https://github.com/zmap/zgrab2/pull/266
2020-06-02 09:06:27 -04:00
Elliot Cubit
457d8a090b
Ecubit/fix false positives (#262)
* telnet module should not return success when it finds something other than telnet

* telnet module should not return success when it finds something other than telnet

* Adds verification step for POP3 banners

* Add validation for IMAP banners & fix some formatting problems

* Verify SMTP banners exist and are successful

* Add check for is_dnp3 flag which seems to be working as expected

* Fix dropping SCAN_APPLICATION_ERROR in IMAP

* Fix dropping SCAN_APPLICATION_ERROR in POP3

* Fix dropping SCAN_APPLICATION_ERROR in SMTP

* Add protocol and blacklist indicators to email protocols

Co-authored-by: Elliot Cubit <elliotcubit@elliots-mbp.lan>
2020-06-01 14:26:24 -04:00
Jeff Cody
f6fbfc53c8
ftp: Add support for implicit TLS
The command line option `--implicit-tls` will attempt connecting via
TLS before intiating the FTP handshake.
2020-05-29 16:10:53 -04:00
Benjamin Wireman
cfd48de9d6
Fix panics in Modbus scanner (#265)
* Check message and body length in in GetModbusResponse()

* add timeout to waiting when PSQL container to start

https://github.com/zmap/zgrab2/pull/265
2020-05-29 13:07:47 -04:00
Jeff Cody
76d09b59c5
http/tls: Add option to override SignatureAndHashes
So that we can advertise a slightly more expansive default set of
signature/hash algorithms in the signature_algorithms extension of
the TLS Client Hello, provide an option to use a pre-defined override.

This also splits up the TLS connection helper in tls.go, so that the
tls.Config can be modified by a scanner module.
2020-05-08 17:32:33 -04:00
bwireman
8395d72fee use DetermineEncoding To try and translate page to UTF8 if possible 2020-03-21 10:51:04 -04:00
Jeff Cody
0bd36c5267
modules/http: Add option to suppress errors when max redirects exceeded (#253)
If the --max-redirects value is exceeded, we return
SCAN_APPLICATION_ERROR with "Too many redirect" as the error message.

Add an option to suppress this error, and return success even if we
exceed the maximum specified number of redirects.
2020-02-28 13:56:18 -05:00
Jeff Cody
909643c227
HTTP Module: Keep scanner.config immutable during scans (#245)
The Scanner.config struct is a configuration for all instances of
Scanner.  Scanner.Scan() is called concurrently by multiple worker
goroutines; while Scanner is dereferenced before the call, the config
struct is a pointer, and so modifications to it will affect all other
running scans done with that Scanner.

Make sure we treat it as immutable during anything invoked by
Scanner.Scan() in the http module.

https://github.com/zmap/zgrab2/pull/245
2020-02-19 14:31:12 -05:00
David Adrian
11425ac78b
Add Description() to ScanModule (#248)
This abstracts more of the help text into the ScanModule definition,
removing some more of the need for `zgrab2.AddCommand()`

https://github.com/zmap/zgrab2/pull/248
2020-02-18 10:24:04 -05:00
Julian Kornberger
f5b169cbd4
Trim SMTP response (#237)
this avoids to have \r\n in the error message
2020-02-03 16:52:37 -08:00
Jeff Cody
82da88e34d
Let HTTP scanner use the custom resolver
If both an IP address and a domain are specified for a scan, have the
HTTP scanner use a fake resolver in the DialContext, so that we always
scan the intended IP and Domain name pair.

However, make sure redirects still function as normal, so only use our
fake resolver if the domain name matches the original targeted domain
name.

In addition, the custom resolver is only used if the network specified
is one that supports domain names.
2020-01-31 14:40:36 -05:00
Jeff Cody
d12c70e5de Honor port override when composing URL (#233)
Commit a38194a added an optional port override as part of the
scan target.  The HTTP and IPP modules, however, still compose
the URL (and select http vs https) by ignoring the override.

This checks for the override, and if present uses the scan target
port.  Otherwise, it falls back to the config port.

https://github.com/zmap/zgrab2/pull/233
2019-11-20 10:14:18 -05:00
cy
0b6d1d994d fixed bug for io.EOF on fox moudle (#207)
fox read with  io.EOF ,but the data  has been returned

https://github.com/zmap/zgrab2/pull/207
2019-09-23 20:51:09 -04:00
Jeff Cody
fb49609733
Remove GetPort() from modules
The previous patch allows the port to be specified in the
`ScanTarget{}`.

Since the port option in the Config may not be the port currently being
scanned, delete the `GetPort()` function provided by each module.

The `GetPort()` function is also not used.  While we could just change
the meaning of this function, to mean "Return the port in the Config",
it is probably better to go ahead and just remove all references to it
as there are no users.
2019-08-21 14:55:14 -04:00
Zakir Durumeric
28cde1a5a6
Add SSH Client Hello Only flag (#215) 2019-08-15 17:01:24 -07:00
Ricky Diaz Gomez
98b142ec2e Redis: Made major, minor, and patchlevel be pointers to ints so that they're correctly omitted 2019-06-28 16:30:12 -04:00
Ricky Diaz Gomez
67fbf1facb Redis: Store the major, minor, and patchlevel as ints as well as the whole version as a string 2019-06-28 15:54:11 -04:00
Ricky Diaz Gomez
7c651c0be5 Redis: Updated setting suffix -- zero value is already empty string 2019-06-25 12:57:40 -04:00
Ricky Diaz Gomez
31788624f2 Redis: Added max file size check 2019-06-25 11:57:47 -04:00
Ricky Diaz Gomez
41df4251b6 Redis: Removed break statement when iterating through INFO response 2019-06-21 16:37:55 -04:00
Ricky Diaz Gomez
bcaf844200 Redis: Made check so that if line_prefix_suffix only contains prefix, adds empty string to suffix index 2019-06-21 16:14:13 -04:00
Ricky Diaz Gomez
f71548ed94 Redis: Missed an old bool check 2019-06-20 17:14:30 -04:00
Ricky Diaz Gomez
84ffc2c667 Redis: Updated the break condition when looking for fields within info_response 2019-06-20 12:17:26 -04:00
Ricky Diaz Gomez
4446024636 Redis: Changed commandMappings to map[string]string, fixed QUIT err=io.EOF bug, and capture redis_mode now 2019-06-19 16:06:43 -04:00
Ricky Diaz Gomez
e12f32b521 Redis: Now gather the OS the server is running 2019-06-19 09:51:40 -04:00
Ricky Diaz Gomez
5be58b2b0d Redis: Actually send the custom commands and store the responses. Also updated the zschema 2019-06-17 17:32:51 -04:00
Ricky Diaz Gomez
f0d9070733 Redis: Takes JSON/YAML file that allows for renaming of commands 2019-06-17 15:23:56 -04:00
Jeff Cody
b69c22c532
SMB: Probe for SMB1 in addition to SMB2
If the probe for SMB2 fails, close the connection and then try probing
for SMB1 as a backup.

Since there are more SMB2 servers in the wild, that is the first
attempt.
2019-06-10 17:17:20 -04:00
Jeff Cody
f2b76412fb
SMB: Combine 'GetSMBLog()' and 'GetSMBBanner()'
These two functions are largely duplicates, and only differ in the
boolean option passed to LoggedNegotiateProtocol().  Combine the
functions, and just take that option in as an argument to pass along.
2019-06-07 16:54:26 -04:00