Bug Bounty: “My Remote Code Execution”
An exposed phpPgAdmin instance was reachable with default credentials found online, giving full database access. The author then used a SQL feature to run operating system commands, achieving remote code execution as the postgres user and noting a possible local privilege escalation.
The original lives on 0xjin.medium.com
We do not hold its text, 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 an internet-exposed phpPgAdmin interface with default credentials and a database role permitted to execute operating system commands.
Impact
The author gained a shell as the postgres user and noted the kernel appeared vulnerable to a local privilege escalation, so root access could have been possible.
What the attacker needed
Internet-reachable phpPgAdmin; default credentials; database role can run OS commands
How it was found
- Find the subdomain with Amass.
- Brute-force directories with ffuf and locate the phpPgAdmin page.
- Log in with credentials found by searching online.
- Bypass the blocked query box by uploading the query through the upload button.
- Check for netcat on the host with a which command.
- Run a reverse shell command through the database to gain a shell as postgres.
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.
phpPgAdmin is a web tool for managing PostgreSQL databases. The site left it reachable and protected only by a weak default login, so anyone who found the page could log in. From there, a database feature that runs shell commands let the author execute commands on the server itself.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.