Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Chromium Local Storage on LevelDB

From ReverseEngineering.wiki
Format
License BSD-3-Clause
On this wiki Facts · Code · Notes · Topics

Chromium/Electron Local Storage in a LevelDB directory (Local Storage/leveldb): a VERSION key, META: entries per storage key and data keys of the form '_' + serialized origin + NUL + item key, with a one-byte value format tag. Newer Chromium is migrating it to SQLite.

Overview

In Chromium-based apps (Library:Electron, Library:Chromium Embedded Framework) window.localStorage is persisted by the storage service in a LevelDB directory called Local Storage/leveldb inside the profile (see Format:LevelDB database). The key layout below is from components/services/storage/dom_storage/local_storage_impl.cc at Chromium tag 120.0.6099.71.

Keys

  • VERSION: schema version as a decimal string (kCurrentLocalStorageSchemaVersion = 1).
  • META: + serialized storage key (origin): per-origin metadata (a protobuf with modification time and size; a LocalStorageStorageKeyMetaData message with required int64 last_modified = 1 (base::Time internal value) and required uint64 size_bytes = 2, in components/services/storage/dom_storage/local_storage_database.proto at tag 120.0.6099.71).
  • _ + serialized storage key + 0x00 + item key: one stored item. The serialized storage key is the origin text such as https://example.com (SerializeForLocalStorage). The _ prefix and the 0x00 separator are in MakeStorageKeyPrefix.
  • The script-controlled item key and the value each start with a one-byte format tag, 0 = UTF-16 (raw UChar bytes, little-endian on x86/ARM) and 1 = Latin-1 (ISO-8859-1); the writer picks Latin-1 whenever the string has only Latin-1 characters, so values commonly start with 0x01 (StorageFormat enum at line 32 and kLocalStorageDetectFormat branches at lines 650-660, 719-737 and 802-820 of third_party/blink/renderer/modules/storage/cached_storage_area.cc at tag 120.0.6099.71).

A storage area caps at 10 MB (kPerStorageAreaQuota in dom_storage_constants.h) and storage keys become eligible for deletion after 400 days of inactivity.

Newer versions

dom_storage_constants.h on the main branch mentions a temporary SQLite database built during migration (extension "Migrating"), so recent Chromium builds may store Local Storage in SQLite instead of LevelDB; check the profile for both. See Format:SQLite database file. Unverified: the file name and schema of the new database.

Reversing notes

Local Storage entries are readable with any LevelDB reader because values are not compressed beyond Snappy blocks; look for ASCII origin strings near the keys. Related page: Format:Chromium IndexedDB on LevelDB.

See also

Format:Snappy