Skip to content
Access control Write-up Intermediate

How I hacked companies related to the crypto currency and earned $60,000

The author found multiple vulnerabilities across cryptocurrency services, including blind XSS leading to admin panel access without authentication, CSRF allowing fund withdrawal, and IDOR exposing support tickets with personal data. These flaws could let attackers view or modify user information, steal funds, or access sensitive documents.

Max Follow

Published on medium.com

Bounty$59,400total stated by author View original

Now everyone talks about bitcoin and crypto-currencies. My acquaintance with crypto-currencies occurred about 5 months ago, that’s when I started investing in bitcoin and ethereum, the rate at that time was $1900 for BTC and $89 for eth.

Max, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

Context

This is an account of a five-month bug hunting run against services in the cryptocurrency space: two trust management (TM) platforms, three exchanges and a fourth exchange that asked not to be named. The targets are anonymised in the text as example1.com, example2.com and example3.com; the exchanges named openly are livecoin.net and okex.com (with its sibling sites okcoin.com and okcoin.cn). The features involved are ordinary account and support features: a user profile page in an admin panel, a withdrawal-details form, a support ticket system with attachments, an affiliate program wallet setting, and an order cancellation endpoint.

The author's stated motivation was to see how safe the services were where he traded or gave his savings to trust management.

Setup

  • Accounts on each target, including a second account on example1.com registered with a JavaScript payload in place of the name field.
  • A blind XSS listener (referred to as a sniffer) to receive callbacks.
  • Burp Intruder for enumerating ticket identifiers.
  • A Google Translate browser extension, used on okex because parts of the interface were only in Chinese.
  • No special privileges on any target at the start; the goal in each case was to move from a normal user account to administrative or cross-user access.

Finding it

example1.com: blind XSS into an unauthenticated admin panel

The first TM looked well defended: filtering everywhere, CSRF tokens, nothing obvious. The author registered a second account and put a JavaScript sniffer in the name field instead of a name. Nothing arrived for a long time, until logs came back containing source code, the admin IP and local storage.

The payload executed when an administrator opened the user data page at:

Text
http://admin.example1.com/user/default/index?page=75

The author notes that similar vulnerabilities are increasingly encountered on HackerOne, citing report 251224 as an example.

The logs were disappointing in one respect: all cookies carried the HttpOnly flag, so no session could be taken and the admin panel could not be entered by cookie theft. But opening the same URL directly showed that the admin panel could be used without authorisation, which the author describes as a gross developer error and an improper access control vulnerability.

Exploitation

Step 1: enumerate and read user records in the admin panel

With the panel reachable unauthenticated, the author could view and change information about 2010 users: email, phone, social network links, bitcoin wallet address, login, balance and referrer. The screenshot below shows one of the richest investors in the author's club, a user with many subscribers who recommended the platform to his audience through a referral link, capped at 20% of capital, and who earned 20 bitcoins on it, which the author values at $227,000 at the time of writing.

From the original on medium.com

The author notes that an attacker with no training could walk into the panel and change every investor's email address to their own, or change withdrawal wallets so that the victim's withdrawal silently goes elsewhere. Many investors held deposits above 0.5 BTC. He also remarks that, oddly, the panel did not store passwords in clear text.

Step 2: report and outcome on example1.com

The report went to the developers, who contacted the creator and fixed the vulnerability. The bounty was offered as credit on the platform's own account, where it would earn interest: about half a year to break even and a year to withdraw the principal. A month later the author found a similar blind XSS in the same service and received another bounty; by then the original developers had been fired (and, as far as he understood, had not been paid for their work) and other people had taken over development.

Step 3: example2.com, two chained CSRF bugs

The second TM is described as a top, popular service with a 20,000 Alexa world rank and 3,000 in Russia. A thorough review found nothing, not even clickjacking, except two CSRF vulnerabilities in POST requests:

  1. The first changed the details used for withdrawing funds; the user only had to click a link to the CSRF exploit.
  2. The second withdrew the user's money to the already changed details.

Chained, a user who simply follows a link loses all their money. The author notes the delivery route: an attacker could hire a social engineering specialist and spam the participants of their chat in a Telegram.

Step 4: the response on example2.com

The developers replied that because the user had to visit a link, the vulnerability was not dangerous at all. The author sent further letters with evidence that the bug deserved attention and had to be fixed immediately, and was ignored. Later, user details began changing en masse; the author learned this from one of the developers, who wrote that, as he understood it, the users themselves made the withdrawals and the funds began to disappear. The developer asked for the report again, and Google reCAPTCHA was added to the details-change form along with SMS confirmation (for sure).

Step 5: exchanges, starting with livecoin.net

Poloniex was deliberately skipped: it does not pay for vulnerabilities, the author kept no capital there, and he cites a darknet sale of a two-factor authentication bypass as evidence of its attitude to security:

Text
https://twitter.com/misterch0c/status/897756404093726720
From the original on medium.com

He also recounts that he once had $6,000 on a Poloniex account and went to his account from a VPN in Moldova quite by accident, after which the account was blocked immediately; he waited a fortnight to unlock it and then withdrew all his money.

