Rectification of system functions of mysql5.x

Source: Internet
Author: User
Today I met a server where the mysql user in the passwd file has a shell. [Varlibmysql] $ catetcpasswd | grepmysqlmysql: x: 27: 27: MySQLServer: varlibmysql, the home Directory of mysql is varlibmysql.

Today I met a server where the mysql user in the passwd file has a shell. [/Var/lib/mysql/] $ cat/etc/passwd | grep mysqlmysql: x: 27: 27: MySQL Server:/var/lib/mysql: /bin/bash: If you want to raise the permission, but do not want to rebound, consider using ssh directly. The mysql home directory is/var/lib/mysql. If you can create

Today I met a server where the mysql user in the passwd file has a shell.


[/var/lib/mysql/]$ cat /etc/passwd |grep mysqlmysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash

If you want to raise the permission, but do not want to rebound, consider using ssh. The home Directory of mysql is/var/lib/mysql.

If you can create a. ssh directory and then into outfile an authorized_keys2 file, it will be nice.

First, I checked that the directory is the data folder of mysql. First, I thought of creating. this folder is displayed for the database with the ssh name. An error is prompted. You cannot create a database with the name starting with a dot.

As a result, I switched to the mysql system function, which was never used before, so I did not take it seriously.

I found a detailed article. Http://297020555.blog.51cto.com/1396304/544763

I will repeat the content of the article to avoid the failure of the portal.

In a linux system, mysql Elevation of Privilege when logging on with the root permission

In the linux version of mysql5.x, there is a function that can help us do a lot of tedious things, this function 4. There seems to be none below x. I haven't found it and haven't checked the function manual. I just wrote something in my own experience. 4. Let's take a look at the function manual tomorrow for another experiment.

Mysql 5. x introduces a system function. This function can execute system commands. when mysql logs in as root, it can be used to execute commands, of course, within the permitted range.

Privilege Escalation starts as follows:

Lab environment:

A: 192.168.211.128 (mysql version: 5.0.77)

B: 192.168.211.131

Experiment process:

On Machine B, connect to the database of machine A through the root user (this must be distinguished here, this root user is from mysql, not from linux ).

Now that you have connected to the database of host A, you can call the system function.

Well, the idea is here, and the rest of you can use it on your own.

From the "www. netcat. tk" blog, please be sure to keep this source http://297020555.blog.51cto.com/1396304/544763

The above is the original text, and I will not find the original source. In short, I even moved the background color together. The above seems feasible. I tested it locally and it was just a fart. The Add User executed above is actually added to the B server. The person who wrote this article is really too keen.

Test Point: after connecting mysql to a remote server, check the local ip address in system ifconfig !! System id to see if it is the current local login user!

Therefore, it is concluded that this command is executed by the current login user on the local machine and has nothing to do with the remote mysql server.

Original article address: mysql 5.x system function rectification, thanks to the original author for sharing.

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.