What We Learned Reverse-Engineering Dozens of Browser Extensions Before Building Our Own
What We Learned Reverse-Engineering Dozens of Browser Extensions Before Building Our Own Before shipping our own Chrome extensions (a proxy switcher, a session manager, a lead scraper, a few others), we spent time reve
What We Learned Reverse-Engineering Dozens of Browser Extensions Before Building Our Own
Before shipping our own Chrome extensions (a proxy switcher, a session manager, a lead scraper, a few others), we spent time reverse-engineering existing ones in adjacent categories โ unzipping .crx files, reading their bundled JS, watching their network traffic. Some of what we found was fine. Some of it was concerning enough to specifically design against.
Here's the thing that's easy to forget as an extension developer: everything inside an extension is readable. Rename a .crx to .zip, extract it, and the JavaScript is right there โ minified, maybe, but not hidden. Obfuscation slows down a casual look; it doesn't stop someone who actually wants to read your code. So the client can't hold a secret that matters. Real defense has to live server-side.
With that constraint in mind, here's what we saw done wrong, and what we did instead.
Mistake 1: API keys hardcoded in the bundle
The single most common issue. A static string buried in a minified JS file, sometimes base64-encoded (which is not encryption โ it's encoding, trivially reversible), sometimes in plain text. Anyone who unzips the extension has it.
What we do instead: no keys in the client at all. Only public URLs. We added a step to our own packaging pipeline that scans for anything that looks like a secret before producing a release build, and fails the build if it finds one โ a backstop against accidentally shipping a key, not just a policy we rely on people remembering.
Mistake 2: anonymous registration minting real tokens
Some extensions let the client call an "anonymous signup" endpoint that mints a usable access token with no human verification at all. Combined with mistake 1 (or even without it, if the endpoint itself is discoverable from the bundle), this means anyone can script up unlimited account creation.
What we do instead: no anonymous endpoint exists. Account registration happens on the website, behind email verification and a captcha. The extension only ever signs in to an account that was created through that gated flow โ it never creates one.
Mistake 3: trusting a client-generated device ID
A device identifier generated and sent by the client, trusted by the server as if it were a reliable way to distinguish one installation from another. It isn't โ a client can generate as many of these as it wants.
What we do instead: treat the device ID as a label, nothing more. What actually gates access is an account-bound access token plus a device-bound refresh token โ the security boundary is the server-issued credential, not anything the client asserts about itself.
Mistake 4: no request signing, unlimited replay
Some extensions send requests that are just... requests. No signature, no timestamp check, nothing stopping a captured request from being replayed indefinitely.
What we do instead: every request carries an HMAC-SHA256 signature over the method, path, timestamp, a nonce, the device identifier, and a hash of the body. The server enforces a ยฑ30 second window on the timestamp and stores seen nonces to reject replays.
Worth being honest about a limitation here: this proves "this request came from a signed-in session," not "this request came from the official, unmodified extension." A legitimate signed-in user can read their own session's signing key (it has to live in the browser to work) and script requests themselves. HMAC request signing stops replay and tampering โ it does not stop a user from automating their own legitimate access. If that's a threat you're trying to defend against, you need a different mechanism (and it's worth asking whether you actually need to).
Mistake 5: long-lived tokens
Some extensions issue a token once and it's valid more or less forever, with no rotation.
What we do instead: a 15-minute access token, paired with a rotating refresh token. If a refresh token gets reused after it's already been rotated (a signal that someone has an old copy and is trying to use it), the whole session gets revoked โ not just that one token.
Mistake 6: blocking by User-Agent
A surprising number of anti-abuse checks we saw amounted to "does the User-Agent string look right." This is trivial to spoof and provides essentially no real signal.
What we do instead: we don't rely on User-Agent for anything security-relevant. The combination of signed requests, per-account tokens, and per-account rate limits does the actual work.
Mistake 7: shared, long-lived proxy credentials (relevant to anything proxy-adjacent)
For extensions in the proxy/VPN space specifically: some issue proxy credentials that are effectively permanent per account, and don't scope them tightly.
What we do instead: credentials are issued per session, with a short TTL, bound to the account, and kept only in chrome.storage.session (cleared when the browser closes) rather than persisted to disk.
It's worth being honest about this one too: a legitimate user can read their own session's proxy credentials โ they have to exist in the browser to function. The mitigation isn't "the user can never see this," it's short TTLs, a cap on concurrent sessions per account, bandwidth/credit limits, and locking accounts on anomalous behavior. Same philosophy as mistake 4: you're defending against credential leakage and abuse at scale, not against a user inspecting their own session.
The common thread
None of this is exotic. It's mostly: don't trust anything the client asserts about itself, don't put secrets where they can't stay secret, and assume a legitimate user can read their own client-side state, so design the security boundary around the server, not around hiding things from the user.
If you're building a browser extension that talks to a backend, the question worth asking isn't "is my code obfuscated enough" โ it's "if someone reads every line of this extension, unzipped and unminified, what can they actually do with that information, and is that an acceptable amount?"
What's the worst "security by obscurity" pattern you've found reverse-engineering an extension or client-side app? Curious if others are seeing the same handful of mistakes repeated across categories.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.