You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: How to read DPAPI encrypted chrome credentials offline
3
+
desc: Reading DPAPI encrypted secrets is easy using tools like mimikatz but what
4
+
if the secrets are stored offline in a disk image
5
+
layout: post
6
+
date: March 18, 2023 1:32 AM
7
+
image: /images/posts/dpapi_ctf.jpg
8
+
---
9
+
<h1class="cyan-text">How to read DPAPI encrypted chrome credentials offline</h1>
10
+
11
+
<divclass="content white-text"><p>Recently we were playing DavinciCTF 2023 and I came across a forensics challenge, David Cicode, which was based on DPAPI encrypted chrome credentials. In a real life scenario we use tools like mimikatz to easily get master keys and read chrome secrets but in this challenge all I had was an image file which means offline extraction of secrets without the use of mimikatz!</p></div>
<divclass="content white-text"><p>Mounting an EWF image file is simple. Make sure you have `libewf` or `ewf-tools` depending on the OS you are using. You will have access to `ewfmount` command :</p></div>
<divclass="content white-text"><p>yes I know, colors gone wrong, I still haven't fixed that. Anyways now the Users directory was readable. According to the challenge description goal was to find YouTube credentials.</p></div>
28
+
29
+
<h2class="cyan-text">Chrome secrets</h2>
30
+
31
+
<divclass="content white-text"><p>In windows you will find juicy stuff under the following directory :</p></div>
<divclass="content white-text"><p>We are interested in two files, `Local State` and `Login Data`. State is a JSON file which contains browser information, profile information and encrypted keys for our logins. Login data is a sqlite3 database which contains encrypted passwords.</p></div>
36
+
37
+
<h2class="cyan-text">The problem</h2>
38
+
39
+
<divclass="content white-text"><p> The AES key in state file is protected by Windows DPAPI. We need to decrypt the DPAPI blob to get the AES key and then use it to read the passwords from database.</p></div>
40
+
41
+
<h2class="cyan-text">Crack user password</h2>
42
+
43
+
<divclass="content white-text"><p>Using `DPAPImk2john.py` we can generate a hash based on SID and masterkey of the user. To get SID and masterkey we can simply browse to the following path :</p></div>
<divclass="content white-text"><p>At this point the challenge took a turn and it looks like both state file and login data file were deleted, so now first we need to recover them. For this step I used `TestDisk` utility :</p></div>
<divclass="content white-text"><p>finally I used <ahref="https://github.com/ohyicong/decrypt-chrome-passwords" target="_blank">decrypt-chrome-passwords</a> project to decrypt the password, few modifications are required like the path to login data database, and here is the flag :</p></div>
0 commit comments