2

【alert(1) to win】 Level 02 - Adobe

 2 years ago
source link: https://exp-blog.com/safe/ctf/alert/level-02-adobe/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【alert(1) to win】 Level 02



javascript
function escape(s) {
  s = s.replace(/"/g, '\\"');
  return '<script>console.log("' + s + '");</script>';
}

由于所有 " 都被转义为 \" ,导致无法直接闭合函数。

但是不能直接闭合,不等于无法闭合。

因为只是转义了双引号 " ,没有转义反斜杠 \ ,那么我们只需要再输入一个反斜杠去吃掉转义双引号的反斜杠,那么双引号就得以保留,并用来闭合函数了。

于是可以构造 payload 如下 (此处没有闭合后半段的双引号,而是通过行注释 // 屏蔽掉):

javascript
\");alert(1);//
01.png


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK