Commit ee1276c
fix(dom render): sandbox captured DOM in iframe; CSP meta is bypassable
The previous mitigation appended a CSP <meta> as the last child of <head>,
so any attacker <script> inside <head> was parsed before the policy took
effect. Because the blob: document inherits the dashboard origin, that
script ran with same-origin access to the operator's session (e.g. via
window.opener/parent), turning unauthenticated stored input from /callback
into operator account takeover when "Render HTML DOM" was clicked.
Render the captured DOM inside an <iframe sandbox srcdoc="..."> instead.
Without allow-scripts, scripts are disabled at the parser level; without
allow-same-origin, the iframe receives an opaque origin. Protection no
longer depends on CSP ordering. The outer wrapper is fully under our
control and contains no attacker-controlled markup outside the
HTML-attribute-escaped srcdoc value.1 parent 0c232c0 commit ee1276c
1 file changed
Lines changed: 29 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | 649 | | |
672 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
673 | 677 | | |
674 | 678 | | |
675 | | - | |
| 679 | + | |
| 680 | + | |
676 | 681 | | |
677 | 682 | | |
678 | 683 | | |
| |||
0 commit comments