- The Guide to Finding and Reporting Web Vulnerabilities
- About the Author
- About the Tech Reviewer
- Foreword
- Introduction
- Who This Book Is For
- What Is In This Book
- Happy Hacking!
- 1 Picking a Bug Bounty Program
- 2 Sustaining Your Success
- 3 How the Internet Works
- 4 Environmental Setup and Traffic Interception
- 5 Web Hacking Reconnaissance
- 6 Cross-Site Scripting
- 7 Open Redirects
- 8 Clickjacking
- 9 Cross-Site Request Forgery
- 10 Insecure Direct Object References
- 11 SQL Injection
- 12 Race Conditions
- 13 Server-Side Request Forgery
- 14 Insecure Deserialization
- 15 XML External Entity
- 16 Template Injection
- 17 Application Logic Errors and Broken Access Control
- 18 Remote Code Execution
- 19 Same-Origin Policy Vulnerabilities
- 20 Single-Sign-On Security Issues
- 21 Information Disclosure
- 22 Conducting Code Reviews
- 23 Hacking Android Apps
- 24 API Hacking
- 25 Automatic Vulnerability Discovery Using Fuzzers
Prevention
To prevent open redirects, the server needs to make sure it doesn’t redirect users to malicious locations. Sites often implement URL validators to ensure that the user-provided redirect URL points to a legitimate location. These validators use either a blocklist or an allowlist.
为了防止开放重定向,服务器需要确保不会将用户重定向到恶意网址。网站通常实施 URL 验证器,以确保用户提供的重定向 URL 指向合法位置。这些验证器使用阻止名单或允许名单。
When a validator implements a blocklist, it will check whether the redirect URL contains certain indicators of a malicious redirect, and then block those requests accordingly. For example, a site may blocklist known malicious hostnames or special URL characters often used in open-redirect attacks. When a validator implements an allowlist, it will check the hostname portion of the URL to make sure that it matches a predetermined list of allowed hosts. If the hostname portion of the URL matches an allowed hostname, the redirect goes through. Otherwise, the server blocks the redirect.
当验证器实施阻止列表时,它会检查重定向 URL 是否包含某些恶意重定向指示器,并相应地阻止这些请求。例如,一个站点可能会阻止已知的恶意主机名或经常用于开放重定向攻击的特殊 URL 字符。当验证器实施允许列表时,它将检查 URL 的主机名部分,以确保它与预定的允许主机列表匹配。如果 URL 的主机名部分与允许的主机名匹配,则重定向将进行。否则,服务器将阻止重定向。
These defense mechanisms sound straightforward, but the reality is that parsing and decoding a URL is difficult to get right. Validators often have a hard time identifying the hostname portion of the URL. This makes open redirects one of the most common vulnerabilities in modern web applications. We’ll talk about how attackers can exploit URL validation issues to bypass open-redirect protection later in this chapter.
这些防御机制听起来很简单,但实际上解析和解码 URL 非常难以正确执行。验证器通常很难识别 URL 的主机名部分。这使得开放式重定向成为现代 Web 应用程序中最常见的漏洞之一。稍后在本章中,我们将讨论攻击者如何利用 URL 验证问题绕过开放式重定向保护。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论