Skip to content

Conversation

@Tyschenko
Copy link

We currently have an anti-fishing warning which is displayed when user opens a malicious website.
But there is a way to bypass this warning if you load a malicious website via iFrame.

We can inject a JS script in the mobile browser that will check webpage's iFrames and report their URLs to the browser in MetaMask mobile app.

@Tyschenko Tyschenko requested a review from smilingkylan June 25, 2025 15:05
@Tyschenko Tyschenko added the bug Something isn't working label Jun 25, 2025
const iframe = iframes[i];
const src = iframe.src;

if (src && src.trim() !== '' && (src.startsWith('http://') || src.startsWith('https://') || src.startsWith('//'))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reasoning for including src.startsWith('//') ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you specify iFrame with //, it will use current website's protocol (http or https)

@Tyschenko Tyschenko merged commit 29ded70 into main Jun 26, 2025
10 checks passed
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Jul 21, 2025
…e urls and send them to React Native app (#16706)

## **Description**
Issue: https://github.com/MetaMask/mobile-planning/issues/2227

We currently have an anti-fishing warning which is displayed when user
opens a malicious website.
But there is a way to bypass this warning if you load a malicious
website via iFrame.

Example of the malicious website: https://coin-qr.to/
Example of the website with a malicious iFrame:
https://lol-au4.pages.dev/cb (opens coin-qr.to inside in the iFrame)
We can inject a JS script in the mobile browser that will check
webpage's iFrames and report their URLs to the browser in MetaMask
mobile app.

## **Related issues**
Android change:
MetaMask/react-native-webview-mm#60
iOS change: MetaMask/react-native-webview-mm#61

## **Manual testing steps**

1. Go to https://lol-au4.pages.dev/cb
2. Make sure warning is displayed
3. Go to coin-qr.to
4. Make sure warning is displayed
5. Go to uniswap.org
6. Make sure NO warning is displayed

## **Screenshots/Recordings**

Android and iOS videos:

https://github.com/user-attachments/assets/dba5ff6e-5c7b-41d6-9a8c-426dfb7dede6

https://github.com/user-attachments/assets/dd90b6d5-28c6-47de-9ee6-daa5f048ea44

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants