The vulnerability, CVE-2025-48935 (GHSA-8vxj-4cph-c596), is a permission bypass in Deno's node:sqlite module. It allows bypassing Deno's read/write permission checks using the ATTACH DATABASE SQL statement. The root cause of this vulnerability lies in the open_db function located in ext/node/ops/sqlite/database.rs. This function is responsible for creating and initializing SQLite database connections.
Before the fix, open_db did not configure the SQLite connection to restrict potentially harmful features. Specifically, it did not disable the ATTACH DATABASE command (via SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE) nor did it limit the number of databases that could be attached (via SQLITE_LIMIT_ATTACHED). Consequently, when a user executed an ATTACH DATABASE command (e.g., through DatabaseSync.exec()), SQLite would process it without these restrictions, potentially allowing access to arbitrary files on the filesystem, thus bypassing Deno's permission model.
The provided patch (commit 31a97803995bd94629528ba841b2418d3ca01860) directly modifies the open_db function to introduce these missing security configurations. It adds calls to a new helper function set_db_config to explicitly disable SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE (preventing attached databases from being written to in some contexts, though the primary fix is limiting attachments) and SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION (as a defense-in-depth measure). Crucially, it also calls conn.set_limit(Limit::SQLITE_LIMIT_ATTACHED, 0) to prevent any databases from being attached.
While the DatabaseSync.exec() method (and its underlying Deno op) is the function that processes the malicious ATTACH DATABASE SQL statement from the user, the vulnerability itself resides in the insecure setup of the connection by open_db. The exec method's behavior becomes problematic only because the connection it operates on is not properly restricted. Therefore, open_db is identified as the vulnerable function because its previous implementation created the insecure state that enabled the permission bypass.