Missing Line Terminator on allowedOrigins enables origin spoofing
A missing regex terminator in the Snaps allowedOrigins check let a malicious domain bypass origin restrictions and reach restricted Snaps APIs. At worst, a malicious dApp could call the Keyring API's exportAccount method and access sensitive account information from Snaps that implement it.
- Triaged in 9 days
- Fixed in 16 days
- Paid in 20 days
- Disclosed after 4 months
Summary by the program
@pkkr identified a vulnerability in our Snaps allowedOrigins functionality, a functionality which allows a Snap developers to control which origins could interact with certain Snaps APIs. Due to a missing regex terminator, this origin control could be bypassed, allowing a malicious domain to access restricted parts of the Snaps API. At its worst, this would enable malicious dApps to call the Keyring API’s exportAccount method, potentially accessing sensitive account information from Snaps who choose to implement it.
Not only did @pkkr identify this impactful vulnerability, but did so with incredible timing. His prompt report allowed us to address the issue before it reached production.
We would like to thank @pkkr for his continued efforts to demonstrate the impact of this vulnerability and for consistently helping to make MetaMask more secure.
Summary by the researcher
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 origin allow-list was matched with a regular expression that lacked an end anchor, so a crafted origin string could match a permitted origin as a prefix.
Impact
A malicious dApp could bypass origin restrictions and, at worst, call the Keyring API's exportAccount method to potentially access sensitive account information from Snaps that implement it.
What the attacker needed
Target Snap implements exportAccount
The fix
The report says the issue was addressed before it reached production.
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.
Snaps are MetaMask add-ons, and developers can list which websites may talk to them. A missing regex terminator let a malicious domain bypass that list and reach restricted Snaps APIs, including a function that exports account details.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.