Skip to content
XSS Disclosed report Beginner

Reflected XSS on www.bookfresh.com/index.html?view=upload_form

The upload form page reflects the 'bk' parameter into a style block without encoding when submitted via POST, while GET requests are protected. An attacker could execute arbitrary JavaScript in the context of www.bookfresh.com by tricking a victim into submitting a malicious form.

stefanovettorazzi Follow

Originally disclosed on HackerOne

  • Triaged in 12 hours
  • Fixed in 5 months
  • Disclosed after 2.9 years

The issue is in the view upload_form.

Description When you show an upload form in the site you use an URL like this: https://www.bookfresh.com/index.html?standalone=1&e=0c551a759eb62ba457d017569617eaa8&bk=FFFFFF&view=upload_form And you show the value of the parameter bk in the page: <style>body{ background-color: #[VALUE_OF_BK]; }</style>.

You have protection for XSS because you encode or remove tags like <script>, etc. But the problem is that you are only protecting the GET requests. So, if I do a POST request the value of bk is shown in the page without encoding or removing the tags.

Another problem is that when the file https://www.bookfresh.com/index.html is loaded from the server there is not X-Frame-Options header set in the response. So, it will be more easy to exploit the vulnerability.

Steps to reproduce:

  1. Create a HTML file with this content:

     <form action="https://www.bookfresh.com/index.html" method="post">
      <input type="hidden" name="bk" value="</style><script>alert(document.domain);</script><style>">
      <input type="hidden" name="view" value="upload_form">
     </form>
     <script>
      document.forms[0].submit();
     </script>
    
  2. Create a HTML file with this content:

     <iframe src="[path_of_the_file_from_step_1]"></iframe>
    
  3. Put the files on a server or run a test server on the localhost with something like: php -S localhost:8000

  4. Visit the file created in the step 2 and wait a few seconds.

  5. You will see an alert() with the domain of the frame: www.bookfresh.com.

It works on the last version of Firefox and it doesn't work on the last version of Chrome.

The original report as published on HackerOne, by stefanovettorazzi. 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

The application only applies XSS filtering to GET requests, leaving POST requests unfiltered when reflecting the 'bk' parameter into a style block.

Impact

An attacker could execute JavaScript in the context of www.bookfresh.com; the lack of X-Frame-Options makes the attack easier, and it works on Firefox but not Chrome.

What the attacker needed

Victim visits attacker-controlled page; victim uses Firefox; victim's browser submits the malicious form

The fix

The application should apply the same XSS filtering to POST requests as to GET requests, and set the X-Frame-Options header.

How it was found

  1. Create an HTML file with a form that posts to the target page, setting 'bk' to a payload that breaks out of the style tag and injects a script, and 'view' to 'upload_form'.
  2. Create a second HTML file that embeds the first file in an iframe.
  3. Host both files on a server or run a local test server.
  4. Visit the second file and wait for the form to auto-submit.
  5. Observe the alert showing the domain of the framed page.

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.

When a website takes input from a user and puts it directly into the page without cleaning it, an attacker can insert their own code. Here, the 'bk' value is placed inside a style tag, and by sending it via POST instead of GET, the site's protection is bypassed, allowing a script to run. This lets the attacker run code in the victim's browser as if it came from the trusted site.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by stefanovettorazzi

View all

17 more disclosed reports, best first.

More from Bookfresh

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.