Skip to content
SQL injection Write-up Beginner

Plotted-TMS CTF

The login form on the management portal was vulnerable to SQL injection, allowing authentication bypass with a crafted username. After logging in, an attacker could upload a PHP reverse shell via the logo upload feature to gain a web shell, then escalate privileges through a writable cron script and a misconfigured doas rule to read the root flag.

JAY BHATT Follow

Published on systemweakness.com

A beginner-friendly CTF hosted on Tryhackme.com Created by sa.infinity8888. Objective of this machine is boot to root, get user flag and root flag. and this room contains Enumeration, SQLI, and Privilege escalation

JAY BHATT, on systemweakness.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, execute commands as the web server user, then escalate to root and read the root flag.

What the attacker needed

Network access to the target; no credentials needed for SQL injection

How it was found

  1. Scan the target with Nmap and find open ports 22, 80 and 445.
  2. Run Gobuster against port 445 and discover the /management directory.
  3. Submit a crafted username containing an SQL injection payload and any password to bypass the login.
  4. Upload a PHP reverse shell as the site logo through the settings tab and catch the connection with netcat.
  5. Replace the writable backup.sh cron script with a reverse shell and wait for it to execute.
  6. Use the doas rule permitting openssl as root to read the root flag.

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 page built its database query by pasting whatever you typed into the username box, so typing a special phrase made the database treat the login as always correct. Once inside, the site let you upload a file that the server then ran as a program, giving the attacker a remote command prompt. Later, a scheduled backup script that anyone could edit and a tool that let a normal user run one command as root allowed full control of the machine.

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 JAY BHATT

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.