Skip to content
SQL injection Write-up Intermediate

Complex Attack Types: Sample Scenarios 42

A publicly accessible .git directory exposed the source code and commit history, which contained an API key and a PHP file vulnerable to SQL injection. The attacker used the SQL injection to gain OS command execution, upload a reverse shell, and pivot to an internal FTP server running a backdoored vsftpd version, ultimately obtaining root access.

brsdncr Follow

Published on medium.com

We are starting another interesting scenario. In general, we will focus our attack mechanism on Git and we will take over the other machine by opening many different ways.

Baris Dincer, on 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

Impact

An attacker could retrieve sensitive source code and credentials, execute arbitrary commands on the web server, and pivot to internal systems, ultimately gaining root access on the FTP server.

What the attacker needed

Exposed .git directory; SQL injection vulnerability; network access to internal FTP

How it was found

  1. Scan the target with nmap and discover an exposed .git directory.
  2. Use git-dumper to download the .git repository.
  3. Browse commit history and extract an API key and a PHP file with SQL injection.
  4. Exploit the SQL injection to get an OS shell and upload a reverse shell.
  5. Pivot to an internal network and find an FTP server running vsFTPd 2.3.4.
  6. Exploit the vsFTPd backdoor to gain root 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 left its source code management folder (.git) open to the public, so anyone could download the code history. That history contained a secret key and a page that let attackers run database commands, which they used to take over the server and then break into another machine on the same network.

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 brsdncr

View all

7 more disclosed reports, 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.