Skip to content
SQL injection Write-up Beginner

Animals with a Base64 String to Unauthenticated SQL Injection (Intigriti Challenge 0926)

The challenge page took a Base64-encoded animal name from a URL parameter, decoded it, and inserted it directly into a SQL query without sanitisation. An attacker could inject SQL commands to read arbitrary data from the database, including a secret table containing the flag.

Ishbarna Kafle Follow

Published on cybersecuritywriteups.com

I almost skipped this challenge. Intigriti’s Challenge 0926 was just a page that showed you a picture of an animal based on a URL parameter.

Ishbarna Kafle, on cybersecuritywriteups.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

The application decoded the Base64 parameter and concatenated it directly into a SQL query without using prepared statements or input validation.

Impact

An unauthenticated attacker could read arbitrary data from the database, including a secret table containing the flag.

What the attacker needed

None

The fix

The application should use prepared statements with parameterised queries and validate the decoded animal name against an allowlist.

How it was found

  1. Send a request with a single quote appended to the animal name, encoded in Base64, and observe an error or different response.
  2. Confirm injection with a true condition (returns normal description) and a false condition (returns nothing).
  3. Use a UNION SELECT with one column to match the query structure.
  4. Query information_schema.tables to list table names, finding 'animals' and 'secret_vault'.
  5. Use UNION SELECT to retrieve the 'note' column from 'secret_vault', which contains the 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 website let you pick an animal picture by putting a coded name in the web address. The site decoded that name and pasted it into a database command without checking it. By adding extra database instructions to the name, an attacker could make the site show secret information from the database.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

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.