On livecoin.net he found only a low-impact self XSS, with no clickjacking and no CSRF in POST requests, and was paid $200 by fiat fund.

Step 6: okex.com and its sibling sites

okex is described as popular in China and worldwide, with some functionality only in Chinese. The author checked subdomains and directories and found that okcoin.com (6,000 Alexa in China) and okcoin.cn (9,000 worldwide, 2,000 in China) share exactly the same design and functionality as okex, so a vulnerability on one applies to the others. He then turned to user support and found several issues.

6a. IDOR in support tickets

The ticket URL:

Text
https://www.okex.com/question/questionDetail.do?workOrderId=2550

allowed viewing all 2500 okex tickets at the time (later 4898), on one exchange alone. Each ticket displayed the full phone number, email, real name, the text of the correspondence between user and support, and the full path to the attachment.

From the original on medium.com

Many users go through verification in support to raise their withdrawal limit, attaching a photo of themselves with their passport or simply a photo of the passport. The author reproduces several of these with the data hidden.

From the original on medium.com

Besides passports there were many photos and screenshots taken from device screens.

From the original on medium.com

To download all tickets as evidence, he first ran Burp Intruder against the ticket URL with numbers from 1 to 2549 and got nothing. Going back to support and intercepting requests showed that the page loaded its content through a GET request to:

Text
https://www.okex.com/v2/support/cs/work-order/2550/replies

Putting that request into Intruder downloaded every ticket, which could then be handed to the exchange's developers.

6b. Stored XSS in the API

JavaScript was not reflected in the ticket page itself at /question/questionDetail.do?workOrderId=2550, apparently because forbidden characters were filtered. In the API at the same path everything worked, including JavaScript loaded from third-party domains.

Combined with the IDOR, the author's proposed attack chain was:

  1. Collect all email addresses.
  2. On the attacker's page, embed a JavaScript or HTML redirect to a phishing copy of the exchange itself (one form per exchange), Myetherwallet, blockchain.info and so on. He describes attackers who, right after login and password entry on poloniex.com, bittrex.com or blockchain.info, ask the victim for a 2FA code every 15 seconds (to log in, to withdraw), with the victim needing to answer very quickly because the code expires shortly. He lists the tricks used: Unicode characters to swap letters such as i for L (BlTTREX.com, POIONIEX.COm), registering the exchange on a different domain such as poloniex.com.ua, and Android apps advertised in search engines. In 2017, he writes, criminals stole more than $80 million from users this way.
  3. Send emails to the collected addresses, agreed in advance with a person versed in social engineering, so that users believe the letter and follow the link, since it leads to the exchange rather than a third-party site.
  4. (left open in the original)
  5. Use the captured credentials to withdraw the money.

6c. IDOR when adding a comment

A message could be added on behalf of the user who created the ticket. The short request:

HTTP
POST /v2/support/cs/work-order/reply HTTP/1.1

Host: http://www.okcoin.com

*workId=718&content=test_message*

6d. HTML injection in an attachment domain

HTML injection was possible in an HTML file attached to a ticket, served from the domain bafangpublic.oss-cn-hangzhou.aliyuncs.com. The author notes the domain is no longer available and that whois says it belongs to Hangzhou Alibaba Advertising Co. Ltd.

6e. Phone number disclosure

On the security page the phone is shown as 636818 **** and in cookies as 6 * 6, but the support API response at /v2/support/cs/work-order/2550/replies returned it in full.

Because all the exchanges share one owner, the author sent one report to okex's chat and email rather than writing to each site separately. He received a message from the official okex account on Twitter very quickly, and the vulnerabilities were fixed.

Step 7: example3.com, XSS in the affiliate program

This exchange did not allow disclosure of vulnerability information, quoted as:

Regarding posting on your blog, we would appreciate if you do not do this at the moment. Our site is not 100% secure yet.

The author found XSS in the wallet, specifically in the affiliate program section, and turned a self XSS into a stored XSS using a CSRF exploit. Cookies could be stolen because there was no HttpOnly flag. He had recorded a video but could not attach it because the exchange's name is visible in it.

For this XSS in the support service he was offered $100, but almost at the same time logs from their domain for employees arrived at his sniffer.

From the original on medium.com

The logs contained only one cookie:

Text
AWSELB=2ЕB3B1851EC08CCFEEC18E2DB93AE1EF2A69A2A2F9D65DCC84AB785C7C7773319F1F769CCF35CA8F430D5785D5AE4AB2C48C46EE6BE8F33Cу293D40F3CCA9F92E38E62AA65

The session cookie, the important one, was missing, so the admin panel could not be entered by substituting cookies. Checking the report carefully, the author found the administrator's login and password in the source code.

From the original on medium.com

But when he went to the login page, he saw this.

From the original on medium.com

So the admin panel could not be entered with the username and password alone: access to the Google Authenticator app was needed, or a redirect to a phishing site from inside the admin area to steal the authenticator code and enter it quickly. The author calls the second option quite realisable.

Step 8: two more bugs on example3.com

While writing the blind XSS report he also found:

  1. A CSRF vulnerability in changing the details for withdrawal of affiliate funds. The short request:
HTTP
POST /affiliate_program HTTP/1.1

Host: www.example3.com

wallet=my_wallet&act=wallet

No security token was present, and an exploit was written.

  1. An IDOR in order removal at:
Text
https://example3.com/account?act=cancel&order=ID_of_order

If a user has already created an order to transfer bitcoins to the exchange's wallet, the action can be cancelled. At best the order simply leaves the system; at worst the user transfers the bitcoins and loses the money. The author considers this vulnerability mainly useful only for competing exchanges, not for hackers.

Step 9: the bounty on example3.com

After the new report, the chief security officer contacted him to discuss the vulnerabilities and wanted to talk on Skype or by phone, but the author's English was average at the time, so they stayed in chat. He was offered 0.1 BTC ($1130):

After consulting with our finance and regarding our situation, we can pay you 0.1 btc. This is the highest amount we paid for a bug and is much higher than what we usually pay. It’s to show our appreciation to you and the way you handled the situation.

Totals

Target Reward
Trust management example1.com 1 BTC
Trust management example2.com 0.122 BTC
Exchange livecoin.net $200 by fiat means
Exchange okex.com 2 BTC
Exchange example3.com 0.1 BTC

1 + 0.122 + 2 + 0.1 + $200 = $59,400, and the author notes the dollar figure grows with the bitcoin rate. The author is grateful to okex for the bounty, and the exchange's CTO allowed public disclosure of the vulnerability.

Root cause

The recurring mistake is missing authorisation and missing server-side validation on endpoints that the UI only appears to protect. On example1.com, the admin panel at admin.example1.com/user/default/index?page=75 rendered user records to anyone who requested it; the blind XSS only revealed the URL, the access control failure did the rest. On okex, the ticket page filtered characters but the API behind it (/v2/support/cs/work-order/2550/replies) did not, and the same API returned the full phone number that the UI masked. On example2.com and example3.com, state-changing POST requests (withdrawal details, affiliate wallet) carried no anti-CSRF token. The order-cancellation endpoint took an order identifier in the URL. In several cases the existing defences (HttpOnly cookies, character filtering on one view, masked display of a phone number) addressed the symptom in one place while leaving the underlying endpoint open.

Impact

  • example1.com: unauthenticated read and modification of 2010 users' email, phone, social links, wallet address, login, balance and referrer, which an attacker could use to change emails or withdrawal wallets; many deposits exceeded 0.5 BTC.
  • example2.com: a single link click could change a user's withdrawal details and then withdraw their funds to those details, so the user would lose all his money. The developers initially dismissed it as not dangerous because a click was required.
  • okex/okcoin: enumeration of every support ticket (2500 at the time, 4898 later) exposing full phone numbers, emails, real names, correspondence and attachment paths, including passport photos and device screenshots; stored XSS in the API that, combined with the ticket IDOR, could be used for phishing and credential/2FA theft; comment injection on behalf of ticket creators; HTML injection on an attachment domain; full phone number disclosure through the API.
  • example3.com: stored XSS in the affiliate program reachable via CSRF, with cookies readable because HttpOnly was absent; CSRF on the affiliate wallet setting; IDOR allowing cancellation of an order. Admin credentials found in source code were not enough on their own because of Google Authenticator.

Fix

What the report says was changed:

  • example1.com: the vulnerability was fixed after the report.
  • example2.com: Google reCAPTCHA was added to the details-change form, along with SMS confirmation.
  • okex: the vulnerabilities were fixed after the report reached the exchange.

What the findings imply should be done, where the report does not state a fix: enforce authorisation on every admin route and on every object-level endpoint (tickets, replies, orders) rather than relying on the UI; apply the same output encoding and input filtering on the API as on the HTML view; return masked phone numbers from APIs as well as from pages; add anti-CSRF tokens to all state-changing POST requests, including withdrawal details and affiliate wallet changes; set HttpOnly on session cookies; and keep credentials out of client-side source code.

Variants to test

  1. Blind XSS in profile fields. Put a callback payload in name, address or nickname fields and wait for staff to open the record. A positive result is a callback containing the admin URL, source or storage contents.
  2. Direct request to admin URLs seen in callbacks. Fetch the URL without cookies. A positive result is a rendered admin page with user data.
  3. CSRF on withdrawal-detail and withdrawal endpoints. Submit the form cross-origin without a token. A positive result is a changed payout address followed by a successful withdrawal to it.
  4. IDOR on ticket and reply APIs. Increment the identifier in the JSON/GET endpoint behind a filtered HTML page. A positive result is another user's ticket content, including attachments and personal data.
  5. Stored XSS in the API behind a filtered view. Submit markup to the API endpoint directly. A positive result is execution, including scripts from third-party domains.
  6. Comment injection on behalf of another user. Post a reply with another user's work identifier. A positive result is a message attributed to that user.
  7. HTML injection in attachment hosting. Upload an HTML file and open it from the storage domain. A positive result is script execution on that domain.
  8. Masked versus raw data. Compare what the UI masks with what the API returns for the same field. A positive result is an unmasked phone number or identifier in the response.
  9. Self XSS escalated by CSRF. Combine a self-only script with a tokenless POST. A positive result is stored execution in another user's session and readable cookies where HttpOnly is missing.
  10. IDOR on order cancellation. Change the order identifier in the cancel request. A positive result is cancellation of another user's pending withdrawal.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 24 min read.

What happened, in plain words

A security researcher looked for weaknesses in websites that deal with cryptocurrency: two platforms that manage investments for you (called trust management, or TM) and several exchanges, one of which asked not to be named. The sites are anonymised as example1.com, example2.com and example3.com; the exchanges named openly are livecoin.net and okex.com (with its sibling sites okcoin.com and okcoin.cn). The features involved are ordinary account and support features: a user profile page in an admin panel, a withdrawal-details form, a support ticket system with attachments, an affiliate program wallet setting, and an order cancellation endpoint.

The researcher's motivation was simple: he wanted to see how safe the services were where he traded his savings or gave them to trust management. He started with a normal user account on each site and tried to reach administrative or other users' data. Along the way he found missing access checks, cross-site request forgery (CSRF), insecure direct object references (IDOR), stored cross-site scripting (XSS) and HTML injection. He reported the findings and was paid bounties totalling about $59,400 at the time.

This article walks through each finding in the order he made them, explains the technical terms, and shows the requests he used. If you have never done security testing, you can follow along: all you need is a browser and some curiosity.

Setup

Before looking for bugs, the researcher prepared a few tools and accounts:

  • Accounts on each target, including a second account on example1.com registered with a JavaScript payload in place of the name field.
  • A blind XSS listener (referred to as a sniffer) to receive callbacks.
  • Burp Intruder for enumerating ticket identifiers.
  • A Google Translate browser extension, used on okex because parts of the interface were only in Chinese.
  • No special privileges on any target at the start; the goal in each case was to move from a normal user account to administrative or cross-user access.

Let us unpack those terms.

JavaScript is the programming language that runs inside your browser. It can read the page, change it, and send data to other servers. When a site lets someone else's JavaScript run in your browser, that is a cross-site scripting (XSS) vulnerability.

Blind XSS is a type of XSS where the script you inject does not run immediately in your own browser. Instead, it is stored by the site and later runs in someone else's browser, typically an administrator's. You cannot see the result directly, so you set up a listener (also called a sniffer): a small server you control that waits for connections. When the administrator's browser runs your script, the script sends a message back to your listener, and you see it. It is like leaving a note in a suggestion box and waiting to see if the manager reads it and calls the number you left.

Burp Intruder is a feature of Burp Suite, a tool used by security testers to intercept and modify web traffic. Intruder automates sending many requests with different values in a chosen position, for example trying every number from 1 to 2549 in a URL parameter. Think of it as a machine that fills in a form repeatedly with different inputs and records the responses.

Google Translate extension is a browser add-on that translates text on a page. The researcher used it to read Chinese parts of okex without leaving the page.

Privileges are the permissions an account has. A normal user can see their own data; an administrator can see everyone's. The researcher started with normal user privileges and tried to gain more.

Finding it

example1.com: blind XSS into an unauthenticated admin panel

The first TM looked well defended: filtering everywhere, CSRF tokens, nothing obvious. Filtering means the site checks input and removes or blocks characters that could be dangerous, such as < and >. CSRF tokens are random values added to forms to prove that the request came from the site's own page and not from an attacker's page. We will explain CSRF in detail later.

The researcher registered a second account and put a JavaScript sniffer in the name field instead of a name. A sniffer here is a piece of JavaScript that, when executed, sends information back to the researcher's server. He waited. Nothing arrived for a long time, until logs came back containing source code, the admin IP and local storage.

Source code is the HTML, JavaScript and other code that makes up a page. Local storage is a place in your browser where a site can save data, similar to a cookie but not sent automatically with every request. Admin IP is the internet address of the administrator's computer; it can help identify the admin's network.

The payload executed when an administrator opened the user data page at:

Text
http://admin.example1.com/user/default/index?page=75

This is a URL. admin.example1.com is a subdomain used for administration. The path /user/default/index is a page that lists users, and ?page=75 tells it to show page 75 of the list. The URL appeared in the logs that his sniffer sent back. The fact that the script ran means the administrator's browser loaded the name field containing the script and executed it.

The author notes that similar vulnerabilities are increasingly encountered on HackerOne, citing report 251224 as an example. HackerOne is a platform where security researchers report bugs to companies and sometimes earn bounties.

The logs were disappointing in one respect: all cookies carried the HttpOnly flag, so no session could be taken and the admin panel could not be entered by cookie theft. Cookies are small pieces of data a site stores in your browser and sends with every request to that site; they often contain a session identifier that proves you are logged in. HttpOnly is a setting that stops JavaScript from reading the cookie, which prevents an attacker who injects JavaScript from stealing the session. Session is the logged-in state of a user.

But opening the same URL directly showed that the admin panel could be used without authorisation, which the author describes as a gross developer error and an improper access control vulnerability. Authorisation is the check that a user is allowed to do something. Improper access control means the check is missing or wrong, so someone who should not have access gets it anyway. In plain terms: the door to the admin room was unlocked, and the blind XSS had just told him where the room was.

