texhex / BiosSledgehammer

Automated BIOS, ME, TPM firmware update and BIOS settings for HP devices
Apache License 2.0
127 stars 16 forks source link

TLS/HTTPS issue? #41

Closed napzero closed 6 years ago

napzero commented 6 years ago

I tried running StartExampleDownloads.bat and got this error...

Start-DownloadFile : Exception calling "DownloadFile" with "2" argument(s): "The underlying connection was closed: An unexpected error occurred on a send." At C:\temp\BiosSledgehammer_v3.3.2\StartExampleDownloads.ps1:175 char:19

  • ... $tempFile=Start-DownloadFile -URL $URL -DownloadPath $DownloadPath
  • CategoryInfo : NotSpecified: (:) [Start-DownloadFile], MethodInvocationException
  • FullyQualifiedErrorId : WebException,Start-DownloadFile

System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'

Thoughts? BTW I'm new to GitHub, sorry if I'm not not using good form or something.

texhex commented 6 years ago

Regarding if you did everything right: You included all details, confirmed that it was not single machine error and even included a working solution. If all issue reports would be like this, my life would be a lot easier. So, yes you did everything right 👍

I did some in testing regarding this and the base issue is that PowerShell (by default) uses SecurityProtocolType.Tls|SecurityProtocolType.Ssl3 (as this the default in .NET 4.0/4.5) and ftp.hp.com has disabled both protocols as they are unsecure. See http://ssl-checker.online-domain-tools.com/ and enter ftp.hp.com to check which protocols and cipher suites they offer

Your code did the right thing because it turned on TLS 1.1 and 1.2. My code is just a little deviation of yours as it turns on TLS 1.1 and 1.2 without touching the default protocols. If TLS 1.3 ever becomes standard and is supported by .NET, that code should not overwrite it.

[System.Net.ServicePointManager]::SecurityProtocol = 

[System.Net.ServicePointManager]::SecurityProtocol -bor
[System.Net.SecurityProtocolType]'Tls11' -bor 
[System.Net.SecurityProtocolType]'Tls12'

A fix was just pushed. Please do the following:

NOTE: You will get download errors for several BIOS downloads for sure as it seems that HP has removed all BIOS versions without Spectre Fix. This will be the next task on my TODO list.

napzero commented 6 years ago

Awesome! Thank you, and likewise I'm glad to have helped.