1

I'm wanting to run a Javascript script from my desktop that can pull info from a provided google chrome .localstorage file and I was curious how to do this. I know there is localstorage but that's for within the browser. I want to be able to specify say '\.config\google-chrome\Default\Local Storage\Default\http_asite.com_0.localstorage' where it then returns the k,v pairs inside. I know it is readable to some capacity since you can use tools like DB Browser to do this.

Obj3ctiv3_C_88
  • 1,478
  • 1
  • 17
  • 29

1 Answers1

0

SOOOO, if anyone else wants to do this I wrote this work in progress. It is UAF but concatenates all k,v pairs into a single string to then be parsed out. Since there isn't a really good format to interface with sqlite3, the tables aren't easy to find, and the values are stored as blob it is just a PITA to do. The index of is used to include characters that would typically be removed (so add more if needed). NOTE: This is a mac directory, ubuntu and Window users will need to account for this.

function get_storage() {
    var arrayBuffer;
    var file_path = '/Users/you/Library/Application\ Support/Google/Chrome/Default/Local\ Storage/asite.com.localstorage';
    fs = require('fs');
    fs.readFile(file_path, 'utf8', function (err, data) {
        if (err) {
            return console.log(err);
        } else {
            data = data.toString();
            // Weed out garbage
            data = data.replace(/[^\x00-\x7F]/g, "").replace(/\0/g, '').replace(/\3/g, '').replace('FAIL)', '').split(" ");
            var user_credentials = data[data.length - 1].split("");
            var my_result = [];
            // Account for js keywords 
            for (var i = 0; i < user_credentials.length; i++) {
                if (/\r|\n|\t|\b/.exec(user_credentials[i]) != null ||
                    user_credentials[i].indexOf("@") > -1 ||
                    user_credentials[i].indexOf("!") > -1 ||
                    user_credentials[i].indexOf(".") > -1) {
                    my_result.push(user_credentials[i]);
                }
            }
            // final sweep because some will get missed
            my_result = my_result.join("").split("\n")[0].split("\r")[1];
            // a site's local storage
            console.log(my_result)

        }
    });
}

get_storage();
Obj3ctiv3_C_88
  • 1,478
  • 1
  • 17
  • 29