Exploitation

Step 1: enumerate and read user records in the admin panel

With the panel reachable unauthenticated, the author could view and change information about 2010 users: email, phone, social network links, bitcoin wallet address, login, balance and referrer. Enumerate means to list items one by one, often by trying sequential numbers or identifiers. Here it means reading through the user records. A referrer is the person who invited a user, often through a referral link.

The screenshot below shows one of the richest investors in the author's club, a user with many subscribers who recommended the platform to his audience through a referral link, capped at 20% of capital, and who earned 20 bitcoins on it, which the author values at $227,000 at the time of writing.

From the original on medium.com

The author notes that an attacker with no training could walk into the panel and change every investor's email address to their own, or change withdrawal wallets so that the victim's withdrawal silently goes elsewhere. Many investors held deposits above 0.5 BTC. He also remarks that, oddly, the panel did not store passwords in clear text. Clear text means not encrypted or hashed; storing passwords in clear text is dangerous because anyone who reads the database sees them.

Step 2: report and outcome on example1.com

The report went to the developers, who contacted the creator and fixed the vulnerability. The bounty was offered as credit on the platform's own account, where it would earn interest: about half a year to break even and a year to withdraw the principal. A month later the author found a similar blind XSS in the same service and received another bounty; by then the original developers had been fired (and, as far as he understood, had not been paid for their work) and other people had taken over development.

Step 3: example2.com, two chained CSRF bugs

The second TM is described as a top, popular service with a 20,000 Alexa world rank and 3,000 in Russia. Alexa rank was a measure of website popularity; a lower number means more traffic. A thorough review found nothing, not even clickjacking, except two CSRF vulnerabilities in POST requests.

Clickjacking is a trick where an attacker loads a site inside an invisible frame on their own page and gets you to click something you did not intend to click. POST request is one of the HTTP methods used to send data to a server, typically when you submit a form. CSRF stands for Cross-Site Request Forgery. It works like this: you are logged in to your bank, and you visit an attacker's page. That page contains a hidden form that submits a request to the bank. Because your browser automatically sends your bank cookies with the request, the bank thinks the request came from you. The attacker never sees your password; they just make your browser send the request. It is like someone forging your signature on a letter because your pen was on the desk.

The two CSRF bugs were:

  1. The first changed the details used for withdrawing funds; the user only had to click a link to the CSRF exploit.
  2. The second withdrew the user's money to the already changed details.

Chained, a user who simply follows a link loses all their money. The author notes the delivery route: an attacker could hire a social engineering specialist and spam the participants of their chat in a Telegram. Social engineering is manipulating people into doing something, like clicking a link, by pretending to be trustworthy.

Step 4: the response on example2.com

The developers replied that because the user had to visit a link, the vulnerability was not dangerous at all. The author sent further letters with evidence that the bug deserved attention and had to be fixed immediately, and was ignored. Later, user details began changing en masse; the author learned this from one of the developers, who wrote that, as he understood it, the users themselves made the withdrawals and the funds began to disappear. The developer asked for the report again, and Google reCAPTCHA was added to the details-change form along with SMS confirmation (for sure). Google reCAPTCHA is a challenge that tries to tell humans from bots. SMS confirmation means the site sends a code by text message that the user must enter.

Step 5: exchanges, starting with livecoin.net

Poloniex was deliberately skipped: it does not pay for vulnerabilities, the author kept no capital there, and he cites a darknet sale of a two-factor authentication bypass as evidence of its attitude to security:

Text
https://twitter.com/misterch0c/status/897756404093726720
From the original on medium.com

Two-factor authentication (2FA) is a second proof of identity beyond a password, such as a code from an app or a text message. A bypass is a way around it. Darknet is a part of the internet often used for illegal trade.

He also recounts that he once had $6,000 on a Poloniex account and went to his account from a VPN in Moldova quite by accident, after which the account was blocked immediately; he waited a fortnight to unlock it and then withdrew all his money. A VPN (virtual private network) routes your traffic through another location, so the site saw a login from Moldova.

On livecoin.net he found only a low-impact self XSS, with no clickjacking and no CSRF in POST requests, and was paid $200 by fiat fund. Self XSS is an XSS that only affects the person who enters the payload, not other users; it is usually considered low impact because the attacker would have to trick the victim into attacking themselves. Fiat means ordinary government-issued money, like dollars, as opposed to cryptocurrency.

Step 6: okex.com and its sibling sites

okex is described as popular in China and worldwide, with some functionality only in Chinese. The author checked subdomains and directories and found that okcoin.com (6,000 Alexa in China) and okcoin.cn (9,000 worldwide, 2,000 in China) share exactly the same design and functionality as okex, so a vulnerability on one applies to the others. Subdomains are prefixes like www or api before the main domain. Directories are folders in the URL path. He then turned to user support and found several issues.

6a. IDOR in support tickets

The ticket URL:

Text
https://www.okex.com/question/questionDetail.do?workOrderId=2550

allowed viewing all 2500 okex tickets at the time (later 4898), on one exchange alone. Each ticket displayed the full phone number, email, real name, the text of the correspondence between user and support, and the full path to the attachment.

