0

A couple of weeks ago I made a batch script, using curl, for downloading all Chrome executable files that I could find, for just in case Chrome gets messed up by an update.

Right after running the script, I didn't check to see if the executables are running fine, because I was assuming there wouldn't be a problem with them. So, after letting the script pile up Chrome versions, just a few days ago I got a big surprise when I tried installing an older version of Chrome. None of the files downloaded by the script worked. Each time I'd try running them, I'd get "unknown installer error".

enter image description here

This is the script:

@echo off
set date_and_time=#1_%date:~-10,2%-%date:~3,2%-%date:~-4,4%_%time:~0,2%.%time:~3,2%.%time:~6,2%.#2
md "%USERPROFILE%\Chrome_old_versions\"
set dirct="%USERPROFILE%\Chrome_old_versions\Chrome_%date:~-10,2%-%date:~3,2%-%date:~-4,4%_%time:~0,2%.%time:~3,2%.%time:~6,2%"
md "%dirct%"
cd "%dirct%"
curl --output-dir %dirct% https://dl.google.com/chrome/install/{ChromeStandaloneSetup64}.{exe} -o %date_and_time% 
curl --output-dir %dirct% https://dl.google.com/chrome/install/beta/{ChromeBetaStandaloneSetup64}.{exe} -o %date_and_time%
curl --output-dir %dirct% https://dl.google.com/chrome/install/dev/{ChromeDevStandaloneSetup64}.{exe} -o %date_and_time%
curl --output-dir %dirct% https://dl.google.com/chrome/install/{ChromeStandaloneSetup}.{exe} -o %date_and_time%
curl --output-dir %dirct% https://dl.google.com/chrome/install/beta/{ChromeBetaStandaloneSetup}.{exe} -o %date_and_time%
curl --output-dir %dirct% https://dl.google.com/chrome/install/dev/{ChromeDevStandaloneSetup}.{exe} -o %date_and_time%
curl --output-dir %dirct% https://dl.google.com/chrome/mac/beta/{googlechromebeta}.{dmg} -o %date_and_time%
curl --output-dir %dirct% https://dl.google.com/release2/q/canary/{googlechrome}.{dmg} -o %date_and_time%
curl --output-dir %dirct% https://dl.google.com/chrome/mac/dev/{googlechromedev}.{dmg} -o %date_and_time%

That got me curios about why isn't it working, so I accessed https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe in Chrome and that got me a perfectly working exe. The strange thing is both exes downloaded through Chrome and curl had the same sha 512 hash. As I was puzzled, I tried wget and a powershell script.

For wget, I tried:

wget https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe --no-check-certificate

, which got me again "unknown installer error".

Thanks to @John Seerden, I then used his powershell script, which downloaded a googlechromestandaloneenterprise64.msi working executable. Seeing this, I replaced googlechromestandaloneenterprise64.msi URL in his script with https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe, but still got that error.

$uri = "https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi"

if (-not $PSScriptRoot) {
    $PSScriptRoot = Split-Path -Parent -Path $script:MyInvocation.MyCommand.Definition
}
$outFile = "$PSScriptRoot\googlechromestandaloneenterprise64.msi"

Start-BitsTransfer -Source $uri -Destination $outFile

Start-Process -FilePath $outFile -Args "/qn" -Wait

I even tried downloading https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi using wget and curl, but still got the error.

After some googling, I got across this post, which states something about getting an untagged installer, which I think has been downloaded through a 3rd party program like curl or wget, which ended in prompting "unknown installer error".

After some more googling, I got to this post, but instead of using Charles, I used Chrome Dev Tools to get the curl request from the Network tab. This didn't work either, same error.

Is it there any way I could download perfectly fine running Chrome executables through a script or is it there any way to fix the broken executables? I would prefer to not resort to something like headless Chrome.

