'Powershell Unprotect Fails With Unknown Error "-805306355"
I'm creating a NetSec project to read Chrome information, but the Powershell Unprotect Function returns an unknown error code while trying to read the AES encryption key.
$user = "powershellFerret";
Add-Type -AssemblyName System.Security;
Write-Host "[+] Running as $user";
$local_state = Get-Content "C:\Users\$user\AppData\Local\Google\Chrome\User Data\Local State" | ConvertFrom-Json;
$encryption_key = $local_state.os_crypt.encrypted_key;
$encryption_key = [System.Convert]::FromBase64String($encryption_key);
$encryption_key = [System.Text.Encoding]::ASCII.GetString($encryption_key);
$encryption_key = $encryption_key.substring(5);
$encryption_key = [System.Text.Encoding]::ASCII.GetBytes($encryption_key);
[Security.Cryptography.ProtectedData]::Unprotect($encryption_key,$null,[Security.Cryptography.DataProtectionScope]::CurrentUser);
Write-Host "[+] AES Encryption Key : $encryption_key";
Returns:
Exception calling "Unprotect" with "3" argument(s): "Unknown error "-805306355"." At C:\Users\powershellFerret\chrome.ps1:13 char:1
- [Security.Cryptography.ProtectedData]::Unprotect($encryption_key,$nul ...
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : CryptographicException
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
