hackmdio / hackmdio/codimd

Open Redirect / XSS via iframe with sandbox.

Open
#1,263 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.1k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

## Summary
This is similar issue to #959, but different cause.
Due to `sandbox` attribute is allowed, attacker can redirect victim to something malicious if attacker embeds iframe with `allow-top-navigation` in `sandbox` attribute.
#959 won't work in Chrome because of their security, but this will work due to `sandbox` is whitelist attribute.
This will be XSS in Safari by using data scheme.
## Step to reproduce
1. Type `````` in Editor. (It doesn't work because my domain is expired.)
2. View edited page.

[PoC](https://demo.codimd.org/YcIX0oKzQAuZMMOqxeASdg)
(This PoC will redirect you to [example.com](https://example.com))

## CVE
[CVE-2019-15499](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-15499)

## Suggested fix
Don't allow `sandbox` attribute in public/js/render.js.

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.