Skip to content
SQL injection Write-up Beginner

SQL Injection in The HTTP Custom Header

A custom HTTP header carrying the username was passed into a SQL query without proper handling, so a crafted value made the query always true. An attacker could then retrieve valid data and send requests without an authorisation token.

yoshi m lutfi Follow

Published on infosecwriteups.com

It has been a long time since my last write-up. in this short write up I wanna share my last year's findings about SQL Injection that I found in the custom HTTP header request.

yoshi m lutfi, 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

Root cause

Likely the username from the custom header was concatenated into a SQL query without parameterisation or validation.

Impact

An attacker could bypass authentication and access data via SQL injection, though the text does not detail the full extent of data exposure.

What the attacker needed

A valid login to obtain a token; ability to modify HTTP headers

How it was found

  1. Log in and observe the custom User header in the request.
  2. Change the User header value and note the server returns a 500 error.
  3. Send a basic SQL injection value in the User header and observe the request is accepted with valid information.
  4. Send the request without the Authorization token and observe it still succeeds.

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 application put a value from a request header directly into a database query. By sending a special value that makes the query condition always true, the tester got the server to return data it should not. This also let requests succeed without the usual authorisation token.

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 yoshi m lutfi

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.