<html>
 <form action="" method="post">
 <input type="text" name="xss_input">
 <input type="submit">
 </form>
 <?php
 if(isset($_POST['xss_input'])){
     $xss = $_POST['xss_input'];
     unset($_POST['xss_input']);
     echo "<h1>你输入的字符为<br>$xss</h1>";
 }
 ?>
 </html> 

If you the form's action is null, it will refresh the current page,request the current php.

Key:

<script>alert("haha");</script>
<html>
<form action="" method="post">
<input type="text" name="xss_input">
<input type="submit">
</form>
<h1>你输入的字符为<br><script>alert("haha");</script></h1>
</html> 

==================================================

<html>
<form action="" method="post">
<input type="text" name="xss_input">
<input type="submit">
</form>
<?php
if(isset($_POST['xss_input'])){
    $xss = $_POST['xss_input'];
    echo "<textarea>你输入的字符为$xss</textarea>";
}
?>
</html> 

Key:

</textarea><script>alert("haha");</script><textarea>>

The main point of xss is to take advantage of server's echo.

The main point of knowledge is to realize that html is generated by server,it's just strings !

The power of xss is the power of javascript.The more privilege we give to js,the more dangerous xss is.

How to prevent xss?

echo "<textarea>".htmlspecialchars("你输入的字符为$xss")."</textarea>";

XSS attack的更多相关文章

  1. Anti XSS 防跨站脚本攻击库

    https://wpl.codeplex.com/ Before understanding Anti-Cross Site Scripting Library (AntiXSS), let us u ...

  2. XSS之xssprotect(转)

    参考资料 1 跨网站脚本 http://zh.wikipedia.org/wiki/XSS 2 http://code.google.com/p/xssprotect/ 一 跨网站脚本介绍      ...

  3. Cross-Site Scripting(XSS)简介

    最近才开始研究HTML以及安全问题.如果有什么说得不对的地方,望请指出. 在网络应用安全中,XSS可能是最常见,范围最大,所包含攻击方法最多,同时也是最难以理解的一种攻击.在OWASP所列出的十大网络 ...

  4. XSS (Cross Site Scripting) Prevention Cheat Sheet(XSS防护检查单)

    本文是 XSS防御检查单的翻译版本 https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sh ...

  5. Linux/Unix System Level Attack、Privilege Escalation(undone)

    目录 . How To Start A System Level Attack . Remote Access Attack . Local Access Attack . After Get Roo ...

  6. 那些年我们没能bypass的xss filter

    个人很喜欢收集xss payload.在这里把自己平时挖xss时会用到的payloads列出来和大家一起分享.很希望大家能把自己的一些payload也分享出来.(由于 我是linux党,所以本文出现在 ...

  7. 来自内部的XSS攻击的防范

    来自内部的XSS攻击的防范 引入:前面我们分2篇文章分别探讨了来自外部的XSS攻击和来自内部的XSS攻击,现在我们来专门探讨如何防范来自内部的XSS攻击. 实践:其实从 http://www.2cto ...

  8. 防御XSS攻击的七条原则

    本文将会着重介绍防御XSS攻击的一些原则,需要读者对于XSS有所了解,至少知道XSS漏洞的基本原理,如果您对此不是特别清楚,请参考这两篇文章:<Stored and Reflected XSS ...

  9. XSS研究2-来自内部的XSS攻击的防范

    引入: 前面我们分2篇文章分别探讨了来自外部的XSS攻击和来自内部的XSS攻击,现在我们来专门探讨如何防范来自内部的XSS攻击.   实践:  http://www.cnblogs.com/crazy ...

随机推荐

  1. 命令行向php传入参数的两种方法

    ##$argv or $argc  $argv 包含当运行于命令行下时传递给当前脚本的参数的数组.  $argv[0]  就是脚本文件名. $argc 包含当运行于命令行下时传递给当前脚本的参数的数目 ...

  2. Eliot

    T.S. Eliot - Biographical Thomas Stearns Eliot (1888-1965) was born in St. Louis, Missouri, of an ol ...

  3. [Computer structure] Written Notes

    To some extent, taking notes using my pen and pencil is also an interesting thing! bingo! ~ 2016-03- ...

  4. CF721C. Journey[DP DAG]

    C. Journey time limit per test 3 seconds memory limit per test 256 megabytes input standard input ou ...

  5. Java中的移位运算符

    java中有三种移位运算符 <<      :     左移运算符,num << 1,相当于num乘以2 >>      :     右移运算符,num >& ...

  6. SQL Server 索引设计指南

    https://msdn.microsoft.com/zh-cn/library/jj835095(v=sql.120).aspx#Nonclustered

  7. Jedis下的ShardedJedis(分布式)使用方法(一)

    原来项目中有用到Redis用作缓存服务,刚开始时只用一台Redis就能够满足服务,随着项目的慢慢进行,发现一台满足不了现有的项目需求,因为Redis操作都是原子性这样的特性,造成有时同时读写缓存造成查 ...

  8. accp7.0优化MySchool数据库设计内测笔试题总结

    1) 在SQL Server 中,为数据库表建立索引能够(C ). 索引:是SQL SERVER编排数据的内部方法,是检索表中数据的直接通道 建立索引的作用:大大提高了数据库的检索速度,改善数据库性能 ...

  9. [No00001E]不出国,学口语-出国口语自然好?才怪咧!

  10. 一个简单的Android富文本TextView实现

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Helvetica; color: #555555 } p.p2 { margin: 0.0p ...