Skip to content
RCE Write-up Advanced

How I Hacked One of the Largest Ministries in Indonesia

An error stack trace exposed database credentials and an app key, and a later unrestricted file upload flaw allowed a web shell. The attacker used the shell to reach an internal database host and run a query, proving lateral movement.

asyary Follow

Published on asyary.medium.com

I interned at the Ministry of Public Works (Kementerian PU) for about four months as a penetration tester. During that time, I discovered more than two dozen vulnerable web apps, with severities ranging from informational to critical.

Asyary Raihan, on asyary.medium.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 debug mode was left on, exposing stack traces with credentials, and the file upload check relied on a bypassable extension check rather than validating file content.

Impact

The attacker could read sensitive configuration data, execute code on the server, and reach an internal database, though the initial credentials alone were not usable from the internet due to a load balancer.

What the attacker needed

Authorised penetration test; internet access to the target; a short wordlist

The fix

The information disclosure was fixed by disabling debug modes and rotating credentials, and the upload flaw was fixed with a strict whitelist and content-based validation.

How it was found

  1. Fuzz endpoints on the root domain with a short wordlist and notice large 500 error responses.
  2. Open a 500 response and find a stack trace containing database host, username, password, and app key.
  3. Chain an unrestricted file upload with other flaws to obtain a web shell.
  4. Run ifconfig in the web shell to confirm the internal IP is in the 10.x.x.x range.
  5. Use the leaked credentials to connect to the internal database host from the compromised machine.
  6. Execute a simple query to prove database access.

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 website accidentally showed detailed error messages that included a database password. Separately, a file upload feature let the tester upload a script that ran on the server, giving them a remote shell. From that shell they connected to an internal database using the leaked password.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.