Skip to content

[iOS] In-app browser ignores Content-Disposition: attachment, renders files inline #1436

Description

@Kay-Zee

Reported by security researcher (Kaushik).

Issue

BrowserViewController's WKNavigationDelegate implements only request-side policy (decidePolicyFor navigationAction, always .allow). There is no decidePolicyFor navigationResponse, so WKWebView's default renders any renderable MIME type inline — including text/html served with Content-Disposition: attachment, which standard browsers download or refuse to render.

Impact

An HTML file uploaded to a trusted file-hosting domain (e.g. Google Drive, served as attachment) renders inline in the in-app browser under that trusted origin — enabling convincing phishing (the page can trigger wallet connect/sign prompts while showing a trusted domain) and access to origin-bound state within the app's webview data store.

Fix

Implement decidePolicyFor navigationResponse: .cancel when the response carries Content-Disposition: attachment (case-insensitive) or the MIME type is non-renderable (canShowMIMEType), else .allow. Extracted as a static, unit-tested policy function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions