Missing ^ Line Beginner Leads to Origin Spoofing
A regular expression used to validate origins lacked a start-of-string anchor, so a malicious domain could be treated as trusted. This could allow unauthorised interactions with trusted Snaps, bypassing intended restrictions.
- Triaged in 19 days
- Fixed in 3 months
- Paid in 23 days
- Disclosed after 7 months
Summary by the program
@pkkr identified a vulnerability in MetaMask’s regex-based origin validation for endowments. Due to a missing caret (^) anchor at the beginning of the regex pattern in the createOriginRegExp function, origin spoofing was possible. This oversight allowed malicious domains like maliciousmetamask.io to be treated as trusted if the intended rule was to trust metamask.io. This issue could have led to unauthorized interactions with trusted Snaps, bypassing intended security restrictions. We appreciate @pkkr for identifying this flaw and helping us improve MetaMask’s security.
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
Impact
This could have led to unauthorised interactions with trusted Snaps, bypassing intended security restrictions.
What the attacker needed
Attacker controls a crafted domain
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.
A regular expression is a pattern used to check text. If the pattern is not anchored to the start, it can match part of a longer, malicious domain. Here, a domain like maliciousmetamask.io could be accepted as if it were metamask.io.
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.