Skip to content
SQL injection Write-up Intermediate

From Sql Injection To Infrastructure Level Rce A Postgresql Superuser Compromise

A financial management web portal concatenated the pJobNumber parameter directly into a PostgreSQL query, allowing SQL injection. Because the application connected as the native postgres superuser, the attacker could read system catalogs and employee PII, and the author claims this led to unauthenticated remote code execution.

Gokul Follow

Published on infosecwriteups.com

While auditing a financial management web portal (vsswb), I discovered a single unparameterized parameter that ultimately resulted in unauthenticated Remote Code Execution (RCE). This is the technical walkthrough of the exploit chain.

Gokul, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the pJobNumber parameter was concatenated into a SQL string without parameterisation, and the application connected to PostgreSQL using the built-in superuser account.

Impact

The attacker could read employee PII and, per the author, escalate to unauthenticated remote code execution at infrastructure level, though the text does not show the RCE steps.

What the attacker needed

Network access to the portal; no authentication needed

How it was found

  1. Send a single quote in the pJobNumber parameter and observe a raw PostgreSQL error.
  2. Use a UNION SELECT with NULL placeholders to match the three-column query and extract version() and current_user.
  3. Enumerate PostgreSQL system catalogs as the superuser.
  4. Read employee records from the public.vss01tpemployee table.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A web page took text from the user and pasted it straight into a database command. By adding a quote character, the author made the database show its error messages, then used a UNION SELECT to read data the page never meant to show. The database account used by the site was the most powerful one, so the attacker could see everything.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by Gokul

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.