From the original on medium.com

IDOR stands for Insecure Direct Object Reference. It means the site uses something like a number in the URL to identify a record, and does not check that you are allowed to see that record. If you change workOrderId=2550 to 2551, you see someone else's ticket. It is like a hotel where your room key opens every door because the lock only checks that you have a key, not which room it is for.

Many users go through verification in support to raise their withdrawal limit, attaching a photo of themselves with their passport or simply a photo of the passport. The author reproduces several of these with the data hidden.

From the original on medium.com

Besides passports there were many photos and screenshots taken from device screens.

From the original on medium.com

To download all tickets as evidence, he first ran Burp Intruder against the ticket URL with numbers from 1 to 2549 and got nothing. Going back to support and intercepting requests showed that the page loaded its content through a GET request to:

Text
https://www.okex.com/v2/support/cs/work-order/2550/replies

Putting that request into Intruder downloaded every ticket, which could then be handed to the exchange's developers. GET request is the HTTP method used when your browser asks for a page or data; parameters are in the URL. Intercepting means using a proxy tool like Burp to pause and inspect requests between your browser and the server.

6b. Stored XSS in the API

JavaScript was not reflected in the ticket page itself at /question/questionDetail.do?workOrderId=2550, apparently because forbidden characters were filtered. In the API at the same path everything worked, including JavaScript loaded from third-party domains. API stands for Application Programming Interface; here it means a separate endpoint that returns data (often in JSON) for the page to display. Stored XSS means the malicious script is saved on the server and later served to other users. Reflected means the script is immediately returned in the response to the same request, not stored.

Combined with the IDOR, the author's proposed attack chain was:

  1. Collect all email addresses.
  2. On the attacker's page, embed a JavaScript or HTML redirect to a phishing copy of the exchange itself (one form per exchange), Myetherwallet, blockchain.info and so on. He describes attackers who, right after login and password entry on poloniex.com, bittrex.com or blockchain.info, ask the victim for a 2FA code every 15 seconds (to log in, to withdraw), with the victim needing to answer very quickly because the code expires shortly. He lists the tricks used: Unicode characters to swap letters such as i for L (BlTTREX.com, POIONIEX.COm), registering the exchange on a different domain such as poloniex.com.ua, and Android apps advertised in search engines. In 2017, he writes, criminals stole more than $80 million from users this way. Phishing is a fake site that looks like the real one and steals your credentials. Unicode characters are characters from different alphabets that look similar to Latin letters; attackers use them to make a fake domain look real.
  3. Send emails to the collected addresses, agreed in advance with a person versed in social engineering, so that users believe the letter and follow the link, since it leads to the exchange rather than a third-party site.
  4. (left open in the original)
  5. Use the captured credentials to withdraw the money.

6c. IDOR when adding a comment

A message could be added on behalf of the user who created the ticket. The short request:

HTTP
POST /v2/support/cs/work-order/reply HTTP/1.1

Host: http://www.okcoin.com

*workId=718&content=test_message*

This is an HTTP request in raw form. The first line says it is a POST to the path /v2/support/cs/work-order/reply using HTTP version 1.1. The Host header tells the server which site the request is for. The body contains workId=718 (the ticket identifier) and content=test_message (the message text). Because there is no check that the sender owns ticket 718, an attacker can post a reply as if they were that user.

6d. HTML injection in an attachment domain

HTML injection was possible in an HTML file attached to a ticket, served from the domain bafangpublic.oss-cn-hangzhou.aliyuncs.com. The author notes the domain is no longer available and that whois says it belongs to Hangzhou Alibaba Advertising Co. Ltd. HTML injection means inserting HTML markup into a page where it is not properly escaped, so the browser renders it as part of the page. whois is a public lookup service that shows who registered a domain.

6e. Phone number disclosure

On the security page the phone is shown as 636818 **** and in cookies as 6 * 6, but the support API response at /v2/support/cs/work-order/2550/replies returned it in full. Disclosure means revealing information that should be hidden. The UI masked the number, but the API did not.

Because all the exchanges share one owner, the author sent one report to okex's chat and email rather than writing to each site separately. He received a message from the official okex account on Twitter very quickly, and the vulnerabilities were fixed.

Step 7: example3.com, XSS in the affiliate program

This exchange did not allow disclosure of vulnerability information, quoted as:

Regarding posting on your blog, we would appreciate if you do not do this at the moment. Our site is not 100% secure yet.

The author found XSS in the wallet, specifically in the affiliate program section, and turned a self XSS into a stored XSS using a CSRF exploit. Cookies could be stolen because there was no HttpOnly flag. He had recorded a video but could not attach it because the exchange's name is visible in it. Affiliate program is a scheme where you earn a commission for referring new users.

For this XSS in the support service he was offered $100, but almost at the same time logs from their domain for employees arrived at his sniffer.

From the original on medium.com

The logs contained only one cookie:

Text
AWSELB=2ЕB3B1851EC08CCFEEC18E2DB93AE1EF2A69A2A2F9D65DCC84AB785C7C7773319F1F769CCF35CA8F430D5785D5AE4AB2C48C46EE6BE8F33Cу293D40F3CCA9F92E38E62AA65

