有哪些 HTML 表单攻击媒介?

发布于 2024-09-16 05:39:23 字数 198 浏览 6 评论 0 原文

我开始研究 HTML 表单安全性。到目前为止,我的研究揭示了三种主要的攻击媒介:

  1. 跨站点请求伪造 (CSRF)
  2. 跨站点脚本 (XSS)
  3. SQL 注入

我的问题是:HTML 表单的攻击媒介是否比这些更多?我对通过 HTML 表单进行的可能攻击列表感兴趣。

I am starting to have a look at HTML form security. So far my research revealed three main attack vectors:

  1. Cross-site request forgery (CSRF)
  2. Cross-site scripting (XSS)
  3. SQL Injection

My question is: Are there more attack vectors for HTML forms than these? I am interested in a list of possible attacks through HTML forms.

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

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

发布评论

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

评论(4

生活了然无味 2024-09-23 05:39:23

它总是取决于表单正在做什么。

代码注入将是另一种威胁(SQL注入属于其中) 。

It always depends on what the form is doing.

Code injection would be another threat (which SQL injection belongs to).

失与倦" 2024-09-23 05:39:23

就作为用户提供的数据的注入向量而言,表单与 URI 或标头相同。一般的“不信任客户端”规则适用,如 SQL 注入、XSS 等的可能性所示。因此,仅依赖 JavaScript 验证而没有服务器端验证的表单是不好的。

更具体的表单问题包括:

  • 假设 type=hidden 字段对用户不可见或不会被用户操作
  • 不通过 HTTPS 提交敏感数据
  • 错误地屏蔽数据(例如,向用户显示信用卡的最后 N 位数字,但所有数字都被隐藏) 对于像 PHP 这样的语言,可以从不同的数组
  • 访问 GET 和 POST 数据,对 $_POST 应用安全检查,但从 $_GET 中获取值

工作流或“业务逻辑”问题并不特定于表单,但是它们更频繁地应用于经常使用它们处理的功能:

  • 工作流程执行不充分,例如必须在表单 B 之前填写表单 A,但状态转换是在客户端而不是服务器端进行跟踪的。 (用户可以跳过不应跳过的步骤。)
  • 缺乏速率限制。这取决于上下文,例如,点击向垃圾邮件用户或运营团队发送电子邮件的表单、反复点击“应用折扣”表单以降低价格、需要全表扫描的搜索可能会导致 DoS。

A form is identical to a URI or headers in terms of being an injection vector for user-supplied data. The general "don't trust the client" rules apply as shown by the possibility of SQL injection, XSS, etc. So, forms that only rely on JavaScript validation without server-side validation are bad.

Problems more specific to forms include:

  • Assuming type=hidden fields are not visible to or will not be manipulated by a user
  • Not submitting sensitive data via HTTPS
  • Incorrectly masking data (e.g. displaying last N digits of credit card to the user, but all digits are somewhere in the page anyway)
  • For languages like PHP where GET and POST data can be accessed from different arrays, applying security checks to $_POST, but taking values from $_GET

Workflow or "business logic" problems aren't specific to forms, but they apply more often to the functionality often handled with them:

  • Inadequate workflow enforcement, such as form A must be filled out before form B, but the state transition is tracked on the client side rather than the server side. (A user can skip a step that shouldn't be skipped.)
  • Lack of rate limiting. This depends on context, e.g. hitting a form that sends emails to spams users or the ops team, repeatedly hitting an "apply discount" form to reduce a price, a search that requires full table scan might lead to a DoS.
ㄟ。诗瑗 2024-09-23 05:39:23

阅读 owasp top 10。特别是 A1-Injection。但值得注意的是,CSRF/XSS/注入缺陷也可能出现在其他地方,例如 GET 请求和 HTTP 标头。

还存在其他问题,例如在发布敏感信息时不使用 HTTPS 网址。也不使用登录表单的“密码”变量类型。

Read the owasp top 10. Especially A1-Injection. Although it should be noted that CSRF/XSS/Injection flaws also can crop up in other places such as GET requests and HTTP headers.

There are other issues with <form>'s, like not using an HTTPS url if you are posting sensitive information. Also not using the "password" variable type for login forms.

但可醉心 2024-09-23 05:39:23

不要忘记查看请求伪造。如果您没有正确验证操作,攻击者可能会执行类似的操作:

<img src="http://mysite.com/delete_post/4" style="display:none">

这会迫使用户在不知情的情况下删除自己的帖子。因为用户自己被迫这样做,所以登录验证是不够的。仅仅迁移到岗位也是不够的。

为了解决这个问题,一种替代方法是发送带有表单的令牌(例如通过隐藏输入),该令牌将从内部进行验证。因此攻击将失败,因为攻击者不知道令牌。即使他发现了,他也只会影响一个用户,并且令牌可以在一段时间后或每次登录后更改。

don't forget to look at request forgery. if you do not properly validate an action, atackers could do something like that:

<img src="http://mysite.com/delete_post/4" style="display:none">

and this forces the user to delete his own post without even knowing it. and because the user himself is being forced to do that, login validation is just not enough. just migrating to post is not enough either.

to solve this, one alternative is to send a token with the form (through a hidden input for example) that will be validated from the inside. so the atack will fail since the atacker doen't know the token. and even if he discovers, he would affect just one user and the token can be changed after some time or after each login.

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