xss

经典面试题:xss攻击和防御

三世轮回 提交于 2020-01-15 00:52:44
XSS 分为三种:反射型,存储型和 DOM-based 如何攻击 XSS 通过修改 HTML 节点或者执行 JS 代码来攻击网站。 例如通过 URL 获取某些参数 <!-- http://www.domain.com?name=<script>alert(1)</script> --> <div>{{name}}</div> 上述 URL 输入可能会将 HTML 改为 <div><script>alert(1)</script></div> ,这样页面中就凭空多了一段可执行脚本。这种攻击类型是反射型攻击,也可以说是 DOM-based 攻击。 也有另一种场景,比如写了一篇包含攻击代码 <script>alert(1)</script> 的文章,那么可能浏览文章的用户都会被攻击到。这种攻击类型是存储型攻击,也可以说是 DOM-based 攻击,并且这种攻击打击面更广。 如何防御 最普遍的做法是转义输入输出的内容,对于引号,尖括号,斜杠进行转义 function escape(str) { str = str.replace(/&/g, '&') str = str.replace(/</g, '<') str = str.replace(/>/g, '>') str = str.replace(/"/g, '&quto;') str = str.replace(/'/g, ''')

小白日记47:kali渗透测试之Web渗透-XSS(一)

百般思念 提交于 2020-01-15 00:49:45
XSS 【推荐书籍: XSS跨站脚本攻击剖析与防御 】 xss表示Cross Site Scripting(跨站脚本攻击) ,它与SQL注入攻击类似,SQL注入攻击中以SQL语句作为用户输入,从而达到查询/修改/删除数据的目的,而在xss攻击中,通过插入恶意脚本,实现对用户浏览器的控制。 漏洞存在于服务器端,攻击对象为WEB客户端。 【 原理 :为了使用户体验更好等因素,有部分代码会在浏览器中执行】 【 JavaScript详解 】:与java语言无关;命名完全出于市场原因,是使用最广的客户端脚本语言 使用场景   直接嵌入html:<script>alert('XSS')</script>   元素标签事件:<body onload=alert('XSS')>   图片标签:<img src="javascript:alert('xss');">   其他标签:<iframe>,<div>,<link>    DOM 对象【 文本对象模型 】,篡改页面内容 可实现攻击方式:   1、盗取cookie【若浏览器正在登录状态】   2、重定向到特定站点【可做钓鱼也页面】 常用的客户端脚本语言 :JavaScript,VBScript,Activex,Flash XSS   攻击参与方 :攻击者,被攻击者,漏洞站点,第三方站点(攻击目标/攻击参与站)    漏洞形成根源

Cross protocol cookie iFrame

百般思念 提交于 2020-01-14 06:16:39
问题 I have a web page on http ://localhost/mySite/Page1.aspx that contains an iframe with src https ://localhost/mySite/Page2.aspx. Inside iframe page (Page2.aspx), i set cookie with JavaScript. How i can read that cookie on parent page (Page1.aspx)??? It looks like Page1 not sees the cookie that Page2 sets. To set/read cookies, I use jQuery.Cookie plugin: $.cookie('myKey', JSON.stringify(data), { expires: 1, path: '/', domain: 'localhost' }); BTW, if someone can give me an idea how to transfer

xss介绍

☆樱花仙子☆ 提交于 2020-01-14 04:44:35
一.概述 XSS 被称为跨站脚本攻击(Cross-site scripting),本来应该缩写为CSS,但是由于和CSS(Cascading Style Sheets,层叠样式脚本)重名,所以更名为XSS。XSS(跨站脚本攻击)主要基于javascript(JS)完成恶意的攻击行为。JS 可以非常灵活的操作html、css和浏览器,这使得XSS 攻击的“想象”空间特别大。 XSS 通过将精心构造的代码(JS)代码注入到网页中,并由浏览器解释运行这段JS 代码,以达到恶意攻击的效果。当用户访问被XSS 脚本注入的网页,XSS脚本就会被提取出来。用户浏览器就会解析这段XSS 代码,也就是说用户被攻击了。用户最简单的动作就是使用浏览器上网,并且浏览器中有javascript 解释器,可以解析javascript,然而浏览器不会判断代码是否恶意。也就是说,XSS 的对象是用户和浏览器。 二. xss的危害 XSS 利用JS 代码实现攻击,有很多种攻击方法,以下简单列出几种 @ 盗取各种用户账号 @ 窃取用户Cookie资料,冒充用户身份进入网站 @ 劫持用户会话,执行任意操作 @ 刷流量,执行弹窗广告 @ 传播蠕虫病毒 等等 三.XSS 的分类 XSS 漏洞大概可以分为三个类型:反射型XSS、存储型XSS、DOM 型XSS。 1 反射型XSS 反射型XSS 是非持久性、参数型的跨站脚本

Ajax Control Toolkit Editor Control - avoiding XSS attacks