This is a cookie named AWSELB with a long value. AWSELB is a load balancer cookie used by Amazon Web Services to route requests to the same server. It is not the session cookie. The session cookie, the important one, was missing, so the admin panel could not be entered by substituting cookies. Substituting cookies means taking a cookie from one session and using it in another to impersonate a user.

Checking the report carefully, the author found the administrator's login and password in the source code.

From the original on medium.com

But when he went to the login page, he saw this.

From the original on medium.com

So the admin panel could not be entered with the username and password alone: access to the Google Authenticator app was needed, or a redirect to a phishing site from inside the admin area to steal the authenticator code and enter it quickly. The author calls the second option quite realisable. Google Authenticator is an app that generates time-based one-time codes for 2FA.

Step 8: two more bugs on example3.com

While writing the blind XSS report he also found:

  1. A CSRF vulnerability in changing the details for withdrawal of affiliate funds. The short request:
HTTP
POST /affiliate_program HTTP/1.1

Host: www.example3.com

wallet=my_wallet&act=wallet

No security token was present, and an exploit was written. This request changes the affiliate wallet to my_wallet. Because there is no CSRF token, an attacker can make a logged-in user's browser send it.

  1. An IDOR in order removal at:
Text
https://example3.com/account?act=cancel&order=ID_of_order

If a user has already created an order to transfer bitcoins to the exchange's wallet, the action can be cancelled. At best the order simply leaves the system; at worst the user transfers the bitcoins and loses the money. The author considers this vulnerability mainly useful only for competing exchanges, not for hackers. The order parameter is the order identifier; changing it cancels someone else's order.

Step 9: the bounty on example3.com

After the new report, the chief security officer contacted him to discuss the vulnerabilities and wanted to talk on Skype or by phone, but the author's English was average at the time, so they stayed in chat. He was offered 0.1 BTC ($1130):

After consulting with our finance and regarding our situation, we can pay you 0.1 btc. This is the highest amount we paid for a bug and is much higher than what we usually pay. It’s to show our appreciation to you and the way you handled the situation.

Totals

Target Reward
Trust management example1.com 1 BTC
Trust management example2.com 0.122 BTC
Exchange livecoin.net $200 by fiat means
Exchange okex.com 2 BTC
Exchange example3.com 0.1 BTC

1 + 0.122 + 2 + 0.1 + $200 = $59,400, and the author notes the dollar figure grows with the bitcoin rate. The author is grateful to okex for the bounty, and the exchange's CTO allowed public disclosure of the vulnerability. CTO stands for Chief Technology Officer, a senior technical executive.

Root cause

The recurring mistake is missing authorisation and missing server-side validation on endpoints that the UI only appears to protect. Server-side validation means the server checks the data it receives, not just the browser. On example1.com, the admin panel at admin.example1.com/user/default/index?page=75 rendered user records to anyone who requested it; the blind XSS only revealed the URL, the access control failure did the rest. On okex, the ticket page filtered characters but the API behind it (/v2/support/cs/work-order/2550/replies) did not, and the same API returned the full phone number that the UI masked. On example2.com and example3.com, state-changing POST requests (withdrawal details, affiliate wallet) carried no anti-CSRF token. The order-cancellation endpoint took an order identifier in the URL. In several cases the existing defences (HttpOnly cookies, character filtering on one view, masked display of a phone number) addressed the symptom in one place while leaving the underlying endpoint open.

Impact

  • example1.com: unauthenticated read and modification of 2010 users' email, phone, social links, wallet address, login, balance and referrer, which an attacker could use to change emails or withdrawal wallets; many deposits exceeded 0.5 BTC.
  • example2.com: a single link click could change a user's withdrawal details and then withdraw their funds to those details, so the user would lose all his money. The developers initially dismissed it as not dangerous because a click was required.
  • okex/okcoin: enumeration of every support ticket (2500 at the time, 4898 later) exposing full phone numbers, emails, real names, correspondence and attachment paths, including passport photos and device screenshots; stored XSS in the API that, combined with the ticket IDOR, could be used for phishing and credential/2FA theft; comment injection on behalf of ticket creators; HTML injection on an attachment domain; full phone number disclosure through the API.
  • example3.com: stored XSS in the affiliate program reachable via CSRF, with cookies readable because HttpOnly was absent; CSRF on the affiliate wallet setting; IDOR allowing cancellation of an order. Admin credentials found in source code were not enough on their own because of Google Authenticator.

Fix

What the report says was changed:

  • example1.com: the vulnerability was fixed after the report.
  • example2.com: Google reCAPTCHA was added to the details-change form, along with SMS confirmation.
  • okex: the vulnerabilities were fixed after the report reached the exchange.

What the findings imply should be done, where the report does not state a fix: enforce authorisation on every admin route and on every object-level endpoint (tickets, replies, orders) rather than relying on the UI; apply the same output encoding and input filtering on the API as on the HTML view; return masked phone numbers from APIs as well as from pages; add anti-CSRF tokens to all state-changing POST requests, including withdrawal details and affiliate wallet changes; set HttpOnly on session cookies; and keep credentials out of client-side source code. Output encoding means converting characters like < into safe representations so they are displayed as text, not executed as code.

