Commit Graph

465 Commits

Author SHA1 Message Date
Jeff Cody
1232ca4e60
SMB: Add Negotiation Req & Response for v1
Send SMB1 header, and Negotiation Request message for SMB1.

This brings the zgrab2 smb1 scanner to parity with the zgrab smb1
scanner, with presence detection via smbv1_support.

We check the ProtocolID in the raw data response, for two reasons:

1. Even if the full unmarshal fails for the message, we will log
   that it is an smbv1 server

2. We need to add more response types structs, because the format
   is different for various SMB1 dialects.

The negotiation response v1 structure is for the SMB1 "NT LM 0.12"
dialect, and is essentially placeholder for now for future parsing.

TODO: Unmarshal into the appropriate message struct based on
SMB1 dialect, and parse dialect and capabilities, and return those
results.
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
Jeff Cody
c0f5084a6a
Merge pull request #205 from codyprime/jcody/lib-smbfix
SMB: Bounds check slice index before access
2019-06-05 14:02:20 -04:00
Jeff Cody
2e67991362
SMB: Bounds check slice index before access
The smb library bounds checks for a message size that is too large, but
does not check for a message size that is way too small.  Error out if
the message size is not at least as large as the ProtocolID 4-byte
preamble.

This fixes slice out of bound panics when checking the buffer for the
protID string for certain hosts.

Signed-off-by: Jeff Cody <jcody@censys.io>
2019-06-04 22:26:27 -04:00
Jeff Cody
f2ba12c61d
Merge pull request #204 from codyprime/smb-enhance
SMB 2 Capabilities & Version parsing
2019-05-30 16:51:41 -04:00
Jeff Cody
6e38ec3e72
SMB: Fix typos in schema (PR204 review)
@justinbastress noted a couple of typos in the schema file, and
suggested a doc addition.
2019-05-29 16:15:04 -04:00
Jeff Cody
37bb923ce4
SMB: Parse capabilties flags for the server
This parses the capabilities flags for the server, masking off invalid
flags based on dialect.

