owasp

How to allow embedded images when sanitizing html with OWASP Java HTML Sanitizer

痞子三分冷 提交于 2019-12-01 09:39:15
I would like to allow: <img src="data:image/jpg;base64,..."/> I see there's documentation on how to do this but I don't understand how to implement it. I tried to add the pattern .allowUrlProtocols("data") .allowAttributes("src").matching(Pattern.compile("$data:image.*")).onElements("img") But that didn't work. I understand the pattern must be a regex expression but I'm not sure I understand how it all links up. I get that it's trying to look for img tags and then looks at the src attribute. My understanding is that it should then look for the string data:image and if finds that allows it

How to allow embedded images when sanitizing html with OWASP Java HTML Sanitizer

余生长醉 提交于 2019-12-01 08:02:05
问题 I would like to allow: <img src="data:image/jpg;base64,..."/> I see there's documentation on how to do this but I don't understand how to implement it. I tried to add the pattern .allowUrlProtocols("data") .allowAttributes("src").matching(Pattern.compile("$data:image.*")).onElements("img") But that didn't work. I understand the pattern must be a regex expression but I'm not sure I understand how it all links up. I get that it's trying to look for img tags and then looks at the src attribute.

ESAPI XSS prevention for user supplied url property

我与影子孤独终老i 提交于 2019-12-01 06:51:14
One of my REST APIs is expecting a property "url" which expects a URL as input from the user. I am using ESAPI to prevent from XSS attacks. The problem is that the user supplied URL is something like http://example.com/alpha?abc=def&phil=key%3dbdj The cannonicalize method from the ESAPI encoder throws intrusion exception here claiming that the input has mixed encoding, since it is url encoded and the piece '&phi' is treated as HTML encoded and thus the exception. I had a similar problem with sanitizing one of my application urls where the second query parameter started with 'pa' or 'pi' and

OWASP ZAP使用入门指南

隐身守侯 提交于 2019-12-01 05:37:50
安全性测试入门(一):Brute Force暴力破解攻击和防御 写在篇头: 随着国内的互联网产业日臻成熟,软件质量的要求越来越高,对测试团队和测试工程师提出了种种新的挑战。 传统的行业现象是90%的测试工程师被堆积在基本的功能、系统、黑盒测试,但是随着软件测试整体行业的技术积累和大环境,市场对于测试工程师的要求越来越全栈化,技术的突破是测试工程师的必修课。 安全测试就是测试工程师的高阶技能之一,不过安全性测试领域水非常深,对于普通测试工程师而言可能并不容易上手。 所以笔者准备写这个系列文章,做一个安全性测试入门级攻略。文章会采用DVWA项目,就其提供的几大模块,来进行安全性测试的初探和对安全性防御措施的简析。 1. DVWA - 非常脆弱的一个网页应用 DVWA- Damn voulnerable web application(直译就是:非常脆弱的网页应用-_-!!!),是UK的一家安全性研究机构发布的一套网站系统,专门用来展示网站安全性问题和防御机制。对于我们学习web安全性相关知识是一个很好的工具。 这套web项目可以在 http://www.dvwa.co.uk/ 官网由github下载。 DVWA的安装很简单,只要架设起本地的Tomcat+MySql服务器,将DVWA部署到相应目录即可。 部署完毕后,登录应用,可以在左侧的菜单中看到如下模块: 他们分别是Brute

How to configure antisamy in cq 5.5?

空扰寡人 提交于 2019-11-30 16:07:03
问题 I have cq 5.5 project. I want to Prevent XSS attacks. According this link cq provides integration with AntiSamy project. Please provide concrete steps for integration with AntiSamy because I really cannot find it. update Should I write code like this somewhere? import org.owasp.validator.html.*; Policy policy = Policy.getInstance(POLICY_FILE_LOCATION); AntiSamy as = new AntiSamy(); CleanResults cr = as.scan(dirtyInput, policy); MyUserDAO.storeUserProfile(cr.getCleanHTML()); // some custom

How to configure antisamy in cq 5.5?

人走茶凉 提交于 2019-11-30 16:00:23
I have cq 5.5 project. I want to Prevent XSS attacks. According this link cq provides integration with AntiSamy project. Please provide concrete steps for integration with AntiSamy because I really cannot find it. update Should I write code like this somewhere? import org.owasp.validator.html.*; Policy policy = Policy.getInstance(POLICY_FILE_LOCATION); AntiSamy as = new AntiSamy(); CleanResults cr = as.scan(dirtyInput, policy); MyUserDAO.storeUserProfile(cr.getCleanHTML()); // some custom function The XSS protection mechanism offered by CQ is already based on the AntiSamy Project. You only

