Skip to content
SQL injection Write-up Intermediate

SQL injection 實戰:在限制底下提升速度

The report describes two SQL injection vulnerabilities in a booking website: a search function and an availability query. An attacker could extract arbitrary data from the database, including flags, by using UNION-based and boolean-based techniques, with optimisations to speed up extraction.

tech-blog.cymetrics.io

Published on tech-blog.cymetrics.io

前陣子我們團隊在執行滲透測試時,發現了一個有趣的 SQL injection 案例,因為一些特性的關係,沒辦法直接用現成工� �撈出資料,需要自己改工� �或是寫� �本才能有效利用。因此,這篇將會分享� �個實際案例,以及我自己的幾個解法。

The author, on tech-blog.cymetrics.io

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 the application concatenated user-supplied input directly into SQL queries without parameterisation or escaping, and the id parameter was not escaped at all.

What the attacker needed

Access to the vulnerable endpoints; ability to send HTTP requests

How it was found

  1. Send a single quote in the tag parameter to trigger an SQL error and see the query.
  2. Use a CASE WHEN expression in the tag parameter to test conditions and observe which results are returned.
  3. For the availability page, determine the number of columns using ORDER BY.
  4. Use UNION SELECT to inject controlled values into the price query.
  5. Encode extracted characters as day offsets in a date to leak them via the response.

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.

SQL injection is a flaw where user input is inserted into a database query without proper handling, letting an attacker change the query's meaning. Here, the search and booking pages built queries by gluing input directly into SQL, so an attacker could ask the database for secret data and read it back through the page's normal responses.

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.