While both the NegotiationLogs and SessionSetupLog contain capabilities
flags, we extract the flags from the NegotiationLogs to represent the
server, as it is explicitly stated in [MS-SMB2] that those are the ones
that represent the capabilities of the server.
2019-05-24 15:47:22 -04:00
Jeff Cody
79a96f08ae
SMB: Parse SMB Versions and Dialects.
This parses the SMB Version response, and the dialect, to determine the
full SMB version.  This is done in accordance to "[MS-SMB2] - v20190430"
from Microsoft, Section 2.2.4.
2019-05-24 15:47:10 -04:00
Jeff Cody
2e71f25c85
SMB: Omit Negotiation adn Session logs if empty
Currently, we will output 'null' json fields for either of
these logs if they are not present; instead, let's just omit
them entirely.
2019-05-24 15:33:25 -04:00
Jeff Cody
da90d489b1
SMB: Formatting, line-wrap comments 2019-05-23 13:45:18 -04:00
AnthraX1
bcc4b05d6c Add custom regexp banner grabber (#199)
https://github.com/zmap/zgrab2/pull/199
2019-04-11 17:29:34 -04:00
justinbastress
9c9a8fb2c1
Merge pull request #192 from zmap/benvds/fixSNI
Use Target Domain name in SNI when using HTTP
2019-03-02 10:18:44 -05:00
Benjamin VanderSloot
93f30ef698 Use Target Domain name in SNI when using HTTP
Previous addition of GetTLSConfigForTarget (811eb38) did not modify
HTTP module to use SNI. This let to the very cryptic unknown-error:
remote error: internal error. Some servers give Fatal alerts when
they don't get an SNI extension. Discovered on a `Pagely-ARES/1.3.21`
Server
2019-03-01 21:29:22 -05:00
cindyxkuang
c1da0fffea --root-cas implementation (#189) 2019-02-23 10:47:30 -08:00
justinbastress
808dd3e528 ssh schema updates (re #176) (#187) 2019-02-23 10:47:11 -08:00
justinbastress
377e647417
Merge pull request #186 from zmap/jb/jp-fix
use jp on path (and get/build it if not available)
2019-01-28 09:59:11 -05:00
justinbastress
a137e76c73
Merge branch 'master' into jb/jp-fix 2019-01-25 16:54:16 -05:00
justinbastress
cd5d402a8d
Merge pull request #188 from zmap/jb/integration-test-venv
use a virtualenv to install zschema
2019-01-25 16:52:32 -05:00
Justin Bastress
aa2d162c9c re: @codyprime's comments in #188 2019-01-25 16:32:53 -05:00
Justin Bastress
369cb29d78 mkdir zgrab-output 2019-01-25 16:05:00 -05:00
Justin Bastress
45d3516729 install zschema 2019-01-25 15:47:00 -05:00
Justin Bastress
3400be2b3c use a virtualenv to install zschema 2019-01-25 13:33:28 -05:00
justinbastress
9f19df743e
Merge pull request #176 from sdnewhop/master
SSH: Add banner grabbing
2019-01-23 15:25:29 -05:00
justinbastress
4a6dfdbcc4
Merge pull request #146 from zmap/jb/fixSNI
TLS SNI fixes / API cleanup
2019-01-23 13:43:31 -05:00
Justin Bastress
108ce0a0ab use jp on path (and get/build it if not available) 2019-01-18 13:33:23 -05:00
David Adrian
65a215407a Use Python 3 compatible imports in schemas 2019-01-07 11:58:59 -05:00
justinbastress
1801afed8b
Merge pull request #184 from zmap/jb/fix-unit-tests
fix unit tests
2018-12-18 16:40:32 -05:00
Justin Bastress
fd322d3ecd fix missing format specifier 2018-12-18 16:32:44 -05:00
Justin Bastress
d470615f78 fix unit tests 2018-12-18 16:27:15 -05:00
justinbastress
407a953537 make IPP types IndexedBinary (#183)
https://github.com/zmap/zgrab2/pull/183
2018-12-02 22:14:17 -05:00
justinbastress
2f5b77f5b6
Merge pull request #178 from zmap/jb/mysql-timeout
Stricter bounds checking on MySQL
2018-10-30 09:35:31 -04:00
Justin Bastress
50b77f285a don't trigger constant index-out-of-bounds exceptions 2018-10-24 12:58:11 -04:00
Justin Bastress
28626f0b94 address @parkanzky's comments in #178 2018-10-24 10:29:07 -04:00
justinbastress
e5b7392ab4
Merge pull request #180 from codyprime/dev
Add support for BytesReadLimit parameter in BaseFlags
2018-10-23 10:54:30 -04:00
Jeff Cody
ec59b49540
Add support for BytesReadLimit parameter in BaseFlags
Some protocols may require more data than others.  To accomodate those,
allow the BytesReadLimit to be changed by means of BaseFlags.

By setting BaseFlags.BytesReadLimit prior to calling .Open(), scanners
can override the default limit to one that is appropriate for the data
collected.
2018-10-22 21:59:01 -04:00
Justin Bastress
7294e41bce catch nil body 2018-10-22 13:23:07 -04:00
Oleg Broslavsky
d5aaeca283 Add SSH banner grabbing when userauth enabled
- Bump lib/ssh from golang.org/x/crypto/ssh (just banner hadling)
- Add a banner field to the SSH module info
2018-10-20 03:39:24 -04:00
Justin Bastress
06b72315df add initial work 2018-10-17 16:07:12 -04:00
justinbastress
6c186abf2e
Merge pull request #175 from zmap/pr_172
PR #172 to master
2018-10-09 10:47:41 -04:00
Justin Bastress
8c71100b9e gofmt it 2018-10-08 11:27:06 -04:00
justinbastress
e30f93c6df
Merge pull request #172 from chushuai/master
To ensure that the HTTP connection is not blocked!
2018-10-08 11:24:54 -04:00
cy
2e94480cce
To ensure that the HTTP connection is not blocked! 2018-10-05 14:59:28 +08:00
cy
d5258bdc6e
To ensure that the HTTP connection is not blocked!
https://github.com/zmap/zgrab2/issues/171
2018-10-05 14:51:14 +08:00
justinbastress
15127f1b89
Merge pull request #169 from zmap/jb/mssqlBoundsChecking
add some tighter bounds checking in MSSQL scanner
2018-10-04 11:19:15 -04:00
Justin Bastress
0c6f231dee address @paul's comments and other golint errors 2018-10-02 10:01:41 -04:00
Justin Bastress
65a7c8a578 Merge branch 'jb/session-wide-timeout' into jb/mssqlBoundsChecking 2018-10-01 14:25:04 -04:00
Justin Bastress
6618920234 add some tighter bounds checking in MSSQL scanner, and if there is an uncaught panic, log the body that caused it 2018-10-01 11:08:26 -04:00
Justin Bastress
72dc9e7c5a fix UDP case 2018-09-28 11:52:02 -04:00
Justin Bastress
b207f5ba68 add conn.go tests 2018-09-28 10:58:00 -04:00
Justin Bastress
900b0d5912 add bytelimit tests 2018-09-27 14:00:26 -04:00