SQL注入攻击的最小可能字符序列是多少?
很简单,用尽可能少的字符进行 SQL 注入攻击。请注意,我并不是试图通过将输入限制在一定大小来防止 SQL 注入攻击,而是真正好奇执行最简单的攻击需要多少个字符。
为了方便起见,假设最小的表名是 4 个字符,例如“user”。请考虑这一点。
Simple, a SQL injection attack in as few characters as possible. Note, I'm not trying to prevent SQL injection attacks by limiting inputs to a certain size, but rather am genuinely curious how many characters is needed to execute even the simplest attack.
For posterity sake, let's say the smallest table name is 4 characters, e.g., "user". Please factor that in.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
1 个角色是你可以控制的最小单位。这个问题很大程度上取决于你在做什么。例如,如果您正在处理从网站删除您的个人资料的界面,并且您发送“%”而不是您的姓名:
那么将您的用户名设置为
%
将删除所有用户。1 Character is the smallest unit that you have control over. The question depends heavily on what you're doing. For instance, if you're dealing with an interface to delete your profile from a site, and you send '%' instead of your name:
then setting your username to
%
will delete all the users.当注入字符串文字时:
When injecting into a string literal:
这个怎么样:
how about this one:
假设查询是这样生成的
Suppose the query was generated like this
总而言之,如果我将内联变量修剪为最多 13 个字符,则不可能出现危险的 SQL 注入。在我的 sql 中,13 个字符足以将我的任何结果与 charindex 相匹配。我无法使用参数化存储过程,因为我的 sql 是在 C# 中动态生成的,具有复杂的 if else 逻辑。
To summarize, if I trim my inline variable to have 13 chars max no dangerous sql injection is possible. In my sql 13 chars is enough to match any of my results with charindex. I cannot use parameterized stored procedure since my sql is dynamically generated in C# with complicated if else logic.