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

feat: allow cipher enumeration in SSL protocol #4297

Merged
Changes from all 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
27 changes: 27 additions & 0 deletions pkg/protocols/ssl/ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ type Request struct {
// - "auto"
// - "openssl" # reverts to "auto" is openssl is not installed
ScanMode string `yaml:"scan_mode,omitempty" json:"scan_mode,omitempty" jsonschema:"title=Scan Mode,description=Scan Mode - auto if not specified.,enum=ctls,enum=ztls,enum=auto"`
// description: |
// TLS Versions Enum - false if not specified
// Enumerates supported TLS versions
TLSVersionsEnum bool `yaml:"tls_versions_enum,omitempty" json:"tls_versions_enum,omitempty" jsonschema:"title=Enumerate Versions,description=Enumerate Version - false if not specified"`
// description: |
// TLS Ciphers Enum - false if not specified
// Enumerates supported TLS ciphers
TLSCiphersEnum bool `yaml:"tls_ciphers_enum,omitempty" json:"tls_ciphers_enum,omitempty" jsonschema:"title=Enumerate Ciphers,description=Enumerate Ciphers - false if not specified"`
// description: |
// TLS Cipher types to enumerate
// values:
// - "insecure" (default)
// - "weak"
// - "secure"
// - "all"
TLSCipherTypes []string `yaml:"tls_cipher_types,omitempty" json:"tls_cipher_types,omitempty" jsonschema:"title=TLS Cipher Types,description=TLS Cipher Types to enumerate,enum=weak,enum=secure,enum=insecure,enum=all"`

// cache any variables that may be needed for operation.
dialer *fastdialer.Dialer
Expand Down Expand Up @@ -115,6 +131,14 @@ func (request *Request) Compile(options *protocols.ExecutorOptions) error {
// if openssl is not installed instead of failing "auto" scanmode is used
request.ScanMode = "auto"
}
if request.TLSCiphersEnum {
// cipher enumeration requires tls version enumeration first
request.TLSVersionsEnum = true
}
if request.TLSCiphersEnum && len(request.TLSCipherTypes) == 0 {
// by default only look for insecure ciphers
request.TLSCipherTypes = []string{"insecure"}
}

tlsxOptions := &clients.Options{
AllCiphers: true,
Expand All @@ -133,6 +157,9 @@ func (request *Request) Compile(options *protocols.ExecutorOptions) error {
ClientHello: true,
ServerHello: true,
DisplayDns: true,
TlsVersionsEnum: request.TLSVersionsEnum,
TlsCiphersEnum: request.TLSCiphersEnum,
TLsCipherLevel: request.TLSCipherTypes,
}

tlsxService, err := tlsx.New(tlsxOptions)
Expand Down
Loading