erusev / parsedown

Better Markdown Parser in PHP

Home Page:https://parsedown.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible XSS injection?

gluntn opened this issue · comments

Preface: I don't know enough about XSS injection, and I've only used the online demo. Just thought I'd share this.

I tried messing around with the script styling:

Hello there

And by adding a # before the backticks, a script-tag was generated.

#```<script>alert("1")</script>
hello
\```

(minus the backslash) became

<h1\>```<script\>alert(1)</script></h1>
<p>hello\</p>
<pre><code></code></pre>

Is this the correct behaviour?

This is expected behaviour by default (since markdown itself permits HTML), however there is safe-mode if you want to accept user-input safely.
Screenshot 2019-04-03 at 18 15 08

Nice! Okay, that's good! 😁