XSS - SQL 注入 - Owasp、AntiXss 与 Microsoft 反跨站脚本库

发布于 2024-08-13 10:16:43 字数 513 浏览 3 评论 0原文

  • 我们正在考虑使用一个库来帮助我们检测 SQL 注入。

    • 我们正在使用存储过程和参数化语句,但为了这篇文章,我们仅使用一些检测/验证用户输入的库。

最好的是什么?最容易实施?最容易更新/管理? 为什么更喜欢其中之一?

附带说明:

我刚刚开始使用 Owasp。用C#。 我希望验证时会有更多默认规则。 使用 isValid 函数时,只有 5 个默认规则。

CREDIT_CARD——信用卡验证规则的规则名称键。 DATE——日期验证规则的规则名称键。 DOUBLE -- 双重验证规则的规则名称键。 INTEGER——整数验证规则的规则名称键。 PRINTABLE——可打印验证规则的规则名称键。

我希望字符串 SQL 注入检测有更多的默认规则。

谢谢

  • We are looking at using a library to help us detect SQL injections.

    • We are using sprocs and parametrized statements, but for the sake of this post that we are only using some sore of library that detects/ verifies user input.

Whats the best one? Easiest to implement? Easiest to update/manage?
Why prefer one over the other?

On a side note:

I've just started using Owasp. with C#.
I was hoping that there would be more default rules while validating.
When using the isValid function, there are only 5 default rules.

CREDIT_CARD -- Rule name key for the credit card validation rule.
DATE -- Rule name key for the date validation rule.
DOUBLE -- Rule name key for the double validation rule.
INTEGER -- Rule name key for the integer validation rule.
PRINTABLE -- Rule name key for the printable validation rule.

I was hoping that there would be more default rules for string SQL Injection Detection.

Thanks

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

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

发布评论

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

评论(2

晨敛清荷 2024-08-20 10:16:43

使用存储过程是朝着正确方向迈出的一大步。我要添加的是输入验证,看起来您正在尝试使用 OWASP ESAPI 库来执行此操作,但在大多数情况下通过正则表达式实现非常简单。对于大多数不受信任的数据,您应该找到大量公开可用的模式。

您可能想做的另一件事是在数据层应用最小权限原则。考虑使用多个 SQL 帐户,并将面向公众的用户使用的帐户的访问权限限制为绝对最低限度的功能。您正在使用存储过程;如果您还没有这样做,请尝试避免任何数据读取器或数据读取器权限。

更多信息请参见 OWASP Top 10 .NET 开发人员第 1 部分:注入

Using stored procs is a pretty big step in the right direction. What I’d add to that is input validation which it looks like you’re trying to do with the OWASP ESAPI library but it pretty simple to implement by regex in most cases. You should find plenty of publicly available patterns for most untrusted data.

The other thing you might want to do is to apply the principle of least privilege at your data layer. Consider using more than one SQL account and restricting the access of your account(s) used by publicly facing users to the absolute bare minimum functions. You’re using stored procs; try and avoid any datareader or datareader rights if you haven’t already.

More info in OWASP Top 10 for .NET developers part 1: Injection

杯别 2024-08-20 10:16:43

我正在使用 AntiXSS 来验证用户输入 - 特别包括保护反对 SQL 注入。我见过一些攻击,但没有任何进展 - 所以似乎对我来说效果很好。

另外 - 特洛伊知道他在说什么 - 他关于这个主题的文章非常好:)

I'm using AntiXSS for validating user input - specifically including protection aganist SQL Injection. I've seen a few attacks but nothings gotten through - so seems to work well for me.

Also - Troy knows what he's talking about - His article on the subject is a really good one :)

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