{"record":{"id":"21d373d42428396f","repo":"moonD4rk/HackBrowserData","slug":"abe-read-local-state-w","errorCode":null,"errorMessage":"abe: read Local State: %w","messagePattern":"abe: read Local State: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"masterkey/abe_windows.go","lineNumber":76,"sourceCode":"\tinj := &injector.Reflective{}\n\tkey, err := inj.Inject(exePath, pl, env)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"abe: inject into %s: %w\", exePath, err)\n\t}\n\tif len(key) != 32 {\n\t\treturn nil, fmt.Errorf(\"abe: unexpected key length %d (want 32)\", len(key))\n\t}\n\tlog.Infof(\"abe: retrieved %s master key via reflective injection\", browserKey)\n\treturn key, nil\n}\n\nfunc loadEncryptedKey(localStatePath string) ([]byte, error) {\n\tif localStatePath == \"\" {\n\t\treturn nil, errNoABEKey\n\t}\n\tdata, err := os.ReadFile(localStatePath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"abe: read Local State: %w\", err)\n\t}\n\n\traw := gjson.GetBytes(data, \"os_crypt.app_bound_encrypted_key\")\n\tif !raw.Exists() {\n\t\treturn nil, errNoABEKey\n\t}\n\n\tdecoded, err := base64.StdEncoding.DecodeString(raw.String())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"abe: base64 decode: %w\", err)\n\t}\n\tif len(decoded) <= len(appbPrefix) {\n\t\treturn nil, fmt.Errorf(\"abe: encrypted key too short: %d bytes\", len(decoded))\n\t}\n\tfor i, b := range appbPrefix {\n\t\tif decoded[i] != b {\n\t\t\treturn nil, fmt.Errorf(\"abe: unexpected prefix: got %q, want %q\",\n\t\t\t\tdecoded[:len(appbPrefix)], appbPrefix)","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/moonD4rk/HackBrowserData/blob/0503d04d7a8d0379d060268a74f1b149e5a0aad5/masterkey/abe_windows.go#L58-L94","documentation":"loadEncryptedKey reads Chrome's 'Local State' JSON file to extract os_crypt.app_bound_encrypted_key. This error wraps an os.ReadFile failure, meaning the Local State file could not be opened or read (missing file, permission denied, locked, etc.).","triggerScenarios":"Calling RetrieveKey (which calls loadEncryptedKey) with a localStatePath pointing to a nonexistent, unreadable, or locked 'Local State' file, or when Chrome is running and holds an exclusive lock on the profile.","commonSituations":"Wrong profile path passed in (e.g. pointing at the wrong user data dir); running without permissions to read another user's profile; Chrome running and file locked on Windows; empty path (though empty path short-circuits to errNoABEKey first).","solutions":["Verify localStatePath points at <user data dir>/Local State for the correct profile and user.","Check file permissions / run with the rights needed to read the target profile.","Close Chrome (or copy the file first) if the file is locked by a running browser instance.","If the file genuinely doesn't exist, treat this as errNoABEKey and fall back to a non-ABE decryption path instead of failing."],"exampleFix":"// before\nkey, err := RetrieveKey(exePath, localStatePath)\n// after - pre-check the file before attempting ABE\nif _, err := os.Stat(localStatePath); err != nil {\n\tlog.Warnf(\"Local State not readable at %s: %v; skipping ABE\", localStatePath, err)\n\treturn fallbackDecrypt()\n}\nkey, err := RetrieveKey(exePath, localStatePath)","handlingStrategy":"validation","validationCode":"info, err := os.Stat(localStatePath)\nif err != nil {\n\treturn fmt.Errorf(\"Local State not accessible at %s: %w\", localStatePath, err)\n}\nif info.IsDir() {\n\treturn fmt.Errorf(\"%s is a directory, expected the Local State file\", localStatePath)\n}","typeGuard":null,"tryCatchPattern":"key, err := RetrieveKey(exePath, localStatePath)\nif err != nil {\n\tif errors.Is(err, os.ErrNotExist) || errors.Is(err, os.ErrPermission) {\n\t\tlog.Warnf(\"cannot read Local State: %v; skipping ABE\", err)\n\t\treturn fallbackDecrypt()\n\t}\n\treturn err\n}","preventionTips":["Resolve the profile path from the browser's actual user-data directory instead of hardcoding it.","Pre-flight os.Stat on the Local State path before invoking ABE extraction.","Copy the file when Chrome is running, since it may hold locks on Windows."],"tags":["windows","chrome","file-io","local-state"],"backgroundTag":"file-read-failed","analyzedSha":"0503d04d7a8d0379d060268a74f1b149e5a0aad5","analyzedAt":"2026-09-06T13:38:28.707Z","contentChangedAt":"2026-09-06T13:38:28.707Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}