Skip to content
SQL injection Disclosed report Beginner

SQL Injection in ████

An SQL injection vulnerability existed in the app_id parameter of a recruiter page, allowing an attacker to manipulate database queries. This could lead to database content control, information exfiltration, and potentially remote code execution.

arinerron2 Follow

Originally disclosed on HackerOne

  • Triaged in 26 hours
  • Fixed in 10 days
  • Disclosed after 5 months

Summary by the researcher

See the writeup at https://aaronesau.com/blog/posts/5

The report

Summary

There is an SQL injection vulnerability in ████████ in the /█████/recruiter/updapp.aspxpage, exploitable through theapp_id` form parameter.

Impact

An attacker could use this vulnerability to control the content in the database, exfiltrate information, and obtain remote code execution.

Step-by-step Reproduction Instructions

  1. Visit https://█████████/Gateway/sso.aspx and sign in. Note that any user can create a user (and any privilege level works for this vulnerability as long as a user is signed in), so this should be considered an unauthenticated vulnerability.
  2. With the Network tab of devtools open, visit https://██████/████/recruiter/updapp.aspx
  3. Replay the GET request that returned the HTTP 500 error as a POST request with the body app_id='. This can be done by right clicking on the request, copying it as cURL, pasting the command in terminal, and appending -k -X POST --data "app_id='".
  4. Notice in the response, there is an error: ORA-01756: quoted string not properly terminated. This is because the single apostrophe (') caused the SQL query to be syntactically invalid.
  5. Replay the request in the same way as shown in #3, but with the body app_id='' (this time append -k -X POST --data "app_id=''" to the cURL command).
  6. Notice in the response, there is an error: ORA-01722: invalid number. This is because the double apostrophes ('') did not cause the SQL query to be syntactically invalid, but because aposrophes are not numbers, they caused a different error.
  7. Repeat step #3 as many times as you like. An odd number of apostrophes (') will cause the SQL query to fail because it is syntactically invalid, and an even number will cause it to fail because it is valid, but apostrophes are not numbers.

I did not want to exploit this to get remote code execution because this is a live production system, but to get RCE, simply execute an SQL query that writes the file at https://raw.githubusercontent.com/danielmiessler/SecLists/master/Web-Shells/laudanum-0.8/aspx/shell.aspx to D:\██████\shell.aspx using the INTO OUTFILE syntax, then visit https://███/█████████/shell.aspx

Suggested Mitigation/Remediation Actions

Sanitize everything in the SQL query (use prepared statements), and validate the data before putting it in the query.

Note: I wouldn't have been able to find this vulnerability if it wasn't for the fact that verbose error pages were enabled. Because they were, it leaked source code, and I could see that the SQL injection vulnerability existed before testing.

Impact

An attacker could use this vulnerability to control the content in the database, exfiltrate information, and obtain remote code execution.

The original report as published on HackerOne, by arinerron2. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 application concatenated user input directly into an SQL query without using parameterised queries or input validation.

Impact

An attacker could control database content, exfiltrate information, and potentially achieve remote code execution, though the reporter did not attempt RCE on the production system.

What the attacker needed

A user account (any privilege level); access to the recruiter page

How it was found

  1. Sign in to the SSO portal; any user account works.
  2. Open the recruiter update page with developer tools network tab active.
  3. Replay the failing GET request as a POST with app_id set to a single apostrophe.
  4. Observe an Oracle error about a quoted string not properly terminated.
  5. Replay with two apostrophes and observe an invalid number error.
  6. Repeat with odd or even numbers of apostrophes to see different errors.

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 app_id parameter was vulnerable, so an attacker could send special characters to make the database return errors or run unintended commands.

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 arinerron2

View all

2 more disclosed reports, best first.

More from U.S. Dept Of Defense

View all

The newest disclosed reports for this program.

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.