You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 2019/midnightsunctf/marcozuckerbergo/marcozuckerbergo.md
+6-9
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ tags: ["xxs", "mermaidjs"]
4
4
# Challenge
5
5
> Fine, I'll use a damn lib. Let's see if it's any better.
6
6
7
-
This challenge is based on the same setup as marcodowno. Instead of converting markdown, this challenge converts mermaidjs[1] charts to HTML.
7
+
This challenge is based on the same setup as marcodowno. Instead of converting markdown, this challenge converts [mermaidjs](https://mermaidjs.github.io/) charts to HTML.
8
8
9
9
# Solution
10
10
@@ -15,13 +15,15 @@ graph TD;
15
15
A-->B;
16
16
```
17
17
18
-
This input is parsed using the flowchart parser[2] written in a bison-like language.
18
+
This input is parsed using the [flowchart parser](https://github.com/knsv/mermaid/blob/master/src/diagrams/flowchart/parser/flow.jison) written in a bison-like language.
19
19
A few of the parsing rules look promising:
20
20
21
-
`textToken` consumes a bunch interesting characters that are dumped as-is into the HTML output: ```<>[]"'`:.-``
21
+
`textToken` consumes a bunch interesting characters that are dumped as-is into the HTML output:
22
+
```<>[]"'`:.-```
23
+
The `textToken` rule is used to parse vertex names in the link statement `A-->B`.
22
24
Parentheses are not allowed though so we'll have to improvise on the `alert(1)` call:
23
25
24
-
ES2015 template literals[3] can be used to call functions without using parentheses.
26
+
[Template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) can be used to call functions without using parentheses.
25
27
```alert`1` ``` is equivalent to `alert(["1"])` and by string coercion equivalent to `alert('1')`.
26
28
27
29
Here's the final payload:
@@ -40,8 +42,3 @@ This is the relevant output produced:
0 commit comments