通过反模式和修复策略提高开发人员对Regex拒绝服务工具的理解
Improving Developers' Understanding of Regex Denial of Service Tools through Anti-Patterns and Fix Strategies
摘要:
正则表达式用于各种目的,包括输入验证和防火墙。不幸的是,它们还可能导致称为ReDoS(正则表达式拒绝服务)的安全漏洞,这是由正则表达式匹配期间的超线性最坏情况执行时间引起的。由于ReDoS的严重性和普遍性,过去的工作提出了自动工具来检测和修复正则表达式。虽然这些工具在自动实验中进行了评估,但其可用性尚未得到研究;可用性尚未成为先前工作的重点。我们的观点是,如果我们用反模式和修复易受攻击的正则表达式的策略来补充现有工具,那么检测和修复正则表达式的可用性将会提高。我们为易受攻击的正则表达式开发了新的反模式,并收集了一系列修复策略来修复它们。我们从正则表达式无限模糊性的新理论中推导出反模式和修复策略-这是正则表达式易受ReDoS攻击的必要条件。我们证明了我们理论的可靠性和完备性。我们评估了我们的反模式的有效性,无论是在自动实验中还是在手动应用时。然后,我们评估了我们的反模式和修复策略在多大程度上提高了开发人员对检测和修复工具结果的理解。我们的评估发现,我们的反模式在大型正则表达式数据集(N= 209,188)上是有效的:100%的精确度和99%的召回率,提高了50%的精确度和87%的召回率。当手动应用时,我们的反模式也比最先进的模式更有效(N=20):100%的开发人员有效地应用了它们,而最先进的模式只有50%。最后,我们的反模式和修复策略增加了开发人员对自动工具的理解(N=9):在检测漏洞时,从中值“非常弱”到中值“强”,在修复漏洞时,从中值“非常弱”到中值“非常强”。
英文摘要:
Regular expressions are used for diverse purposes, including input validation and firewalls. Unfortunately, they can also lead to a security vulnerability called ReDoS (Regular Expression Denial of Service), caused by a super-linear worst-case execution time during regex matching. Due to the severity and prevalence of ReDoS, past work proposed automatic tools to detect and fix regexes. Although these tools were evaluated in automatic experiments, their usability has not yet been studied; usability has not been a focus of prior work. Our insight is that the usability of existing tools to detect and fix regexes will improve if we complement them with anti-patterns and fix strategies of vulnerable regexes. We developed novel anti-patterns for vulnerable regexes, and a collection of fix strategies to fix them. We derived our anti-patterns and fix strategies from a novel theory of regex infinite ambiguity - a necessary condition for regexes vulnerable to ReDoS. We proved the soundness and completeness of our theory. We evaluated the effectiveness of our anti-patterns, both in an automatic experiment and when applied manually. Then, we evaluated how much our anti-patterns and fix strategies improve developers' understanding of the outcome of detection and fixing tools. Our evaluation found that our anti-patterns were effective over a large dataset of regexes (N=209,188): 100% precision and 99% recall, improving the state of the art 50% precision and 87% recall. Our anti-patterns were also more effective than the state of the art when applied manually (N=20): 100% developers applied them effectively vs. 50% for the state of the art. Finally, our anti-patterns and fix strategies increased developers' understanding using automatic tools (N=9): from median "Very weakly" to median "Strongly" when detecting vulnerabilities, and from median "Very weakly" to median "Very strongly" when fixing them.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。