bogdanfinn / tls-client

net/http.Client like HTTP Client with options to select specific client TLS Fingerprints to use for requests.
BSD 4-Clause "Original" or "Old" License
670 stars 134 forks source link

remote error: tls: unexpected message #6

Closed Harusakii closed 1 year ago

Harusakii commented 1 year ago

It seems to work at pretty much every site, but when you make a simple GET request to google.com, it receives the error remote error: tls: unexpected message

It goes off in the utls package at line 698 [link to code]

Using the normal Chrome 105 client, Header and Headerorder perfectly set.

Thanks for helping

Harusakii commented 1 year ago

I found out the problem, it was the generic extension in the ClientSpec that made problems: &tls.GenericExtension {id: 0x4469} //edit, its the ALPS Extension as mentioned

it brickes some sites

bogdanfinn commented 1 year ago

@Harusakii this issue was reported already several times to me that for some reason the predefined chrome clients do not work on the normal google.com page.

In my implementation there is no GenericExtension in use anymore because i replaced them by the actualy implementations made in the community. Nevertheless for chrome profiles (103, 104, 105) the extension which breaks the google.com page is &ALPSExtension{SupportedProtocols: []string{"h2"}},

Yeah you could argue removing that extension but then the fingerprint would not be chrome anymore because according to wireshark logs this extension is used by chrome.

So just removing the extension is sadly not the solution. Also just using another tls client profile is not the solution as it was suggested in the already deleted comments.

Glad for us that the chrome profile works "at pretty much every site" and google.com is not that important for us.

But this issue is still on my list yeah.

Harusakii commented 1 year ago

@Harusakii this issue was reported already several times to me that for some reason the predefined chrome clients do not work on the normal google.com page.

In my implementation there is no GenericExtension in use anymore because i replaced them by the actualy implementations made in the community. Nevertheless for chrome profiles (103, 104, 105) the extension which breaks the google.com page is &ALPSExtension{SupportedProtocols: []string{"h2"}},

Yeah you could argue removing that extension but then the fingerprint would not be chrome anymore because according to wireshark logs this extension is used by chrome.

So just removing the extension is sadly not the solution. Also just using another tls client profile is not the solution as it was suggested in the already deleted comments.

Glad for us that the chrome profile works "at pretty much every site" and google.com is not that important for us.

But this issue is still on my list yeah.

yeah, tested out and it indeed was ALPS, I think I just mistook the genericextension bc I deleted them both at the same time (to test haha)

and yeah, as long ALPS is used, but doesnt properly work, I guess just switching it off on the sites, where it doesnt work is the way to go now rn

bogdanfinn commented 1 year ago

@Harusakii seems like here is a solution for this issue:

https://github.com/refraction-networking/utls/commit/8d0f1c40c755c9b68f3d8bc926d4934f8ac4286e

bogdanfinn commented 1 year ago

@Harusakii should be resolved now with #v0.8.3

Harusakii commented 1 year ago

@Harusakii should be resolved now with #v0.8.3

tried out and it didnt :/

@Harusakii seems like here is a solution for this issue:

refraction-networking/utls@8d0f1c4

implemented this and it works! maybe implement this in your utls?

bogdanfinn commented 1 year ago

@Harusakii i implemented it in version 0.8.3

make sure your go.mod has these packages in the following versions:

    github.com/bogdanfinn/fhttp v0.5.8 
    github.com/bogdanfinn/tls-client v0.8.3 
    github.com/bogdanfinn/utls v1.5.8 

I implemented that change in utls v1.5.8 https://github.com/bogdanfinn/utls/releases/tag/v1.5.8

Harusakii commented 1 year ago

@Harusakii i implemented it in version 0.8.3

make sure your go.mod has these packages in the following versions:

  github.com/bogdanfinn/fhttp v0.5.8 
  github.com/bogdanfinn/tls-client v0.8.3 
  github.com/bogdanfinn/utls v1.5.8 

I implemented that change in utls v1.5.8 https://github.com/bogdanfinn/utls/releases/tag/v1.5.8

ohhh I see, I just assumed the master branch in utls was updated thats why haha, thank you very much!