Marcodownoweb
Points: 115
Solves: 136
Someone told me to use a lib, but real developers rock regex one-liners.http://marcodowno-01.play.midnightsunctf.se:3001Service:
Author: avlidienbrunn is available for questions in #midnightsun @ freenode入力値を以下のjavascriptで置換して出力しています。
Status: Online, last check at 2019-04-06 06:47:05 UTC
markdownでimgタグのalt属性に該当する部分がそのまま出力されるためこれを利用してXSSを起こします。function markdown(text){text = text.replace(/[<]/g, '').replace(/----/g,'<hr>').replace(/> ?([^\n]+)/g, '<blockquote>$1</blockquote>').replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>').replace(/__([^_]+)__/g, '<b>$1</b>').replace(/\*([^\s][^*]+)\*/g, '<i>$1</i>').replace(/\* ([^*]+)/g, '<li>$1</li>').replace(/##### ([^#\n]+)/g, '<h5>$1</h5>').replace(/#### ([^#\n]+)/g, '<h4>$1</h4>').replace(/### ([^#\n]+)/g, '<h3>$1</h3>').replace(/## ([^#\n]+)/g, '<h2>$1</h2>').replace(/# ([^#\n]+)/g, '<h1>$1</h1>').replace(/(?<!\()(https?:\/\/[a-zA-Z0-9./?#-]+)/g, '<a href="$1">$1</a>').replace(/!\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9./?#]+)\)/g, '<img src="$2" alt="$1"/>').replace(/(?<!!)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9./?#-]+)\)/g, '<a href="$2">$1</a>').replace(/`([^`]+)`/g, '<code>$1</code>').replace(/```([^`]+)```/g, '<code>$1</code>').replace(/\n/g, "<br>");return text;}
inputの入力値を

とすると下図のようにフラグが表示されます。
フラグは、
midnight{wh0_n33ds_libs_wh3n_U_g0t_reg3x?}