Possible to spoof Origin in "Connected Sites"
A specially crafted origin starting with a number and a hyphen, such as '0-metamask.io', was rendered in the Connected Sites list as 'metamask.io-0' due to a right-to-left CSS direction. An attacker could register a similar-looking domain to make it difficult for a victim to identify which site to disconnect.
- Triaged in 4 days
- Fixed in 4 months
- Paid in 5 days
- Disclosed after 7 months
Summary by the program
Similarly to how certain account providers allow you to revoke access previously granted to third parties, the Connected Sites list allows for MetaMask users review and revoke access to sites which can send and receive data from MetaMask.
@renniepak discovered that if a MetaMask user connected their wallet to a specially crafted origin, such as 0-metamask.io, it would get rendered in the connected sites tab as metamask.io-0. This has to do with CSS styling MetaMask uses to support left-to-right and right-to-left languages. These specially crafted origins are treated specially by the BIDI algorithm, and results in the domain being incorrectly rendered to the user.
We would like to thank @renniepak for discovering this vulnerability which would allows certain sites to masquerade in this list under the identity of different origin.
The report
Hi MetaMask Team!
I have been experimenting with trying to spoof the origin of the site that is trying to interact with MetaMask. Being able to recognize the origin is an important mechanism in the Web3 ecosystem, because signing anything from a malicious origin could result a loss of funds for example.
I have found that it is possible to partly spoof the origin in the Connect Sites menu , which seems to be caused by a bit of CSS that sets the origin domain name direction to "right-to-left"
Reproduction
- Install the latest MetaMask Chrome Extension (10.18.4) in the latest Chrome version (105.0.5195.127).
- Navigate to https://0-a.nl/metamask23rh23f923f.html
- Accept the request to connect to 0-a.nl
████ █████
- Sign the message (although I believe this is not necessary)

- Open the Extension again and click
Expand view

- Click the 3 dots and then
Connected Sites

Result
What we see now is that not 0-a.nl is shown as a connected site but a.nl-0

Vulnerable code:
This behavior is caused by the fact that our domain name starts with a number and is followed by a hyphen, in combination with the following style sheet:
direction: rtl;
This specific combination of "English" letters, numbers and hyphens and the "right-to-left" direction in the stylesheet, will cause for the order of the characters in the domain name to be messed up, displaying an incorrect domain name.
Exploitation
I understand a.nl-0 is a weird looking domain and might cause some suspicions. But to demonstrate more impact we will pretend I own the domain:
4-metamask.io or more specifically the subdomain https://10.18.4-metamask.io
I didn't purchase this domain so to simulate this, go back to step 6 from the reproduction.
Right click the a.nl-0 and select Inspect Element. Select the line saying <span>0-a.nl</span> and replace it with <span>10.18.4-metamask.io</span>. To emphasize, this is not self-exploitation, we merely do this so we don't need to buy the 4-metamask.io domain to POC this.
Now go back to the browser tab and the result should look like this:

We now spoof the domain metamask.io and use the version number to distract from the fact that a hyphen follows the .io TLD.
Impact
Connecting to a website allows that website to see your MetaMask wallet address and balance, and send transaction approval requests etc. For privacy and safety concerns you might want to disconnect your MetaMask wallet from a malicious website.
As seen in Steps 3 and 4, initially we are not able to spoof the origin in the MetaMask popups. However even if you took those steps by mistake, it should be easily identifiable which website to "Disconnect" should you want so to.
What I've demonstrated in this POC is that we can register a similar looking domain and make it difficult for the victim to distinguish which website to Disconnect from their wallet, with our domain hiding in plain sight.
Like stated in my introduction, the mechanism to manually recognize which Origin is making requests to Metamask is a vital part of the Web3 ecosystem and a secure implementation of the screens to accommodate this should be caried out to all the applicable user interfaces.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the use of a right-to-left CSS direction on origin strings, combined with the BIDI algorithm, caused domains starting with a number and hyphen to be displayed in reversed order.
Impact
An attacker could register a similar-looking domain and make it difficult for the victim to distinguish which website to disconnect from their wallet, with the malicious domain hiding in plain sight.
What the attacker needed
Victim connects wallet to crafted origin; attacker registers similar-looking domain
How it was found
- Install the MetaMask Chrome extension and navigate to a test page.
- Accept the connection request from the test origin.
- Sign a message (optional).
- Open the extension in expanded view and go to Connected Sites.
- Observe that the origin is displayed with characters reordered.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When you connect your crypto wallet to a website, the wallet shows a list of connected sites so you can review or disconnect them. The wallet displayed some website addresses in the wrong order because of a text direction setting, so a malicious site could look like a trusted one. This could trick someone into keeping a connection to a bad site.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.