我发现了一个与 X-Frame-Options 标头相关的有趣错误报告。但我不明白这怎么可能是安全问题。
以下代码作为漏洞证明:
require 'net/http'
require 'uri'
uri = URI.parse("https://play.google.com/#{"a" * 10000}")
@r = Net::HTTP.get_response uri
ret = @r.each_header {|x| puts x}
if ret["x-frame-options"]
puts ret["x-frame-options"]
else
puts "Missing x-frame-options!"
end
但它试图访问一个无效的 URL ( https://play.google.com/aaaaaaaaa.. ) 并返回一个错误页面。在响应中,缺少 x-frame-options 标头。我不明白这怎么可能是一个安全漏洞(因为它是一个无效页面并且它是一个错误响应)?这如何用于点击劫持?为什么错误响应也应该设置此标头很重要?