Variants to test

  1. Blind XSS in profile fields. Put a callback payload in name, address or nickname fields and wait for staff to open the record. A positive result is a callback containing the admin URL, source or storage contents.
  2. Direct request to admin URLs seen in callbacks. Fetch the URL without cookies. A positive result is a rendered admin page with user data.
  3. CSRF on withdrawal-detail and withdrawal endpoints. Submit the form cross-origin without a token. A positive result is a changed payout address followed by a successful withdrawal to it.
  4. IDOR on ticket and reply APIs. Increment the identifier in the JSON/GET endpoint behind a filtered HTML page. A positive result is another user's ticket content, including attachments and personal data.
  5. Stored XSS in the API behind a filtered view. Submit markup to the API endpoint directly. A positive result is execution, including scripts from third-party domains.
  6. Comment injection on behalf of another user. Post a reply with another user's work identifier. A positive result is a message attributed to that user.
  7. HTML injection in attachment hosting. Upload an HTML file and open it from the storage domain. A positive result is script execution on that domain.
  8. Masked versus raw data. Compare what the UI masks with what the API returns for the same field. A positive result is an unmasked phone number or identifier in the response.
  9. Self XSS escalated by CSRF. Combine a self-only script with a tokenless POST. A positive result is stored execution in another user's session and readable cookies where HttpOnly is missing.
  10. IDOR on order cancellation. Change the order identifier in the cancel request. A positive result is cancellation of another user's pending withdrawal.

Glossary

  • 2FA (two-factor authentication): a second proof of identity beyond a password, such as a code from an app or a text message.
  • Admin IP: the internet address of the administrator's computer.
  • Affiliate program: a scheme where you earn a commission for referring new users.
  • Alexa rank: a former measure of website popularity; lower number means more traffic.
  • API (Application Programming Interface): a separate endpoint that returns data for a page to display, often in JSON.
  • Authorisation: the check that a user is allowed to do something.
  • Blind XSS: XSS where the script runs in someone else's browser later, not immediately in yours.
  • Burp Intruder: a tool that automates sending many requests with different values in a chosen position.
  • Clear text: not encrypted or hashed; readable by anyone.
  • Clickjacking: tricking a user into clicking something they did not intend by hiding it in a frame.
  • Cookie: a small piece of data a site stores in your browser and sends with requests to that site.
  • CSRF (Cross-Site Request Forgery): making a logged-in user's browser send a request to a site without their knowledge.
  • CSRF token: a random value in a form that proves the request came from the site's own page.
  • CTO (Chief Technology Officer): a senior technical executive.
  • Darknet: a part of the internet often used for illegal trade.
  • Directories: folders in a URL path.
  • Disclosure: revealing information that should be hidden.
  • Enumerate: to list items one by one, often by trying sequential numbers.
  • Fiat: ordinary government-issued money, like dollars.
  • Filtering: checking input and removing or blocking dangerous characters.
  • GET request: an HTTP method used to ask for a page or data; parameters are in the URL.
  • Google Authenticator: an app that generates time-based one-time codes for 2FA.
  • Google reCAPTCHA: a challenge that tries to tell humans from bots.
  • HTML injection: inserting HTML markup into a page where it is not properly escaped.
  • HttpOnly: a cookie setting that stops JavaScript from reading the cookie.
  • IDOR (Insecure Direct Object Reference): using a number or identifier in a request to access a record you are not allowed to see.
  • Improper access control: a missing or wrong check that lets someone do something they should not.
  • Intercepting: pausing and inspecting requests between your browser and the server with a proxy tool.
  • JavaScript: the programming language that runs in your browser.
  • Listener (sniffer): a server you control that waits for connections from a payload.
  • Local storage: a place in your browser where a site can save data.
  • Output encoding: converting characters like < into safe representations so they are displayed as text.
  • Phishing: a fake site that looks like the real one and steals your credentials.
  • POST request: an HTTP method used to send data to a server, typically when submitting a form.
  • Privileges: the permissions an account has.
  • Referrer: the person who invited a user, often through a referral link.
  • Reflected XSS: XSS where the script is immediately returned in the response, not stored.
  • Self XSS: XSS that only affects the person who enters the payload.
  • Server-side validation: the server checks the data it receives, not just the browser.
  • Session: the logged-in state of a user.
  • Social engineering: manipulating people into doing something, like clicking a link.
  • Source code: the HTML, JavaScript and other code that makes up a page.
  • Stored XSS: XSS where the malicious script is saved on the server and later served to other users.
  • Subdomains: prefixes like www or api before the main domain.
  • Substituting cookies: taking a cookie from one session and using it in another to impersonate a user.
  • Unicode characters: characters from different alphabets that look similar to Latin letters.
  • VPN (virtual private network): routes your traffic through another location.
  • whois: a public lookup service that shows who registered a domain.
  • XSS (Cross-Site Scripting): letting someone else's JavaScript run in a user's browser.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.