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

Permissive TLS parsing #400

Merged
merged 2 commits into from
Feb 18, 2024
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
8 changes: 7 additions & 1 deletion tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import (
"time"

log "github.com/sirupsen/logrus"
"github.com/zmap/zcrypto/encoding/asn1"
"github.com/zmap/zcrypto/tls"
"github.com/zmap/zcrypto/x509"
"github.com/zmap/zcrypto/x509/pkix"
)

// Shared code for TLS scans.
Expand Down Expand Up @@ -65,7 +67,7 @@ type TLSFlags struct {
// TODO: format?
ClientRandom string `long:"client-random" description:"Set an explicit Client Random (base64 encoded)"`
// TODO: format?
ClientHello string `long:"client-hello" description:"Set an explicit ClientHello (base64 encoded)"`
ClientHello string `long:"client-hello" description:"Set an explicit ClientHello (base64 encoded)"`
}

func getCSV(arg string) []string {
Expand Down Expand Up @@ -149,6 +151,10 @@ func (t *TLSFlags) GetTLSConfigForTarget(target *ScanTarget) (*tls.Config, error
log.Fatalf("Could not read certificates from PEM file. Invalid PEM?")
}
}

asn1.AllowPermissiveParsing = true
pkix.LegacyNameString = true

if t.NextProtos != "" {
// TODO: Different format?
ret.NextProtos = getCSV(t.NextProtos)
Expand Down