反射型XSS发掘:
我们在搜索的时候,有些网站就会将搜索文字显示出来.贴测试代码
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>XSS-反射型</title> 5 <meta charset="utf-8"> 6 </head> 7 <body> 8 <form action="" method="POST"> 9 搜索内容:<input type="text" name="con"> 10 <input type="submit" name="sub" value="搜索"> 11 </form> 12 <?php 13 if(isset($_POST['sub'])){ 14 echo !empty($_POST['con'])?$_POST['con']:""; 15 } 16 ?> 17 </body> 18 </html>
这个程序很简单,一个简单的输出而已,不过这也就造成了一个反射型的XSS漏洞.
搜索内容:xss<xss>
网页中并没有显示<xss>,因为html认为在<>里的,就是一个标签,当然也有很大的可能是将其过滤了,我们将XSS代码注入到网页中
<script>alert("xss");</script>,script标签有一个src属性,可以引入js文件,我们也可以通过引入外部的文件,将恶意代码注入到网页中
很多地方都有可能存在XSS,你要想嚼了炫麦一样,不能停!!!!