Open aszx87410 opened 3 years ago
in Online Wallet (Part 1), how to get the balance of the Default wallet to 152? i just make it negative
@L0nm4r It seems that there is a race condition in /transfer, but I found it by coincidence and still thinking about how it works
Online Wallet (Part 2)
Description
Steal document.cookie
Writeup
There is a very suspicious part for setting lang via query string:
After changing this value, I found that the
lang
is reflected in response.https://wallet.volgactf-task.ru/wallet?lang=abc123
But
<>"'
is escaped so we can't do XSS here. Let's see what's inside s3 bucket: https://volgactf-wallet.s3-us-west-1.amazonaws.comThere is a new file called
deparam.js
which never use in the web page so I guess we need to import this to do something.content:
The source code already gave us a hint:
/* Prototype Pollution fix */
. So I thought the goal is to leverage prototype pollution and trigger XSS via jquery or tooltip.After trying for few payloads, prototype pollution can be triggered via
a[0]=2&a[__proto__][__proto__][abc]=1
POC:
The next step is to see if there is any gadget we can use: https://github.com/BlackFan/client-side-prototype-pollution/blob/master/gadgets/jquery.md
But from the source of the web page we know that only
$('[data-toggle="tooltip"]').tooltip()
has been called after content loaded, so I think it's the key and we need to use it. I tried for an hour to see if I can pollute thetemplate
ortitle
options for tooltip but it doesn't work.After trace the source code of bootstrap tooltip, when tooltip show,
getTipElement
will be triggered:https://github.com/twbs/bootstrap/blob/8fa0d3010112dca5dd6dd501173415856001ba8b/js/src/tooltip.js#L422
template is html so we can use this jQuery gadget now:
But how to show the tooltip? We can show the tooltip if it gets focused, and luckily there is an id for the tooltip element:
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" title="Not implemented yet" id="depositButton">
So combined with all the vulnerabilities above, the steps are:
lang
to importdeparam.js
#depositButton
to trigger tooltip and do XSSWe can create a simple html page and use iframe to load the website. After it's loaded we update the src to
#depositButton
to let tooltip get focus and trigger XSS.