2.7 KB96 lines
Blame
1<html>
2 <head>
3 <link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
4 <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
5 <link
6 rel="stylesheet"
7 href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/font-awesome.min.css"
8 />
9 <link
10 href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
11 rel="stylesheet"
12 />
13 <style>
14 body {
15 /* background: rgb(221, 208, 208); */
16 /* background:#333; */
17 font-family: 'Arial';
18 /* font-size: 18px !important; */
19 }
20 h1 {
21 color: grey;
22 }
23 .mermaid2 {
24 display: none;
25 }
26 .mermaid svg {
27 /* font-size: 18px !important; */
28 }
29 .malware {
30 position: fixed;
31 bottom: 0;
32 left: 0;
33 right: 0;
34 height: 150px;
35 background: red;
36 color: black;
37 display: flex;
38 display: flex;
39 justify-content: center;
40 align-items: center;
41 font-family: monospace;
42 font-size: 72px;
43 }
44 </style>
45 <script>
46 function xssAttack() {
47 const div = document.createElement('div');
48 div.id = 'the-malware';
49 div.className = 'malware';
50 div.innerHTML = 'XSS Succeeded';
51 document.getElementsByTagName('body')[0].appendChild(div);
52 throw new Error('XSS Succeeded');
53 }
54 </script>
55 </head>
56 <body>
57 <div>Security check</div>
58 <div class="flex">
59 <div id="diagram" class="mermaid"></div>
60 <div id="graph-div"></div>
61 <div id="res" class=""></div>
62 </div>
63 <script type="module">
64 import mermaid from './mermaid.esm.mjs';
65 mermaid.parseError = function (err, hash) {
66 // console.error('Mermaid error: ', err);
67 };
68 mermaid.initialize({
69 theme: 'base',
70 startOnLoad: false,
71 flowcharts: { htmlLabels: true },
72 });
73 function callback() {
74 alert('It worked');
75 }
76 function xssAttack() {
77 const div = document.createElement('div');
78 div.id = 'the-malware';
79 div.className = 'malware';
80 div.innerHTML = 'XSS Succeeded';
81 document.getElementsByTagName('body')[0].appendChild(div);
82 throw new Error('XSS Succeeded');
83 }
84
85 let diagram = `graph TD
86A[["a marker-end=#quot;url(<s title='#<style>*{background:red}</style>'>b"]]
87`;
88 const el = document.querySelector('#graph-div');
89 console.log(diagram);
90 const { svg } = await mermaid.render('graph-div', diagram);
91 document.querySelector('#res').innerHTML = svg;
92 window.rendered = true;
93 </script>
94 </body>
95</html>
96