Toly for the number value yes that is acceptable.
However for the character string you must make sure to escape end string characters so commands will not be processed.
For example, in virtually every RDBMS you use single quotes around strings. Let's say I was logging in to this forum system and internally the SQL is like this:
Code:
SELECT userid
FROM user
WHERE username = '$username'
AND password = '$password'
Typically the application code then says if the userid exists, then we have a match, so go ahead and log them in.
However, if I entered for my password:
' or 1=1 or password = '
Then the SQL would look like this:
Code:
SELECT userid
FROM user
WHERE username = 'MattR'
AND password = '' or 1=1 or password = ''
Since 1 is equal to 1, it will think I matched and log me in. If you escape the string (T-SQL style in this example), it will look like this:
Code:
SELECT userid
FROM user
WHERE username = 'MattR'
AND password = ''' or 1=1 or password = '''
Which will check your password being the entire string, and will not match.
Bookmarks