Sanitizing response JSON from Spring MVC Controller using JSON Sanitizer?

≡放荡痞女 提交于 2019-11-30 14:37:33
I want to intercept the JSON sent back from a Spring MVC Rest Controller and run it through a sanitizer that ensures it's valid and HTML escapes any dodgy characters. (Possibly the OWASP JSON Sanitizer ) We use the Jackson HTTP Message converter to convert the @ResponseBody to JSON, as far as I can see once I return the object as a @ResponseBody I lose control of it. Is there a sensible way to intercept the JSON as a String to run sanitization code on it? I'm currently investigating three avenues: Writing a Filter and ResponseWrapper which sanitizes the JSON before it's sent back to the client

2019测试指南-web应用程序安全测试(二)进行搜索引擎发现和侦察信息泄露

a 夏天 提交于 2019-11-30 13:04:13
搜索引擎发现和侦察有直接和间接的因素。直接方法涉及从缓存中搜索索引和相关内容。间接方法涉及通过搜索论坛,新闻组和招标网站来收集敏感的设计和配置信息。 一旦搜索引擎机器人完成了爬行,它就会开始根据标签和相关属性(如<TITLE>)索引网页,以便返回相关的搜索结果[1]。如果在网站的生命周期内未更新robots.txt文件,并且尚未使用指示机器人不对内容编制索引的内联HTML元标记,则索引可能包含不打算包含在内的Web内容由业主。网站所有者可以使用之前提到的robots.txt,HTML元标记,身份验证和搜索引擎提供的工具来删除此类内容。 测试目标 了解应用程序/系统/组织的敏感设计和配置信息是直接(在组织的网站上)还是间接(在第三方网站上)公开的。 如何测试 使用搜索引擎搜索: 网络图和配置 管理员和其他主要员工存档的帖子和电子邮件 登录过程和用户​​名格式 用户名和密码 错误消息内容 开发,测试,UAT和暂存版本的网站 搜索运营商 使用高级“site:”搜索运算符,可以将搜索结果限制为特定域[2]。不要将测试限制在一个搜索引擎提供商,因为它们可能会生成不同的结果,具体取决于他们何时抓取内容和他们自己的算法。考虑使用以下搜索引擎: 百度 binsearch.info 兵 鸭鸭去 Ixquick转移/首页中国 谷歌 初段 PunkSpider Duck Duck Go和ixquick

2019测试指南-web应用程序安全测试(一)

江枫思渺然 提交于 2019-11-30 13:03:51
什么是Web应用程序安全测试? 安全测试是通过有条不紊地验证和验证应用程序安全控制的有效性来评估计算机系统或网络的安全性的方法。Web应用程序安全性测试仅侧重于评估Web应用程序的安全性。该过程涉及对应用程序的任何弱点,技术缺陷或漏洞进行主动分析。发现的任何安全问题都将提交给系统所有者,同时评估影响,缓解建议或技术解决方案。 什么是漏洞? 漏洞是系统设计,实施,运营或管理中的缺陷或弱点,可被利用来破坏系统的安全目标。 什么是威胁? 威胁是指任何东西(恶意外部攻击者,内部用户,系统不稳定等),它可能通过利用一个应用程序拥有的资产(有价值的资源,如数据库或文件系统中的数据)来损害漏洞。 什么是测试? 测试是一种行为,用于证明应用程序满足其利益相关者的安全要求。 编写本指南的方法 OWASP方法是开放和协作的: 开放:每个安全专家都可以参与项目中的经验。一切都是免费的。 协作:在撰写文章之前进行头脑风暴,以便团队可以分享想法并形成项目的集体愿景。这意味着粗略的共识,更广泛的受众和更多的参与。 这种方法倾向于创建一个定义的测试方法,它将是: 一贯 可重复 严格 在质量控制下 要解决的问题已经完整记录和测试。使用方法测试所有已知漏洞并记录所有安全测试活动非常重要。 什么是OWASP测试方法? 安全测试永远不会是一个精确的科学,可以定义应测试的所有可能问题的完整列表。实际上

Common vulnerabilities for WinForms applications

家住魔仙堡 提交于 2019-11-30 05:16:04
I'm not sure if this is on-topic or not here, but it's so specific to .NET WinForms that I believe it makes more sense here than at the Security stackexchange site. (Also, it's related strictly to secure coding , and I think it's as on-topic as any question asking about common website vulnerabilities that I see all over the site.) For years, our team has been doing threat modeling on Website projects. Part of our template includes the OWASP Top 10 plus other well-known vulnerabilities, so that when we're doing threat modeling, we always make sure that we have a documented process to addressing