AIStudio2API icon indicating copy to clipboard operation
AIStudio2API copied to clipboard

[Bug] Windows Chrome import trusts HKCU App Paths\chrome.exe without verifying Google Chrome, breaking ABE decryption (ERR decrypt)

Open photobrand opened this issue 1 week ago • 0 comments

发生了什么 / What happened

Summary

On Windows, findChromeExecutable() checks HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe first and accepts any existing file without checking whether it is official Google Chrome. When another Chromium-based browser (e.g., CentBrowser) registers HKCU\...\App Paths\chrome.exe, aistudio2api launches that third-party chrome.exe and injects abe_helper_amd64.dll into it, causing GoogleChromeElevationService (IElevator2) to reject DecryptData (ERR decrypt) even when official Google Chrome is installed in Program Files.

Reproduction

  1. Have official Google Chrome installed (with profiles under %LOCALAPPDATA%\Google\Chrome\User Data) and another Chromium browser that wrote HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe pointing to its own binary.
  2. Run Chrome import from the UI or setup.
  3. retrieveV20Key reads Local State from %LOCALAPPDATA%\Google\Chrome\User Data, then findChromeExecutable() resolves HKCU\...\App Paths\chrome.exe (the non-Google binary).
  4. decryptAppBoundCiphertext launches the wrong chrome.exe, abe_helper.c calls DecryptData, and GoogleChromeElevationService rejects it because the calling process path/signature does not match Google Chrome, returning ERR decrypt.

Root Cause Pointers

  1. internal/chromeauth/abe_windows_amd64.go (findChromeExecutable, chromeExecutableFromRegistry):
    • Iterates registry.CURRENT_USER before registry.LOCAL_MACHINE and chromeExecutableFallbacks().
    • Only validates !fileInfo.IsDir(), without checking that the binary belongs to Google Chrome (e.g., company/product version info or Authenticode/path check) or matching chromeRoot.
  2. internal/chromeauth/native/abe_helper.c (call_decrypt / worker):
    • Discards both HRESULT and last_error when DecryptData fails, returning only "ERR decrypt", which hides 0x8004A007 / ERROR_GEN_FAILURE diagnostics.

Suggested Fix

  1. Verify that any registry-discovered chrome.exe is actually Google Chrome (or fall back to the next candidate / Program Files\Google\Chrome\Application\chrome.exe when HKCU points to a non-Google executable).
  2. Include hr (and last_error) in abe_helper.c's error string when DecryptData fails so Windows ABE errors are immediately diagnosable.

版本 / Version

No response

photobrand avatar Nov 21 '26 10:11 photobrand