Kava-Labs / kava

DeFi for Crypto.
Apache License 2.0
440 stars 351 forks source link

Security Report: Subdomain Takeover of https://temp-send.kava.io/ Pointing to Netlify #1068

Closed aparcekarl closed 1 year ago

aparcekarl commented 2 years ago

Hi Kava Security Team,

I just want to reach out to you. I'm trying to submit this report weather your interested on it.

Thanks for taking a look.

Recently, i just found some of your subdomain (*kava.io) pointing to vulnerable Third Party site "Netlify"

This issue is about your subdomain being misconfigured in Netlify https://temp-send.kava.io/

I've temporarily taken over the subdomain and added it to my Netlify account and added a simple text for PoC

Everytime you navigate to the subdomain, you will be pointed to the website that I now already owned.

This vulnerability can reflect to an email leak from your company, due to the situation that the attacker can receive email transactions from the company and clients.

Please refer to this report for further information; https://hackerone.com/reports/388622 https://hackerone.com/reports/325336

Impact

I was able to hijack the domain temp-send.kava.io because an outdated DNS entry pointed to Netlify. I created a resource in that web hosting and was able to host my own content accessible via your domain. HTML files located on this domain are able to use JavaScript to access globally-scoped non-HTTPOnly cookies. For example, a cookie used to authenticate against topsecret.kava.io is scoped to *kava.io, so a page on my hijacked domain can steal it.

This vulnerability is rated as severe due to the increased impact that can be escalated to a high severity threat and boils down to the registration of a domain by somebody else (with bad intentions) in order to gain control over one or more (sub)domains. This presents an interesting attack vector, which can even lead to several high severity risks, like this authentication bypass explained in a bug bounty report https://hackerone.com/reports/172137 by @ArneSwinnen.

The attacker can use this method to steal cookies by hosting malicious javascript/spread malware/steal money by setting up the sale/setup fake dapp application to steal private keys/ steal login details of users/spear-phishing/authentication bypass and other bad stuff.

Risk Breakdown

Risk: Severe Difficulty to Exploit: Easy Complexity: Easy Weakness Categories: Deployment Misconfiguration/Stored XSS/Authentication Bypass (CWE: 16) CVSS2 Score: 9.3 (AV:N/AC:M/Au:S/C:C/I:C/A:N) Reference: https://0xpatrik.com/subdomain-takeover/

Remediations

  1. Check your DNS-configuration for subdomains pointing to services, not in use
  2. Set up your external service so it fully listens to your wildcard DNS.
  3. Our advice is to keep your DNS entries constantly vetted and restricted.
  4. Preventing subdomain takeovers is a matter of order of operations in lifecycle management for virtual hosts and DNS. Depending on the size of the organization, this may require communication and coordination across multiple departments, which can only increase the likelihood for a vulnerable misconfiguration.
  5. Create an inventory of all of your organization’s domains and their hosting providers, and update it as things change, to ensure that nothing is left dangling.

Thank you

nddeluca commented 2 years ago

Thank you @aparcekarl, we removed the DNS for the subdomain. Please email security@kava.io so we can offer you a bug bounty.

Also, was this as easy as adding a custom domain at temp-send.kava.io in netlify after creating an app? Or was there another way to register the subdomain on netlify?

I attempted to test this myself with another subdomain, and I was not able get past the custom_domain is owned by another account error.

aparcekarl commented 2 years ago

Thank you so much for the great response. I can confirm the fix was implemented.

Regarding the way of reproduction. Yes, it is easy by simply adding a custom domain in domains management

You don’t have the ability to add this to your account since I already own kava.io. Netlify implements whitelist upon adding subdomain. So no one can claim subdomains under kava.io

These was also part of the vulnerable subdomains and are now fixed.

temp-preview.kava.io app.testnet-12000.kava.io app.testnet-12000.hard.kava.io app.mmm.kava.io

Thank you

nddeluca commented 2 years ago

Thank you for confirming! And interesting, we currently host app.kava.io, and docs.kava.io on netlify as well (since July 2020), so it surprises me that you where successful in claiming the domain. I can see the domain is still registered with our account, and I'm also able to add new kava subdomains to apps in our account. It seems like there is a bug with netlify's validation?

aparcekarl commented 2 years ago

This is vulnerable in an edge case scenario. That is why removing a dangling DNS record is very important to monitor. BTW I already sent an email to security@kava.io

aparcekarl commented 2 years ago

Just want to update that I added a new report via security@kava.io and it's already fixed. No response yet from that channel.