你。 提交于 2020-01-14 03:01:06
问题 I noticed in this article that Microsoft does not recommend using the Editor control from the Ajax Control Toolkit in public sites because of the danger of cross-site scripting attacks. I tried it out, and even if you specifically set NoScript="true" it's possible to add script, and therefore, introduce XSS attack vulnerabilities. In my situation, we are working on a scholarship application process, and we had hoped to use this to all nominees to type up an Essay on-line. We wanted to take

ORM,XSS攻击

与世无争的帅哥 提交于 2020-01-13 06:41:08
1. ORM 1.1 对表的基本查 # 单表的查 # 1、查询所有 res = Class.objects.all() # QuerySet对象,(列表套对象) print(res) # <QuerySet [<Class: Class object>, <Class: Class object>, <Class: Class object>, <Class: Class object>]> for row in res: print(row.id, row.cname) # 2. 指定字段查询 values, value_list res = Class.objects.values('cname').all() # QuerySet对象,(列表套字典) print(res) # <QuerySet [{'cname': 'pyton8期'}, {'cname': 'pyton9期'}, {'cname': 'pyton10期'}, {'cname': 'pyton11期'}]> res = Class.objects.values_list('cname').all() # QuerySet对象,(列表套元组) # print(res) # <QuerySet [('pyton8期',), ('pyton9期',), ('pyton10期',), ('pyton11期',)]>

xss漏洞工具 -- xsser

痞子三分冷 提交于 2020-01-13 04:49:36
深情的人一般会被嫌幼稚,懂事的人一般很穷,于是便把深情喂了狗,把懂事换了柴米油盐。。。 今天给大家介绍一款xss漏洞利用工具:xsser 一、环境:kali19.4 python3 二、安装过程: 1、复制到本地安装包 git clone https://github.com/epsylon/xsser.git 2、安装依赖 cd xsser python3 setup.py install 三、命令 xsser -h 帮助 -u 指定 URL -g GET 请求时使用 -p POST 请求时使用 –cookie 指定cookie xsser -u ‘http://192.168.1.119/’ -g ‘bwapp/xss_get.php?firstname=XSS&lastname=2222222222&form=submit’ --cookie="security_level=0; PHPSESSID=omf3ns0n6“ 禁止非法,后果自负 欢迎大家关注公众号:web安全工具库 来源: CSDN 作者: web安全工具库 链接: https://blog.csdn.net/weixin_41489908/article/details/103798498

【转帖】一款优秀的XSS批量检测工具

送分小仙女□ 提交于 2020-01-12 08:49:56
一款优秀的XSS批量检测工具 https://www.freebuf.com/sectool/223009.html 必须学习胶水语言才可以啊 至少学会代码的编写与使用。 0×01 简介 NoXss是一个供web安全工程师批量检测xss隐患的脚本工具。其主要用于批量检测,比如甲方内部安全巡检,人工分析千万级的url资产是不现实的,NoXss使用多进程+协程的方式,支持高并发,可以出色的完成这一任务。NoXss从实用主义出发,小巧精致,不如其他扫描器拥有各式各样的高级功能(比如绕过waf、存储型xss等),深入挖掘xss这里首推 XSStrike ,但在批量检测方面,NoXss是一个不错的选择。 项目地址: https://github.com/lwzSoviet/NoXss 0×02 工作原理 NoXss主要是通过“符号闭合”来检测xss隐患,使用基于“反射位置”的payload进行探测(目前一共8个),相比fuzz减少了很多盲目性。比如当请求参数的值出现在response的javascript代码段中,并且是以双引号的形式进行闭合,那么NoXss将使用xssjs”;这个payload;如果是以单引号的形式进行闭合,则会使用xssjs’;进行测试。更多的位置分类以及payload请参考 https://github.com/lwzSoviet/NoXss/blob/master

Does CORS and XSS have any connection?

有些话、适合烂在心里 提交于 2020-01-12 05:09:28
问题 Cross-site scripting (XSS) is mentioned in the Wikipedia page for CORS. But I don't see how they are related. What's the connection between CORS and XSS? 回答1: XSS is mentioned on the Wikipedia article in relation to JSONP, not CORS. In JSONP you reference a page containing data you want to include client side in your page like so: <script src="https://example.com/jsonp.aspx?callback=foo"></script> You then have a JavaScript function on your page called foo that will be called by the external

How I do to force the browser to not store the html form field data?

与世无争的帅哥 提交于 2020-01-11 19:55:53
问题 When typing in html forms, browsers like firefox or ie store the values, sometimes quietly. So when typing in another webforms, the browser smartly suggest the same information. Another method to show the dropdown list is double-clicking an empty textbox. In a e-commerce website, the customer type the credit card number, and another sensitive information. How I do to avoid or block the browser to store that sensitive information? Another worry is about tampered form data stored (by a malware,