arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.01996cs.CRcs.SE
收藏

利用Regex拒绝服务的输入清理

Exploiting Input Sanitization for Regex Denial of Service

Efe Barlas, Xin Du, James C. Davis

摘要:

Web服务使用服务器端输入清理来防止有害输入。一些web服务发布它们的清理逻辑以使它们的客户端接口更可用,例如,允许客户端在本地调试无效请求。然而,这种可用性实践带来了安全风险。具体来说,服务可能会共享它们用来清理输入字符串的正则表达式--基于正则表达式的拒绝服务(ReDoS)是一种新兴的威胁。虽然由ReDoS引起的突出服务中断引起了人们对这个主题的兴趣,但我们对实时Web服务易受ReDoS攻击的程度知之甚少。在本文中,我们进行了第一个黑盒研究,测量实时Web服务中的ReDoS漏洞的程度。我们应用一致的清理假设:客户端的清理逻辑,包括正则表达式,与服务器端的清理逻辑一致。我们在HTML表单或API中识别服务的基于regex的输入清理,在这些regex中找到易受攻击的regex,制作ReDoS探测器,并查明漏洞。我们分析了1,000个服务的HTML表单和475个服务的API。其中,355个服务发布了正则表达式; 17个服务发布了不安全的正则表达式; 6个服务通过其API容易受到ReDoS攻击(6个域; 15个子域)。由于我们的披露,微软和亚马逊网络服务都修补了他们的网络服务。由于这些漏洞来自API规范,而不是HTML表单,因此我们为流行的API验证库提出了ReDoS防御,我们的补丁已经合并。总而言之:在客户端可见的清理逻辑中,一些Web服务会在显而易见的情况下宣传ReDoS漏洞。我们的研究结果激发了短期补丁和长期基本解决方案。

英文摘要:

Web services use server-side input sanitization to guard against harmful input. Some web services publish their sanitization logic to make their client interface more usable, e.g., allowing clients to debug invalid requests locally. However, this usability practice poses a security risk. Specifically, services may share the regexes they use to sanitize input strings -- and regex-based denial of service (ReDoS) is an emerging threat. Although prominent service outages caused by ReDoS have spurred interest in this topic, we know little about the degree to which live web services are vulnerable to ReDoS. In this paper, we conduct the first black-box study measuring the extent of ReDoS vulnerabilities in live web services. We apply the Consistent Sanitization Assumption: that client-side sanitization logic, including regexes, is consistent with the sanitization logic on the server-side. We identify a service's regex-based input sanitization in its HTML forms or its API, find vulnerable regexes among these regexes, craft ReDoS probes, and pinpoint vulnerabilities. We analyzed the HTML forms of 1,000 services and the APIs of 475 services. Of these, 355 services publish regexes; 17 services publish unsafe regexes; and 6 services are vulnerable to ReDoS through their APIs (6 domains; 15 subdomains). Both Microsoft and Amazon Web Services patched their web services as a result of our disclosure. Since these vulnerabilities were from API specifications, not HTML forms, we proposed a ReDoS defense for a popular API validation library, and our patch has been merged. To summarize: in client-visible sanitization logic, some web services advertise ReDoS vulnerabilities in plain sight. Our results motivate short-term patches and long-term fundamental solutions.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