Closed ricardogolez closed 11 months ago
Btw, it's working on non-admin side. I noticed that you're getting the local state file which is from the current user so my problem is I'm getting it from a direct path because I'm using an executable as a service. This problem occurs when I use this function(s) as an admin executable because it's getting the local state file from root not from path down from the specified fPath
example is C:\Users\
when I run as admin, the os.Getenv(AppData
) returns a different Path but the target cookies is the top one
The "Local State" file is being looked for 1 or 2 directories above the directory of the cookie store - this does not depend on the user. Chrome encrypts cookies on Windows with CryptProtectData without setting CRYPTPROTECT_LOCAL_MACHINE restricting the decryption to the current user. The keyrings on Linux also make the decryption user bound.
Thanks for the reply! I still encounter this issue especially running it on admin
For now i believe that you can only get/decrypt a cookie that was created by the same user.
Did you run the browser session that created the cookie also under the admin user?
No, but the service was running on admin. it works perfectly if the program is run outside program files (tested it on flag commands and also running the service's program on desktop folder).
Closing this as not a bug. You have to read the Chrome cookie values under the same user the browser which set those was executed.
Error was: Crypto/Cipher: input not full blocks
and it's tracing back to decrypt function when using edge.ReadCookies(fPath)/chrome.ReadCookies(fPath) for ubuntu and windows
function throwing the error: CryptBlocks @ if len(src)%x.BlockSize != 0