#在sql中是什么意思? [英] What does # mean in sql?

查看:983
本文介绍了#在sql中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道OR 1#在mysql注入的上下文中是什么意思吗?

Does anyone know what something like OR 1# means in the context of mysql injection?

推荐答案

它是MySQL的行注释定界符版本.在标准SQL中,行注释定界符为--.

It is MySQL's version of the line comment delimiter. In standard SQL, the line comment delimiter is --.

-- This is a standard SQL comment.
# This is a MySQL comment.

因此,在SQL注入的上下文中,如果攻击者知道您正在使用MySQL,他可能会使用它突然终止恶意SQL语句,从而导致MySQL忽略#背后的内容并仅执行出现的内容在它之前.但是,这仅对单行SQL语句有效.这是一个示例:

So in the context of SQL injection, if the attacker knows you're using MySQL he may use it to abruptly terminate the malicious SQL statement, causing MySQL to ignore whatever is behind the # and execute only the stuff that comes before it. This is only effective against single-line SQL statements, however. Here's an example:

输入:

用户名:fake' OR 1#
密码:pass

Username: fake' OR 1#
Password: pass

结果SQL:

SELECT * FROM users WHERE username = 'fake' OR 1#' AND password = 'pass'

以此执行,返回每一行:

SELECT * FROM users WHERE username = 'fake' OR 1

这篇关于#在sql中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