CursorJacking: Rogue Cursor Extensions Can Steal AI API Keys
LayerX reported that Cursor stores API keys and session tokens in a local SQLite database that any installed Cursor extension can read. The attack does not need a prompt injection or user interaction after installation: a benign-looking extension can extract OpenAI, Anthropic, Google, or Cursor credentials and quietly exfiltrate them. The defensive lesson is that AI coding IDEs need protected credential storage, per-extension permission enforcement, and enterprise extension governance.
Threat Analysis
- The secret store was not a real boundary. LayerX says Cursor stores credentials in
state.vscdb, not behind an OS keychain or credential manager. - Any installed extension became a credential reader. A theme, helper, or productivity extension can query the local SQLite database without an obvious credential-access prompt.
- The blast radius leaves Cursor. The database can hold Cursor session tokens and OpenAI, Anthropic, or Google keys; stolen keys enable impersonation, paid API abuse, and prompt or completion exposure.
- This is extension supply chain, not model behavior. After installation, the attack path is local code reading local storage and sending the result to an attacker server.
- Trust semantics matter. If a product treats all extensions as the same local trust boundary, enterprises need extension allowlisting and protected storage before using real keys.
Applicable AIDEFEND Defenses (9)
state.vscdb or post its contents to the internet.What Defenders Should Do Now
- Inventory Cursor and other AI coding IDE installations, then list every installed extension, its source, version, publisher, declared permissions, and whether it runs on machines that hold AI provider keys or cloud credentials.
- Move API keys, session tokens, refresh tokens, and provider credentials out of readable local databases or config files. Prefer OS keychains, encrypted secret stores, short token lifetimes, and logout or uninstall cleanup.
- Block unapproved extensions on developer machines that handle sensitive work. At minimum, separate experimental extension testing from workspaces that contain real customer data, production access, or billable AI provider keys.
- Enforce file and network boundaries around the extension host. Extensions should not be able to read credential databases, cloud CLI profiles,
.envfiles, SSH keys, or secrets managers unless their manifest explicitly requires it and the policy approves it. - Add detections for suspicious local reads and egress: extension processes opening Cursor credential storage, unknown extensions making outbound requests, provider keys used from new locations, and sudden API spend or model-usage spikes.
- If exposure is possible, rotate affected OpenAI, Anthropic, Google, Cursor, and cloud keys; revoke active sessions; review provider logs for recent use; and remove any extension that cannot be tied to a trusted source and owner.
1 additional consideration
Enterprise policy for AI IDEs that cannot enforce extension isolation
Conclusion
CursorJacking is useful because it makes an AI IDE trust boundary visible. The model did not need to misbehave, and the user did not need to approve a dangerous prompt. The failure was simpler: a local extension could read credentials that should have lived behind a stronger boundary. AIDEFEND maps the baseline clearly: protect client credentials, govern installed skills and extensions, enforce per-extension permissions, contain client-side execution, monitor downstream key abuse, and revoke exposed credentials quickly.