当前位置:网站首页>xss注入
xss注入
2022-07-05 04:45:00 【哇咔哇咔哇咔哇咔】
XSS的简单介绍
跨站脚本攻击(Cross Site Scripting),为不和层叠样式表(Cascading Style Sheets,CSS)的缩写混淆,故将跨站脚本攻击缩写为XSS。恶意攻击者往Web页面里插入恶意Script代码,当用户浏览该页之时,嵌入其中Web里面的Script代码会被执行,从而达到恶意攻击用户目的。
XSS危害:
流量劫持
获取用户cookie信息,盗取账号
篡改、删除页面信息(钓鱼)
配合CSRF攻击,实施进一步攻击
XSS分类
反射型XSS:反射型XSS也被称为非持久性XSS,当用户访问一个带有XSS代码的HTML请求时,服务器端接收数据后处理,然后把带有XSS的数据发送到浏览器,浏览器解析这段带有XSS代码的数据后,就造成XSS漏洞,这个过程就像一次反射,所以叫反射型XSS。
存储型XSS:存储型XSS又被称为持久性XSS,存储型XSS是最危险的一种跨站脚本漏洞,当攻击者提交一段XSS代码后,被服务端接收并存储,当攻击者或用户再次访问某个页面时,这段XSS代码被程序读出来响应给浏览器,造成XSS跨站攻击,这是存储型XSS。
DOM型:不经过后端,DOM—based XSS漏洞是基于文档对象模型Document Objeet Model,DOM)的一种漏洞,dom-xss是通过url传入参数去控制触发的。
测试管理界面是否存在XSS:
在用户名框中输入">(闭合input标签)
结果,界面弹窗,证明该系统存在XSS注入
上一步验证得出,该页面存在XSS漏洞。接下来针对该漏洞进行修改链接属性实现跳转到钓鱼界面
在username=后面加上"><a(修改忘记密码a标签的href,使其指向钓鱼网站)
点击忘记密码,进入钓鱼网站
存储型xss
cms文章管理系统的留言板存在xss漏洞,现在我们通过构造代码进行注入
模拟管理员登录改文章管理系统的后台进行浏览审核用户的留言,发现触发xss弹窗,查看源代码我们发现用户输入的信息被嵌入在了html里面被浏览器解析执行了。
当管理员审核通过之后,任何浏览到该留言内容的人都会同样解析执行我们注入的payload的。
XSS漏洞防范
XSS的威力主要是取决于JavaScript能够实现的程度,XSS跨站脚本的形成原因是对输入输出没有严格过滤,导致在页面上可以执行JavaScript等客户端代码,所以只要将敏感字符过滤,就可以修复XSS跨站漏洞。
修复和防范方法:
三种类型的XSS漏洞都可以通过过滤或编码进行修复。
反射型XSS和存储型XSS可以在服务端对用户输入输出的内容过滤和编码操作,将关键字进行过滤处理,关键符号进行编码处理,如将所有on事件script等关键字进行过滤,将所有<,>,”,’,=等特殊符号进行实体化编码或url编码便可以修复。
DOM型XSS如有在服务端进行交互,也可参考上述的方法进行修复,如未和服务端进行交互,可在客户端使用JavaScript等客户端脚本语言进行编码和过滤处理。
边栏推荐
- 2022-2028 global and Chinese video coding and transcoding Market Research Report
- PHP读取ini文件并修改内容写入
- 介绍汉明距离及计算示例
- 2022-2028 global and Chinese FPGA prototype system Market Research Report
- [groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
- 包 类 包的作用域
- 函數(易錯)
- How should programmers learn mathematics
- Interface joint commissioning test script optimization V5.0 (end)
- Difference between singleton and factory pattern
猜你喜欢
Live broadcast preview | container service ack elasticity prediction best practice
2022-2028 global and Chinese equipment as a Service Market Research Report
[crampon game] MC tutorial - first day of survival
Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
Pointer function (basic)
Function (error prone)
Manually implement heap sorting -838 Heap sort
Thematic information | carbon, carbon neutrality, low carbon, carbon emissions - 22.1.9
[groovy] closure (closure call is associated with call method | call () method is defined in interface | call () method is defined in class | code example)
Observable time series data downsampling practice in Prometheus
随机推荐
Is $20billion a little less? Cisco is interested in Splunk?
Mxnet imports various libcudarts * so、 libcuda*. So not found
[illusory engine UE] method to realize close-range rotation of operating objects under fuzzy background and pit recording
Cookie learning diary 1
Introduce Hamming distance and calculation examples
Stage experience
File upload bypass summary (upload labs 21 customs clearance tutorial attached)
[groovy] closure (Introduction to closure class closure | this, owner, delegate member assignment and source code analysis)
mxnet导入报各种libcudart*.so、 libcuda*.so找不到
Leetcode 222 number of nodes of complete binary tree
Live broadcast preview | container service ack elasticity prediction best practice
jmeter -- 分布式压测
[ideas] 2021 may day mathematical modeling competition / May Day mathematical modeling ideas + references + codes
Special information | real estate and office buildings - 22.1.9
Neural networks and deep learning Chapter 6: Circular neural networks reading questions
CSDN正文自动生成目录
Key review route of probability theory and mathematical statistics examination
Neural networks and deep learning Chapter 4: feedforward neural networks reading questions
[groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
Neural networks and deep learning Chapter 5: convolutional neural networks reading questions