从非安全页面向安全 URL 提交表单

发布于 2024-12-26 11:36:49 字数 288 浏览 0 评论 0原文

假设我在这个位置的页面上有一个表单...

http://mydomain.com/myform.htm

并且表单看起来像这样...

<form method="post" action="https://secure.otherdomain.com/handleform.php">
   ....
</form>

假设接收此表单提交的服务器上安装了有效的 SSL 证书,该表单提交的内容是否会被加密?

Suppose I have a form on a page at this location...

http://mydomain.com/myform.htm

And the form looks like this...

<form method="post" action="https://secure.otherdomain.com/handleform.php">
   ....
</form>

Assuming that there is a valid SSL cert installed on the server which receives this form submission will the contents of that form submission be encrypted?

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

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

发布评论

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

评论(3

要走干脆点 2025-01-02 11:36:49

POST 请求将通过 HTTPS 传输(如果配置正确,则进行加密)。将通过纯 HTTP 获取的页面中的表单提交到 HTTPS 页面是不好的做法。初始页面也应通过 HTTPS 提供。原因是 MITM 攻击者可以拦截使用表单加载页面的响应,并替换链接以指向另一个目标。

请参阅此处的第一条规则(当然,不特定于登录页面):

规则 - 对所有登录页面和所有经过身份验证的页面使用 TLS

登录页面和所有后续经过身份验证的页面必须是
通过 TLS 独占访问。初始登录页面,称为
“登录登陆页面”必须通过 TLS 提供。未能利用
登录登陆页面的 TLS 允许攻击者修改登录信息
表单操作,导致用户的凭据被发布到
任意位置。未能对经过身份验证的页面使用 TLS
登录后使攻击者能够查看未加密的会话 ID
并危及用户经过身份验证的会话。

The POST request will be transmitted over HTTPS (so encrypted if configured properly). Submitting a form from a page obtained over plain HTTP to an HTTPS page is bad practice. The initial page should also be served over HTTPS. The reason for this is that a MITM attacker could intercept the response that loads the page with the form and replace the link to point to another target.

See the first rule here (of course, not specific to login pages):

Rule - Use TLS for All Login Pages and All Authenticated Pages

The login page and all subsequent authenticated pages must be
exclusively accessed over TLS. The initial login page, referred to as
the "login landing page", must be served over TLS. Failure to utilize
TLS for the login landing page allows an attacker to modify the login
form action, causing the user's credentials to be posted to an
arbitrary location. Failure to utilize TLS for authenticated pages
after the login enables an attacker to view the unencrypted session ID
and compromise the user's authenticated session.

安人多梦 2025-01-02 11:36:49

假设服务器和客户端之间可以协商有效的 SSL/TLS 会话,那么可以。这意味着客户端必须愿意信任服务器提供的任何证书,并且两方可以协商双方都同意的密码集(使用什么算法等)。您可以设置很多配置选项来更改允许的内容,但在“正常”实现中,您不会胡乱要求特定的非正常算法、需要客户端证书身份验证等,一切都应该工作得很好,并且您将拥有一个受保护的会话...如果由于某种原因失败,您会知道您的客户端将收到有关出错原因的错误。

请注意,一般来说,虽然您可以这样做,并且传输会被加密,但通常不应该这样做。提交未加密/受保护的页面会让您容易受到几种类型的中间人攻击。您可以在此处查看有关此问题的 OWASP 文章以及为什么它不好。

Assuming a valid SSL/TLS session can be negotiated between the server and the client, then yes. This means that the client must be willing to trust whatever certificate the server presents and that the two parties can negotiate a mutually-agreeable cipher set (what algorithms to use, etc). There are plenty of configuration options you can set to alter what is allowed, but in a "normal" implementation where you don't go messing around with requiring a specific, non-normal, algorithm, requiring client-side certificate authentication, etc, everything should work just fine and you'll have a protected session...and if it fails for some reason, you'll know as your client will receive an error about what went wrong.

Note that, in general, while you can do this, and the transmission would be encrypted, you generally should not. Having an unencrypted/protected page submit to one leaves you vulnerable to a couple types of Man in the Middle attacks. You can see the OWASP article on this, and why it's bad, here.

长不大的小祸害 2025-01-02 11:36:49

是的。它将被安全地传输。

Yes. It will be transmitted securely.

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