CVE-2026-115453: Cross user deletion and modification of cart and wishlist rows in Ecommerce Template through unscoped primary key queries
Authorization Bypass Through User-Controlled Key (CWE-639) in the cart and wishlist repositories of MarcosCamara01 Ecommerce Template allows any authenticated user to delete and modify the cart and wishlist rows of any other user, because cartRepository.delete(), cartRepository.updateQuantityInternal() and wishlistRepository.delete() in src/lib/db/drizzle/repositories/ match rows by primary key alone, with no predicate on the owning user, and the per user authorization for those three operations rests on PostgreSQL row level security. The migrations run ALTER TABLE ... ENABLE ROW LEVEL SECURITY and create policies comparing app.currentuserid() with userid, but never ALTER TABLE ... FORCE ROW LEVEL SECURITY, and PostgreSQL does not apply policies to the role that owns a table. The template uses one DATABASEURL both to run the migrations, which create the tables, and for the application at runtime, so the application connects as the owner of the tables and the policies do not apply to it. cartitems.id and wishlist.id are sequential bigserial values, so the identifiers of rows belonging to other users can be enumerated, and the update path returns the modified row, which carries the identifier of the user it belongs to. This results in the destruction and modification of cart and wishlist contents belonging to other accounts of the installation.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch adf7dedbb41894c0bad0b33a26999b0da7e967b7 - Configuration
Enable row-level security and create policies comparing app.current_user_id() with user_id, then ALTER TABLE the affected tables to FORCE ROW LEVEL SECURITY so policies also apply to the table-owning role.
PostgreSQL row-level security for cart and wishlist tables Row-level security policies and FORCE ROW LEVEL SECURITY = enabled; policies compare app.current_user_id() with user_id; FORCE ROW LEVEL SECURITY enabled
Event History
Frequently Asked Questions
Which deployments are exposed?
Deployments are exposed when the application uses the same DATABASE_URL used for migrations and therefore connects as the role that owns the tables. PostgreSQL row-level security policies do not apply to a table-owning role unless row-level security is forced.
What does an attacker need to exploit this?
The attacker needs to be an authenticated user and needs target cart or wishlist row identifiers. The affected identifiers are sequential bigserial values, so identifiers belonging to other users can be enumerated.
How can I determine whether row-level security protects this deployment?
Check whether the runtime database role owns the cart and wishlist tables, and whether those tables have been configured with FORCE ROW LEVEL SECURITY. Merely enabling row-level security and creating policies is insufficient when the application connects as the table owner.
Which operations lack ownership scoping?
The affected operations are cartRepository.delete(), cartRepository.updateQuantityInternal(), and wishlistRepository.delete(). They match rows by primary key without a predicate restricting the row to the authenticated user.