Skip to content
SQL injection Write-up Beginner

Thmgallery

The login page was vulnerable to SQL injection, allowing authentication bypass with a simple payload. After logging in, an unrestricted file upload allowed uploading a PHP shell, and later privilege escalation was achieved via a sudo script that invoked nano.

Naman Jain Follow

Published on infosecwriteups.com

So there was an exploit for Simple Image Gallery System i.e. sqli (ref is below)

Naman Jain, 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

Impact

An attacker could bypass authentication, upload a web shell to execute commands, and escalate privileges to root, compromising the entire system.

What the attacker needed

Network access to the target; no account needed

How it was found

  1. Visit the login page at /gallery.
  2. Enter a SQL injection payload in the username field and leave password blank.
  3. Log in successfully and access the gallery.
  4. Upload a PHP file through the image upload feature.
  5. Set up a listener and trigger the uploaded file to get a shell.
  6. Find credentials in .bash_history and switch to user mike.

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.

The login form did not properly check what users typed, so an attacker could trick it into letting them in without a password. Once inside, they could upload a malicious file that ran commands on the server, and then use a misconfigured program to become the administrator.

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 Naman Jain

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.