Crypto Santa
Crypto Santa

Reputation: 1

How to decrypt chrome passwords from SQLLite?

Chrome v132

I've got the following code:

final Process globalKeyProcess = Runtime.getRuntime().exec("powershell -NoProfile -ExecutionPolicy Bypass -File \"C:\\Users\\scripts\\globalEncryption.ps1\"");
try (AutoCloseable autoCloseable = () -> globalKeyProcess.destroy();
     BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(globalKeyProcess.getInputStream()));
     BufferedReader errorS = new BufferedReader(new InputStreamReader(globalKeyProcess.getErrorStream()))) {
    if ((decryptedEncryptionKey = bufferedReader.readLine()) != null) {
        System.out.println("> " + decryptedEncryptionKey);
        final String dbPath = "C:/Users/" + System.getProperty("user.name") + "/AppData/Local/Google/Chrome/User Data/Default/Login Data";
        try (Connection conn = DriverManager.getConnection("jdbc:sqlite:" + dbPath);
             ResultSet rs = conn.createStatement().executeQuery("SELECT origin_url, username_value, password_value FROM logins")) {
            while (rs.next()) {
                final String url = rs.getString("origin_url");
                final String username = rs.getString("username_value");
                final byte[] passwordBytes = rs.getBytes("password_value");
                // Convert passwordBytes to Base64 for PowerShell
                String base64Password = Base64.getEncoder().encodeToString(passwordBytes);

I've successfully programmatically decrypted the DPAPI local store ENCRYPTION_KEY string, but now I'm so stuck on how to decrypt the individual passwords.

I don't know what algorithm the passwords are encrypted with (assuming AES), and I don't know how to figure out what IV value the data is encrypted with, etc.

I don't need all the passwords decrypted, need to be able to decrypt one by one, so for instance, if using a ps1 script, then the script should be single-use.

Upvotes: 0

Views: 57

Answers (0)

Related Questions