Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
YouTube Security VideosAndroid Police: Samsung is smashing records! #shorts #tech #phones(21.09.2026 um 13:55 Uhr)
YouTube Security Videosheise & c't: Bundesnetzagentur wollte diesen Futterautomaten verbieten(21.09.2026 um 13:53 Uhr)
YouTube Security VideosNeil Patel: Your Google Traffic Isn't An Asset It's A Loan #shorts(21.09.2026 um 14:05 Uhr)
Windows Tipps & SecurityF-14 A Tomcat Top Gun endlich als Revell Klemmbausteinmodell erhältlich(21.09.2026 um 14:27 Uhr)
Sichere ProgrammierungShow the Hand-Back Sample Before Approving an Agent Score(21.09.2026 um 14:15 Uhr)
Sichere ProgrammierungHybrid retrieval in one Postgres query: RRF over tsvector + pgvector(21.09.2026 um 14:15 Uhr)
YouTube Security VideosAndroid Police: Samsung is smashing records! #shorts #tech #phones(21.09.2026 um 13:55 Uhr)
YouTube Security Videosheise & c't: Bundesnetzagentur wollte diesen Futterautomaten verbieten(21.09.2026 um 13:53 Uhr)
YouTube Security VideosNeil Patel: Your Google Traffic Isn't An Asset It's A Loan #shorts(21.09.2026 um 14:05 Uhr)
Windows Tipps & SecurityF-14 A Tomcat Top Gun endlich als Revell Klemmbausteinmodell erhältlich(21.09.2026 um 14:27 Uhr)
Sichere ProgrammierungShow the Hand-Back Sample Before Approving an Agent Score(21.09.2026 um 14:15 Uhr)
Sichere ProgrammierungHybrid retrieval in one Postgres query: RRF over tsvector + pgvector(21.09.2026 um 14:15 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

When an API Key Lives in Local Storage: A Subtle but Risky Pattern

While testing a production web application, I noticed a third-party API key (used for consent and privacy management) stored directly in the browser’s localStorage. It’s a common pattern in modern frontends—but one that can quietly expand y…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

While testing a production web application, I noticed a third-party API key (used for consent and privacy management) stored directly in the browser’s localStorage. It’s a common pattern in modern frontends—but one that can quietly expand your attack surface.



This post breaks down why it matters, how it can be abused in real scenarios, and what both developers and bug hunters should look for.









What Happened




  • A consent-management service API key was present in localStorage on page load (no authentication required).

  • Any JavaScript executing in the page context could read it.

  • The key appeared to be used for client-side interactions with a third-party API.











Why This Is Risky






1) Local Storage Is Not a Secret Store



Anything in localStorage is:




  • Readable by any script on the page

  • Persisted across sessions

  • Exposed to browser extensions and injected scripts



If an attacker lands an XSS—even a low-impact one—they can exfiltrate the key instantly.






2) Keys Enable Backend Interaction



Even if the key is “just for a third-party service,” it may:




  • Call APIs that mutate state (e.g., consent records)

  • Access user-related data

  • Trigger workflows like DSAR operations






3) Low Impact Alone, Higher Impact When Chained



On its own, a single exposed key might look benign. Combined with:




  • XSS

  • Misconfigured CORS

  • Over-permissive API scopes



…it can become a practical exploitation path.









Threat Modeling the Scenario



Attacker prerequisites:




  • Ability to run JavaScript in the victim’s browser (XSS, malicious extension, supply-chain script)



What they can do:




  • Read localStorage → extract API key

  • Replay requests to the third-party API

  • Attempt to manipulate consent or privacy data (depending on API permissions)



Potential outcomes:




  • Unauthorized modification of user preferences

  • Abuse of consent APIs

  • Compliance and trust issues









How to Verify (For Bug Hunters)




  1. Open the target site.

  2. Open DevTools → Application tab → Local Storage.

  3. Look for keys like:





  • apiKey, token, auth, clientKey




    1. Trace usage:



  • Search in Sources/Network for where the key is used.



  • Inspect requests made with the key.




    1. Validate impact:



  • Are there write operations?


  • Can you call endpoints outside the app?


  • Are scopes restricted?




Tip: Don’t stop at “key found.” Always try to demonstrate:




  • What the key can do

  • Whether it can be abused outside the browser context









Developer Guidance






1) Don’t Store Secrets in the Browser




  • Treat API keys like credentials.

  • If it must be used client-side, assume it is public.






2) Use a Backend Proxy




  • Keep sensitive keys server-side.

  • Let the frontend call your backend, which then calls the third-party API.






3) Scope and Restrict Keys




  • Limit permissions to the minimum required.

  • Bind keys to specific domains/IPs if supported.

  • Separate read vs write capabilities.






4) Rotate and Monitor




  • Rotate exposed keys immediately.

  • Monitor usage patterns for anomalies.






5) Harden the Client




  • Implement a strict Content Security Policy (CSP).

  • Reduce third-party script exposure.

  • Sanitize and validate all inputs to minimize XSS risk.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten When an API Key Lives in Local Storage: A Subtle but Risky Pattern

Thematisch verwandte Begriffe: When, Lives, Local, Storage · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94097 | A vulnerability was determined in Netcore NBR200V2 1.3.241127.071246. Th…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick