mirror of
https://github.com/refraction-networking/utls.git
synced 2025-04-05 21:17:35 +03:00
new ClientHellos and Extensions (#116)
* Implement certificate compression
Certificate compression is defined in RFC 8879:
https://datatracker.ietf.org/doc/html/rfc8879
This implementation is client-side only, for server certificates.
* Fix missing LOC
* Add more fingerprints
* Implement ALPS extension
* Merge commit fcaacdbbe7
- At this commit, github.com/Noooste/utls remained at the original upstream LICENSE
* added HelloChrome102 and HelloFirefox102
* Randomly include ALPS in HelloRandomized
Co-authored-by: Harry Harpham <harry@getlantern.org>
Co-authored-by: Sleeyax <yourd3veloper@gmail.com>
Co-authored-by: Rod Hynes <rod-hynes@users.noreply.github.com>
This commit is contained in:
parent
4d3785b233
commit
f781b699a2
5 changed files with 884 additions and 14 deletions
696
u_parrots.go
696
u_parrots.go
|
@ -284,6 +284,235 @@ func utlsIdToSpec(id ClientHelloID) (ClientHelloSpec, error) {
|
|||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
|
||||
},
|
||||
}, nil
|
||||
case HelloChrome_87:
|
||||
return ClientHelloSpec{
|
||||
CipherSuites: []uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
TLS_AES_128_GCM_SHA256,
|
||||
TLS_AES_256_GCM_SHA384,
|
||||
TLS_CHACHA20_POLY1305_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
0x00, // compressionNone
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&UtlsGREASEExtension{},
|
||||
&SNIExtension{},
|
||||
&UtlsExtendedMasterSecretExtension{},
|
||||
&RenegotiationInfoExtension{Renegotiation: RenegotiateOnceAsClient},
|
||||
&SupportedCurvesExtension{[]CurveID{
|
||||
CurveID(GREASE_PLACEHOLDER),
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{
|
||||
0x00, // pointFormatUncompressed
|
||||
}},
|
||||
&SessionTicketExtension{},
|
||||
&ALPNExtension{AlpnProtocols: []string{"h2", "http/1.1"}},
|
||||
&StatusRequestExtension{},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{
|
||||
ECDSAWithP256AndSHA256,
|
||||
PSSWithSHA256,
|
||||
PKCS1WithSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
PSSWithSHA384,
|
||||
PKCS1WithSHA384,
|
||||
PSSWithSHA512,
|
||||
PKCS1WithSHA512,
|
||||
}},
|
||||
&SCTExtension{},
|
||||
&KeyShareExtension{[]KeyShare{
|
||||
{Group: CurveID(GREASE_PLACEHOLDER), Data: []byte{0}},
|
||||
{Group: X25519},
|
||||
}},
|
||||
&PSKKeyExchangeModesExtension{[]uint8{
|
||||
PskModeDHE,
|
||||
}},
|
||||
&SupportedVersionsExtension{[]uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
VersionTLS13,
|
||||
VersionTLS12,
|
||||
VersionTLS11,
|
||||
VersionTLS10,
|
||||
}},
|
||||
&UtlsCompressCertExtension{[]CertCompressionAlgo{
|
||||
CertCompressionBrotli,
|
||||
}},
|
||||
&UtlsGREASEExtension{},
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
|
||||
},
|
||||
}, nil
|
||||
case HelloChrome_96:
|
||||
return ClientHelloSpec{
|
||||
CipherSuites: []uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
TLS_AES_128_GCM_SHA256,
|
||||
TLS_AES_256_GCM_SHA384,
|
||||
TLS_CHACHA20_POLY1305_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
0x00, // compressionNone
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&UtlsGREASEExtension{},
|
||||
&SNIExtension{},
|
||||
&UtlsExtendedMasterSecretExtension{},
|
||||
&RenegotiationInfoExtension{Renegotiation: RenegotiateOnceAsClient},
|
||||
&SupportedCurvesExtension{[]CurveID{
|
||||
CurveID(GREASE_PLACEHOLDER),
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{
|
||||
0x00, // pointFormatUncompressed
|
||||
}},
|
||||
&SessionTicketExtension{},
|
||||
&ALPNExtension{AlpnProtocols: []string{"h2", "http/1.1"}},
|
||||
&StatusRequestExtension{},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{
|
||||
ECDSAWithP256AndSHA256,
|
||||
PSSWithSHA256,
|
||||
PKCS1WithSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
PSSWithSHA384,
|
||||
PKCS1WithSHA384,
|
||||
PSSWithSHA512,
|
||||
PKCS1WithSHA512,
|
||||
}},
|
||||
&SCTExtension{},
|
||||
&KeyShareExtension{[]KeyShare{
|
||||
{Group: CurveID(GREASE_PLACEHOLDER), Data: []byte{0}},
|
||||
{Group: X25519},
|
||||
}},
|
||||
&PSKKeyExchangeModesExtension{[]uint8{
|
||||
PskModeDHE,
|
||||
}},
|
||||
&SupportedVersionsExtension{[]uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
VersionTLS13,
|
||||
VersionTLS12,
|
||||
VersionTLS11,
|
||||
VersionTLS10,
|
||||
}},
|
||||
&UtlsCompressCertExtension{[]CertCompressionAlgo{
|
||||
CertCompressionBrotli,
|
||||
}},
|
||||
&ApplicationSettingsExtension{SupportedProtocols: []string{"h2"}},
|
||||
&UtlsGREASEExtension{},
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
|
||||
},
|
||||
}, nil
|
||||
case HelloChrome_100:
|
||||
signatureScheme := []SignatureScheme{
|
||||
ECDSAWithP256AndSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
ECDSAWithP521AndSHA512,
|
||||
PSSWithSHA256,
|
||||
PSSWithSHA384,
|
||||
PSSWithSHA512,
|
||||
0x0809,
|
||||
0x080a,
|
||||
0x080b,
|
||||
PKCS1WithSHA256,
|
||||
PKCS1WithSHA384,
|
||||
PKCS1WithSHA512,
|
||||
0x0402,
|
||||
0x0303,
|
||||
0x0301,
|
||||
0x0302,
|
||||
0x0203,
|
||||
0x0201,
|
||||
0x0202,
|
||||
}
|
||||
return ClientHelloSpec{
|
||||
CipherSuites: []uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
TLS_AES_128_GCM_SHA256,
|
||||
TLS_AES_256_GCM_SHA384,
|
||||
TLS_CHACHA20_POLY1305_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
0x00, // compressionNone
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&UtlsGREASEExtension{},
|
||||
&SNIExtension{},
|
||||
&UtlsExtendedMasterSecretExtension{},
|
||||
&RenegotiationInfoExtension{},
|
||||
&SupportedCurvesExtension{[]CurveID{
|
||||
GREASE_PLACEHOLDER,
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{
|
||||
0x00, // pointFormatUncompressed
|
||||
}},
|
||||
&SessionTicketExtension{},
|
||||
&ALPNExtension{AlpnProtocols: []string{"h2", "http/1.1"}},
|
||||
&StatusRequestExtension{},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: signatureScheme},
|
||||
&SCTExtension{},
|
||||
&KeyShareExtension{[]KeyShare{
|
||||
{Group: CurveID(GREASE_PLACEHOLDER), Data: []byte{0}},
|
||||
{Group: X25519},
|
||||
}},
|
||||
&PSKKeyExchangeModesExtension{[]uint8{
|
||||
PskModeDHE,
|
||||
}},
|
||||
&SupportedVersionsExtension{[]uint16{
|
||||
VersionTLS13,
|
||||
VersionTLS12,
|
||||
VersionTLS11,
|
||||
VersionTLS10,
|
||||
}},
|
||||
&UtlsCompressCertExtension{[]CertCompressionAlgo{
|
||||
CertCompressionBrotli,
|
||||
}},
|
||||
&UtlsGREASEExtension{},
|
||||
&ApplicationSettingsExtension{SupportedProtocols: []string{"h2"}},
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
|
||||
},
|
||||
}, nil
|
||||
case HelloFirefox_55, HelloFirefox_56:
|
||||
return ClientHelloSpec{
|
||||
TLSVersMax: VersionTLS12,
|
||||
|
@ -403,6 +632,239 @@ func utlsIdToSpec(id ClientHelloID) (ClientHelloSpec, error) {
|
|||
&FakeRecordSizeLimitExtension{0x4001},
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
|
||||
}}, nil
|
||||
case HelloChrome_102:
|
||||
return ClientHelloSpec{
|
||||
CipherSuites: []uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
TLS_AES_128_GCM_SHA256,
|
||||
TLS_AES_256_GCM_SHA384,
|
||||
TLS_CHACHA20_POLY1305_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
0x00, // compressionNone
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&UtlsGREASEExtension{},
|
||||
&SNIExtension{},
|
||||
&UtlsExtendedMasterSecretExtension{},
|
||||
&RenegotiationInfoExtension{Renegotiation: RenegotiateOnceAsClient},
|
||||
&SupportedCurvesExtension{[]CurveID{
|
||||
GREASE_PLACEHOLDER,
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{
|
||||
0x00, // pointFormatUncompressed
|
||||
}},
|
||||
&SessionTicketExtension{},
|
||||
&ALPNExtension{AlpnProtocols: []string{"h2", "http/1.1"}},
|
||||
&StatusRequestExtension{},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{
|
||||
ECDSAWithP256AndSHA256,
|
||||
PSSWithSHA256,
|
||||
PKCS1WithSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
PSSWithSHA384,
|
||||
PKCS1WithSHA384,
|
||||
PSSWithSHA512,
|
||||
PKCS1WithSHA512,
|
||||
}},
|
||||
&SCTExtension{},
|
||||
&KeyShareExtension{[]KeyShare{
|
||||
{Group: CurveID(GREASE_PLACEHOLDER), Data: []byte{0}},
|
||||
{Group: X25519},
|
||||
}},
|
||||
&PSKKeyExchangeModesExtension{[]uint8{
|
||||
PskModeDHE,
|
||||
}},
|
||||
&SupportedVersionsExtension{[]uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
VersionTLS13,
|
||||
VersionTLS12,
|
||||
}},
|
||||
&UtlsCompressCertExtension{[]CertCompressionAlgo{
|
||||
CertCompressionBrotli,
|
||||
}},
|
||||
&ApplicationSettingsExtension{SupportedProtocols: []string{"h2"}},
|
||||
&UtlsGREASEExtension{},
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
|
||||
},
|
||||
}, nil
|
||||
|
||||
case HelloFirefox_99:
|
||||
return ClientHelloSpec{
|
||||
TLSVersMin: VersionTLS10,
|
||||
TLSVersMax: VersionTLS13,
|
||||
CipherSuites: []uint16{
|
||||
TLS_AES_128_GCM_SHA256,
|
||||
TLS_CHACHA20_POLY1305_SHA256,
|
||||
TLS_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
compressionNone,
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&SNIExtension{}, //server_name
|
||||
&UtlsExtendedMasterSecretExtension{}, //extended_master_secret
|
||||
&RenegotiationInfoExtension{Renegotiation: RenegotiateOnceAsClient}, //extensionRenegotiationInfo
|
||||
&SupportedCurvesExtension{[]CurveID{ //supported_groups
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
CurveP521,
|
||||
CurveID(FakeFFDHE2048),
|
||||
CurveID(FakeFFDHE3072),
|
||||
}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{ //ec_point_formats
|
||||
pointFormatUncompressed,
|
||||
}},
|
||||
&SessionTicketExtension{},
|
||||
&ALPNExtension{AlpnProtocols: []string{"h2", "http/1.1"}}, //application_layer_protocol_negotiation
|
||||
&StatusRequestExtension{},
|
||||
&DelegatedCredentialsExtension{
|
||||
AlgorithmsSignature: []SignatureScheme{ //signature_algorithms
|
||||
ECDSAWithP256AndSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
ECDSAWithP521AndSHA512,
|
||||
ECDSAWithSHA1,
|
||||
},
|
||||
},
|
||||
&KeyShareExtension{[]KeyShare{
|
||||
{Group: X25519},
|
||||
{Group: CurveP256}, //key_share
|
||||
}},
|
||||
&SupportedVersionsExtension{[]uint16{
|
||||
VersionTLS13, //supported_versions
|
||||
VersionTLS12,
|
||||
VersionTLS11,
|
||||
VersionTLS10,
|
||||
}},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{ //signature_algorithms
|
||||
ECDSAWithP256AndSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
ECDSAWithP521AndSHA512,
|
||||
PSSWithSHA256,
|
||||
PSSWithSHA384,
|
||||
PSSWithSHA512,
|
||||
PKCS1WithSHA256,
|
||||
PKCS1WithSHA384,
|
||||
PKCS1WithSHA512,
|
||||
ECDSAWithSHA1,
|
||||
PKCS1WithSHA1,
|
||||
}},
|
||||
&PSKKeyExchangeModesExtension{[]uint8{ //psk_key_exchange_modes
|
||||
PskModeDHE,
|
||||
}},
|
||||
&FakeRecordSizeLimitExtension{Limit: 0x4001}, //record_size_limit
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle}, //padding
|
||||
}}, nil
|
||||
case HelloFirefox_102:
|
||||
return ClientHelloSpec{
|
||||
TLSVersMin: VersionTLS10,
|
||||
TLSVersMax: VersionTLS13,
|
||||
CipherSuites: []uint16{
|
||||
TLS_AES_128_GCM_SHA256,
|
||||
TLS_CHACHA20_POLY1305_SHA256,
|
||||
TLS_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
compressionNone,
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&SNIExtension{}, //server_name
|
||||
&UtlsExtendedMasterSecretExtension{}, //extended_master_secret
|
||||
&RenegotiationInfoExtension{Renegotiation: RenegotiateOnceAsClient}, //extensionRenegotiationInfo
|
||||
&SupportedCurvesExtension{[]CurveID{ //supported_groups
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
CurveP521,
|
||||
CurveID(FakeFFDHE2048),
|
||||
CurveID(FakeFFDHE3072),
|
||||
}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{ //ec_point_formats
|
||||
pointFormatUncompressed,
|
||||
}},
|
||||
&SessionTicketExtension{},
|
||||
&ALPNExtension{AlpnProtocols: []string{"h2"}}, //application_layer_protocol_negotiation
|
||||
&StatusRequestExtension{},
|
||||
&DelegatedCredentialsExtension{
|
||||
AlgorithmsSignature: []SignatureScheme{ //signature_algorithms
|
||||
ECDSAWithP256AndSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
ECDSAWithP521AndSHA512,
|
||||
ECDSAWithSHA1,
|
||||
},
|
||||
},
|
||||
&KeyShareExtension{[]KeyShare{
|
||||
{Group: X25519},
|
||||
{Group: CurveP256}, //key_share
|
||||
}},
|
||||
&SupportedVersionsExtension{[]uint16{
|
||||
VersionTLS13, //supported_versions
|
||||
VersionTLS12,
|
||||
}},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{ //signature_algorithms
|
||||
ECDSAWithP256AndSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
ECDSAWithP521AndSHA512,
|
||||
PSSWithSHA256,
|
||||
PSSWithSHA384,
|
||||
PSSWithSHA512,
|
||||
PKCS1WithSHA256,
|
||||
PKCS1WithSHA384,
|
||||
PKCS1WithSHA512,
|
||||
ECDSAWithSHA1,
|
||||
PKCS1WithSHA1,
|
||||
}},
|
||||
&PSKKeyExchangeModesExtension{[]uint8{ //psk_key_exchange_modes
|
||||
PskModeDHE,
|
||||
}},
|
||||
&FakeRecordSizeLimitExtension{Limit: 0x4001}, //record_size_limit
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle}, //padding
|
||||
}}, nil
|
||||
case HelloIOS_11_1:
|
||||
return ClientHelloSpec{
|
||||
TLSVersMax: VersionTLS12,
|
||||
|
@ -524,6 +986,214 @@ func utlsIdToSpec(id ClientHelloID) (ClientHelloSpec, error) {
|
|||
}},
|
||||
},
|
||||
}, nil
|
||||
case HelloIOS_13:
|
||||
return ClientHelloSpec{
|
||||
CipherSuites: []uint16{
|
||||
TLS_AES_128_GCM_SHA256,
|
||||
TLS_AES_256_GCM_SHA384,
|
||||
TLS_CHACHA20_POLY1305_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
DISABLED_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
DISABLED_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
DISABLED_TLS_RSA_WITH_AES_256_CBC_SHA256,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA256,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
0xc008,
|
||||
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
TLS_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
0x00, // compressionNone
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&RenegotiationInfoExtension{Renegotiation: RenegotiateOnceAsClient},
|
||||
&SNIExtension{},
|
||||
&UtlsExtendedMasterSecretExtension{},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{
|
||||
ECDSAWithP256AndSHA256,
|
||||
PSSWithSHA256,
|
||||
PKCS1WithSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
ECDSAWithSHA1,
|
||||
PSSWithSHA384,
|
||||
PSSWithSHA384,
|
||||
PKCS1WithSHA384,
|
||||
PSSWithSHA512,
|
||||
PKCS1WithSHA512,
|
||||
PKCS1WithSHA1,
|
||||
}},
|
||||
&StatusRequestExtension{},
|
||||
&SCTExtension{},
|
||||
&ALPNExtension{AlpnProtocols: []string{"h2", "http/1.1"}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{
|
||||
0x00, // pointFormatUncompressed
|
||||
}},
|
||||
&KeyShareExtension{[]KeyShare{
|
||||
{Group: X25519},
|
||||
}},
|
||||
&PSKKeyExchangeModesExtension{[]uint8{
|
||||
PskModeDHE,
|
||||
}},
|
||||
&SupportedVersionsExtension{[]uint16{
|
||||
VersionTLS13,
|
||||
VersionTLS12,
|
||||
VersionTLS11,
|
||||
VersionTLS10,
|
||||
}},
|
||||
&SupportedCurvesExtension{[]CurveID{
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
CurveP521,
|
||||
}},
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
|
||||
},
|
||||
}, nil
|
||||
case HelloIOS_14:
|
||||
return ClientHelloSpec{
|
||||
// TLSVersMax: VersionTLS12,
|
||||
// TLSVersMin: VersionTLS10,
|
||||
CipherSuites: []uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
TLS_AES_128_GCM_SHA256,
|
||||
TLS_AES_256_GCM_SHA384,
|
||||
TLS_CHACHA20_POLY1305_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
|
||||
DISABLED_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
|
||||
DISABLED_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
DISABLED_TLS_RSA_WITH_AES_256_CBC_SHA256,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA256,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
0xc008,
|
||||
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
TLS_RSA_WITH_3DES_EDE_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
0x00, // compressionNone
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&UtlsGREASEExtension{},
|
||||
&SNIExtension{},
|
||||
&UtlsExtendedMasterSecretExtension{},
|
||||
&RenegotiationInfoExtension{Renegotiation: RenegotiateOnceAsClient},
|
||||
&SupportedCurvesExtension{[]CurveID{
|
||||
CurveID(GREASE_PLACEHOLDER),
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
CurveP521,
|
||||
}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{
|
||||
0x00, // pointFormatUncompressed
|
||||
}},
|
||||
&ALPNExtension{AlpnProtocols: []string{"h2", "http/1.1"}},
|
||||
&StatusRequestExtension{},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{
|
||||
ECDSAWithP256AndSHA256,
|
||||
PSSWithSHA256,
|
||||
PKCS1WithSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
ECDSAWithSHA1,
|
||||
PSSWithSHA384,
|
||||
PSSWithSHA384,
|
||||
PKCS1WithSHA384,
|
||||
PSSWithSHA512,
|
||||
PKCS1WithSHA512,
|
||||
PKCS1WithSHA1,
|
||||
}},
|
||||
&SCTExtension{},
|
||||
&KeyShareExtension{[]KeyShare{
|
||||
{Group: CurveID(GREASE_PLACEHOLDER), Data: []byte{0}},
|
||||
{Group: X25519},
|
||||
}},
|
||||
&PSKKeyExchangeModesExtension{[]uint8{
|
||||
PskModeDHE,
|
||||
}},
|
||||
&SupportedVersionsExtension{[]uint16{
|
||||
GREASE_PLACEHOLDER,
|
||||
VersionTLS13,
|
||||
VersionTLS12,
|
||||
VersionTLS11,
|
||||
VersionTLS10,
|
||||
}},
|
||||
&UtlsGREASEExtension{},
|
||||
&UtlsPaddingExtension{GetPaddingLen: BoringPaddingStyle},
|
||||
},
|
||||
}, nil
|
||||
case HelloAndroid_11_OkHttp:
|
||||
return ClientHelloSpec{
|
||||
CipherSuites: []uint16{
|
||||
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
|
||||
0xcca9, // Cipher Suite: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9)
|
||||
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
|
||||
0xcca8, // Cipher Suite: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8)
|
||||
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_128_GCM_SHA256,
|
||||
TLS_RSA_WITH_AES_256_GCM_SHA384,
|
||||
TLS_RSA_WITH_AES_128_CBC_SHA,
|
||||
TLS_RSA_WITH_AES_256_CBC_SHA,
|
||||
},
|
||||
CompressionMethods: []byte{
|
||||
0x00, // compressionNone
|
||||
},
|
||||
Extensions: []TLSExtension{
|
||||
&SNIExtension{},
|
||||
&UtlsExtendedMasterSecretExtension{},
|
||||
&RenegotiationInfoExtension{},
|
||||
// supported_groups
|
||||
&SupportedCurvesExtension{[]CurveID{
|
||||
X25519,
|
||||
CurveP256,
|
||||
CurveP384,
|
||||
}},
|
||||
&SupportedPointsExtension{SupportedPoints: []byte{
|
||||
0x00, // pointFormatUncompressed
|
||||
}},
|
||||
&StatusRequestExtension{},
|
||||
&SignatureAlgorithmsExtension{SupportedSignatureAlgorithms: []SignatureScheme{
|
||||
ECDSAWithP256AndSHA256,
|
||||
PSSWithSHA256,
|
||||
PKCS1WithSHA256,
|
||||
ECDSAWithP384AndSHA384,
|
||||
PSSWithSHA384,
|
||||
PKCS1WithSHA384,
|
||||
PSSWithSHA512,
|
||||
PKCS1WithSHA512,
|
||||
PKCS1WithSHA1,
|
||||
}},
|
||||
},
|
||||
}, nil
|
||||
default:
|
||||
return ClientHelloSpec{}, errors.New("ClientHello ID " + id.Str() + " is unknown")
|
||||
}
|
||||
|
@ -858,6 +1528,32 @@ func (uconn *UConn) generateRandomizedSpec() (ClientHelloSpec, error) {
|
|||
Versions: makeSupportedVersions(p.TLSVersMin, p.TLSVersMax),
|
||||
}
|
||||
p.Extensions = append(p.Extensions, &ks, &pskExchangeModes, &supportedVersionsExt)
|
||||
|
||||
// Randomly add an ALPS extension. ALPS is TLS 1.3-only and may only
|
||||
// appear when an ALPN extension is present
|
||||
// (https://datatracker.ietf.org/doc/html/draft-vvv-tls-alps-01#section-3).
|
||||
// ALPS is a draft specification at this time, but appears in
|
||||
// Chrome/BoringSSL.
|
||||
if WithALPN {
|
||||
|
||||
// ALPS is a new addition to generateRandomizedSpec. Use a salted
|
||||
// seed to create a new, independent PRNG, so that a seed used
|
||||
// with the previous version of generateRandomizedSpec will
|
||||
// produce the exact same spec as long as ALPS isn't selected.
|
||||
r, err := newPRNGWithSaltedSeed(uconn.ClientHelloID.Seed, "ALPS")
|
||||
if err != nil {
|
||||
return p, err
|
||||
}
|
||||
if r.FlipWeightedCoin(0.33) {
|
||||
// As with the ALPN case above, default to something popular
|
||||
// (unlike ALPN, ALPS can't yet be specified in uconn.config).
|
||||
alps := &ApplicationSettingsExtension{SupportedProtocols: []string{"h2"}}
|
||||
p.Extensions = append(p.Extensions, alps)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: randomly add DelegatedCredentialsExtension, once it is
|
||||
// sufficiently popular.
|
||||
}
|
||||
r.rand.Shuffle(len(p.Extensions), func(i, j int) {
|
||||
p.Extensions[i], p.Extensions[j] = p.Extensions[j], p.Extensions[i]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue