decentraland / decentraland/ui2

WearablePreview controller accepts postMessage from any origin (no origin/source validation)

Open
#449 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
2
Avg merge
2h 1m
Merged PRs (30d)
10

Description

## Summary
`src/components/WearablePreview/WearablePreview.controller.ts:99` registers `window.addEventListener('message', handleControllerMessage, false)` and `handleControllerMessage` processes `CONTROLLER_RESPONSE`/`EMOTE_EVENT`/`LOAD` messages with **no `event.origin` or `event.source` validation**. Any frame/window on the page can resolve/reject the controller's pending promises with attacker-controlled payloads.

## Impact
Consuming apps that embed WearablePreview receive forged controller responses/events from an untrusted source. (Same class as the legacy `ui` controller and the `auth` AvatarSetupPage handler.)

## Fix
Validate `event.origin` against the iframe's `src` origin and/or `event.source === iframe.contentWindow` before processing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.