如果允許未驗證的輸入控制重定向機制所使用的 URL,可能會有利于攻擊者發動釣魚攻擊。
通過重定向,Web 應用程序能夠引導用戶訪問同一應用程序內的不同網頁或訪問外部站點。應用程序利用重定向來幫助進行站點導航,有時還跟蹤用戶退出站點的方式。當 Web 應用程序將客戶端重定向到攻擊者可以控制的任意 URL 時,就會發生 Open redirect 漏洞:
攻擊者可能利用 Open redirect 漏洞誘騙用戶訪問某個可信賴站點的 URL,并將他們重定向到惡意站點。攻擊者通過對 URL 進行編碼,使最終用戶很難注意到重定向的惡意目標,即使將這一目標作為 URL 參數傳遞給可信賴的站點時也會發生這種情況。因此,Open redirect 常被作為釣魚手段的一種而濫用,攻擊者通過這種方式來獲取最終用戶的敏感數據。
例 1:以下 JSP 代碼會在用戶打開鏈接時,指示用戶瀏覽器打開從 dest 請求參數中解析的 URL。
<%
...
String strDest = request.getParameter("dest");
pageContext.forward(strDest);
...
%>
[1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A1 Unvalidated Input
[2] Standards Mapping - OWASP Top 10 2010 - (OWASP 2010) A10 Unvalidated Redirects and Forwards
[3] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3510 CAT I, APP3600 CAT II
[4] Standards Mapping - Security Technical Implementation Guide Version 3.4 - (STIG 3.4) APP3510 CAT I, APP3600 CAT II
[5] Standards Mapping - Web Application Security Consortium 24 + 2 - (WASC 24 + 2) Content Spoofing
[6] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 601
[7] Standards Mapping - SANS Top 25 2010 - (SANS 2010) Insecure Interaction - CWE ID 601
[8] Standards Mapping - SANS Top 25 2011 - (SANS Top 25 2011) Insecure Interaction - CWE ID 601
[9] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.3.1.1
[10] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.1
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 - (PCI 2.0) Requirement 6.5.1