rd51
  • 252
  • 4
  • 11
  • 2
    You posted [this question yesterday](https://stackoverflow.com/q/64993272/6738015). My reading, prior to you very recently deleting it, is that a Moderator has suggested it is off topic. Additionally you still need to prove to me that you have absolutely no security software, included with, or added to your Operating System. _Windows does have built-in security_. I'm not sure if you understood my comment in your previous version of this question, but if the hash values of the files are the same, then the downloaded file is the same, irrespecitive of the download method. – Compo Nov 25 '20 at 16:10
  • 3
    i bet it's a permissions issue, and that powershell-created files somehow get different permissions than your curl/wget created files. you can check like this: https://i.imgur.com/ly3sixt.png - maybe powershell and curl even run as different user accounts – hanshenrik Nov 25 '20 at 16:33
  • 3
    It has to to with Alternate Data Streams. `curl` and `wget` only grab the main `$DATA` stream, while downloading the file directly also grabs the `SmartScreen` and `Zone.Identifier` streams. – SomethingDark Nov 25 '20 at 17:01
  • @Compo Now I see what you mean, so you're right, I didn't really understand what you said. So, you must be right, it's something related to security. Also, I'm sorry for deleting it, but after the topic was unlocked after another moderator, I noticed I barely got any views, and I made a request to a moderator if it's possible for the post to show up at the top again, since it was locked for 7 hours, or to advise me for an alterantive. Since I didn't get your answer and no one else was commenting, I saw best fit to publish it again – rd51 Nov 25 '20 at 17:11
  • I will try taking a look at what all of you pointed at. Also, are there any tools to compare the files regarding those aspects, that you know of? – rd51 Nov 25 '20 at 17:17
  • @SomethingDark I just checked for ADS using [this](https://www.nirsoft.net/utils/alternate_data_streams.html) program, but none of the files had any $DATA stream. I also checked for other files, not Chrome executables, and those had. – rd51 Nov 25 '20 at 17:48
  • 1
    I can't get ChromeStandaloneSetup64.exe to run even when I download it from my browser; I just get the same "Unknown Installer Error" message. I think you're getting the installer files from the wrong place. – SomethingDark Nov 25 '20 at 17:53
  • @SomethingDark Oh, you're right, this one gives "Unknown Installer Error", too. The mistake I made was that I assumed the ChromeStandaloneSetup64.exe file, which I got straight from the browser, would run when I got "Do you want to run this file?" prompt. I was afraid of hitting "Run" since I already ran an older version of Chrome, thinking it would somehow damage the settings I made for disabling auto updating. As for the other file, coming from the script, I assumed it was broken since the error came straight up. From now on I will stop assuming things. – rd51 Nov 25 '20 at 18:32
  • I suppose now I have to find a way to grab the Chrome executable behind the "Download Chrome" button at https://www.google.com/chrome/?standalone=1&platform=win64. Which comes in a form like this: `https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BFD62DDBC-14C6-20BD-706F-C7744738E422%7D%26lang%3Den%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Dempty/chrome/install/ChromeStandaloneSetup64.exe` – rd51 Nov 25 '20 at 18:37
  • 1
    I've just found that if you use `curl` (and probably `wget`) on that entire URL, the downloaded file runs correctly. I have no idea why. – SomethingDark Nov 25 '20 at 18:43
  • Yeah, you're right, it's running fine. But the sha 512 hash for 3 files differ. Only the files coming from https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe share the same hash. Now I remember seeing this [comment](https://bugs.chromium.org/p/chromium/issues/detail?id=336523#c5), saying: `Please try downloading the standalone installer using this link: http://www.google.com/chrome/eula.html?system=true&standalone=1 Directly downloading the installer from https://dl.google.com/update2/installers/ChromeStandaloneSetup.exe is not expected to work.` – rd51 Nov 25 '20 at 19:25
  • This https://dl.google.com/update2/installers/ChromeStandaloneSetup.exe (the link in the quoted text above) kinda looks the same as https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe, which also gives a broken exe. – rd51 Nov 25 '20 at 19:27

2 Answers2

2

I used WinMerge for comparing these two standalone Chrome exes, version 86.0.4240.111 - 64 bits and 87.0.4280.66 - 64 bits, respectively ChromeStandaloneSetup64_28-10-2020_14.24.03_valid_Copy_old_version.exe (downloaded from https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe - broken exe aka missing the download URL tags within the exe) and ChromeStandaloneSetup64_valid_Copy_latest_version.exe (downloaded from https://www.google.com/chrome/?standalone=1&platform=win64 - valid exe aka exe that has the download URL tags within it).

As as a comparison, here's a tagged download URL:

https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B04A7785F-B8A2-B4AA-7A45-17861EB0DE70%7D%26lang%3Dro%26browser%3D4%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Ddefaultbrowser/chrome/install/ChromeStandaloneSetup64.exe

and here is an untagged download URL:

https://dl.google.com/chrome/install/ChromeStandaloneSetup64.exe

While in WinMerge, I've searched for "&lang=ro&browser" in ChromeStandaloneSetup64_valid_Copy_latest_version.exe (the file to the right), then I went to Edit > Select Line Difference (F4), then to Merge > Copy to Left. Next, I went to File > Save As > Save Left As...

enter image description here

I then ran the resulting exe (patched exe, having version 86.0.4240.111 64 bits) in a fresh Windows 7 virtual machine (VM), and this time it installed correctly. For testing purposes, I turned off the network, and, when going to the 3 dotted menu in Chrome > Help > About Chrome, indeed, Chrome was the old version. After that, I turned on network and it had been updating to the latest version, 87.0.4280.66 64 bits, running with no problems.

Even though ChromeStandaloneSetup64_valid_Copy_latest_version.exe (valid exe) came with a Zone Identifier Alternate Data Stream (ADS), unlike the broken exe, the resulting exe coming out the broken exe, lacking ADS, it ran perfectly fine in the VM. Regarding ADS, I downloaded the same valid Chrome exe twice (87.0.4280.66 64 bits) and I noticed the ADS had the same exact value.

enter image description here

I also did additional tests and I've noticed if the resulting exe is lacking the appguid and iid fields, it won't install.

Another thing I did, it was messing around with the values in the respective fields, so I made the appguid and iid fields look like this:

appguid={00000000-0000-0000-0000-000000000000}&iid={00000000-0000-0000-0000-000000000000}

, which turned out to make the executable not install, getting Error code: 0x80070057.

Once I was done messing around with the exes editing, I started messing with the URL.

As for this given URL, coming from https://www.google.com/chrome/?standalone=1&platform=win64 (valid exe):

https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B04A7785F-B8A2-B4AA-7A45-17861EB0DE70%7D%26lang%3Dro%26browser%3D4%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Ddefaultbrowser/chrome/install/ChromeStandaloneSetup64.exe

I trimmed down the appguid and iid, getting:

https://dl.google.com/tag/s/lang%3Dro%26browser%3D4%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Ddefaultbrowser/chrome/install/ChromeStandaloneSetup64.exe

, which led to a broken exe, getting the same error code as above, Error code: 0x80070057.

Next thing I did was going to https://codebeautify.org/generate-random-data-from-regexp and generating a random appguid and iid (using hexadecimal values, because that's what I noticed it was being used in those fields) using this pattern:

[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}

, then using two different numbers:

038C42B4-AF87-AD38-990A-4384A7E29E04 - for appguid

EC7C4A9D-76CB-FBA7-D1C2-70EB689DA8F4 - for iid

, I got this link:

https://dl.google.com/tag/s/appguid%3D%7B038C42B4-AF87-AD38-990A-4384A7E29E04%7D%26iid%3D%7BEC7C4A9D-76CB-FBA7-D1C2-70EB689DA8F4%7D%26lang%3Dro%26browser%3D4%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Ddefaultbrowser/chrome/install/ChromeStandaloneSetup64.exe

, which, during installation, got me "Unable to connect to the Internet. If you use a firewall, please whitelist GoogleUpdate.exe" error.

enter image description here

So, since the appguid and iid were coming from a later version of Chrome (appguid and iid taken from 87.0.4280.66 and inserted into 86.0.4240.111), I assume, installation will finish successfully only if the appguid and iid contained in the exe itself, through computation during instalation, will yield a result that matches a value stored somewhere in the exe, or a value that also gets computed during installation. I say this, because when I installed the resulting valid standalone Chrome exe coming from the broken exe, the network was turned off, and there was no prior installation of Chrome on that system. Or maybe those two values are somehow tied to the operating system.

I conclusion, I think I'll end up modifing the URLs in the batch file with those appguid and iid, unless I decide to take a closer look at the URLs of the upcoming releases of Chrome to get an even better idea of how all of this is working.

These:

8A69D345-D564-463C-AFF1-A69D9E530F96 - for appguid

04A7785F-B8A2-B4AA-7A45-17861EB0DE70 - for iid

rd51
  • 252
  • 4
  • 11
2
$Path = $env:TEMP; $Installer = "chrome_installer.exe"; Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait; Remove-Item $Path\$Installer

Once the process is completed, you will see ‘Google Chrome’ icon on your Desktop. Click and run it

BMW
  • 42,880
  • 12
  • 99
  • 116