Caloogy Article
中文

Security Boundary of Browser Extension Wallets

Date
Jul 14, 2026
Series
Wallet
Reading
4 min
Topics
WalletBrowser extensionMetamaskClipboard hijacking

The one-sentence version

Extension wallets like MetaMask store encrypted private keys in the browser, and web pages send requests to them via an injected JavaScript interface (EIP-1193). It strikes a middle ground between usability and security: it is more secure than web wallets (the private key is not handed over to the website) but weaker than hardware wallets (the private key and malware reside on the same computer). The main threats come from four directions: fake extensions, other malicious extensions, Trojans on the computer (including clipboard hijackers), and users clicking "confirm" on malicious websites.

This article has three layers:

  1. Layer 1: The Intuition: A safe living inside the browser
  2. Layer 2: Real-World Use: Fake wallets in the app store, clipboard Trojans, and info-stealing Trojans
  3. Layer 3: Model, communication, and engineering details

Layer 1: The Intuition

1.1 A safe living inside the browser

An extension wallet is like a safe living inside your browser:

1.2 But the safe and the thief live in the same building

Thief What they can do
Malicious web page Can only send requests; tricking you into clicking "confirm" is its only way
Other malicious extensions If they have "read and change all your data on all websites" permissions, they can tamper with web content and monitor your input
Trojans on the computer Read the extension's encrypted storage files and then brute-force the password; or log keystrokes to wait for you to type your password
Clipboard hijacker When you copy an address, it silently replaces it with the attacker's address

Layer 2: Real-World Use


Layer 3: Principles and Engineering

3.1 The extension isolation model

Component Where it runs What it can access
Background (Service Worker) The extension's own origin Encrypted keystore, extension storage
Popup The extension's own origin Communicates with the background
Content Script Injected into every web page The web page's DOM, but the JavaScript environment is isolated
Page-injected provider (window.ethereum) Within the web page's environment Can only send requests to the extension via messages

Key point: The private key only exists within the extension's own origin; web pages and content scripts cannot touch it (see "Same-Origin Policy and Subdomain Isolation" for the application of the Same-Origin Policy in extensions).

3.2 How web pages communicate with wallets

EIP-1193 defines the window.ethereum.request({ method, params }) interface. Common methods include:

Method Purpose Risk
eth_requestAccounts Request connection to get address Low, but it exposes your address
eth_sendTransaction Send transaction You must verify the to, value, and data
personal_sign Sign a message Check if the content is human-readable
eth_signTypedData_v4 Sign structured data The primary vehicle for Permit phishing (see "Blind Signing and What You See Is What You Sign")
wallet_switchEthereumChain Switch network Misleads users into operating on the wrong chain

EIP-6963 (2023) solved another problem: when multiple wallet extensions want to write to window.ethereum, the last one installed would overwrite the previous ones, allowing malicious extensions to impersonate others. EIP-6963 changes this so each wallet broadcasts its identity via events, allowing the web page to list them for the user to choose.

3.3 Permissions are the greatest risk factor

Browser extensions can request broad permissions such as "read and change all your data on all websites." Installing an extension with this permission is equivalent to allowing it to modify any web page you open, including the DApp page where the wallet asks for your confirmation.

Suggestions:

3.4 Requirements for developers

3.5 When to switch to a hardware wallet

The fundamental limitation of extension wallets is: the private key and potential malware reside on the same computer. For daily small transactions, extension wallets are very convenient. When storing larger assets, you should use the extension wallet as the "interface" for a hardware wallet (the extension is only responsible for displaying and forwarding, while the signature is completed on the hardware device); see "The Attack Surface of Hardware Wallets."


Summary

Layer Key points
Model The private key is in the extension's own origin; web pages can only send requests
Threats Fake extensions, malicious extensions, info-stealers, clipboard hijacking, tricking you into clicking "confirm"
Technology EIP-1193 request interface; EIP-6963 prevents overwriting/impersonation
Suggestions Dedicated browser profile; minimize extensions; strong passwords; use hardware wallets for large amounts