Skip to content
Account takeover Disclosed report Intermediate

Targeted phishing attacks in Login flow v2

The login flow v2 for the Nextcloud desktop client lacks a warning that the user is granting access to an attacker. An attacker who knows the victim's username and email can send a crafted login URL, and if the victim logs in, the attacker obtains an access token to all their data.

rtod Follow

Originally disclosed on HackerOne

Medium 6.8 View original
  • Triaged in 18 hours
  • Disclosed after 22 months

The login flow v2 is used by the desktop client.

The attack vector assumes the attacker knows the recipient somehow and knows their username and email (or other way to contact them).

In short it is following the steps from https://docs.nextcloud.com/server/21/developer_manual/client_apis/LoginFlow/index.html#login-flow-v2 (examples are also taken from there)

  1. Attacker send a request to: curl -X POST https://cloud.example.com/index.php/login/v2 They can even set the user agent to something that the user will trust. Like 'Company X verification', 'or just dekstop client' or whatever.

  2. Attacker obtains the response like

{ "poll":{ "token":"mQUYQdffOSAMJYtm8pVpkOsVqXt5hglnuSpO5EMbgJMNEPFGaiDe8OUjvrJ2WcYcBSLgqynu9jaPFvZHMl83ybMvp6aDIDARjTFIBpRWod6p32fL9LIpIStvc6k8Wrs1", "endpoint":"https://cloud.example.com/login/v2/poll" }, "login":"https://cloud.example.com/login/v2/flow/guyjGtcKPTKCi4epIRIupIexgJ8wNInMFSfHabACRPZUkmEaWZSM54bFkFuzWksbps7jmTFQjeskLpyJXyhpHlgK8sZBn9HXLXjohIx5iXgJKdOkkZTYCzUWHlsg3YFg" }

  1. Now the attacker send the login URL to the victim.
  2. The victim logs in, granting the attacker an access token to access all their data.

The login URL seems to only be valid for 10 minutes. However this is still a 10 minute window the user can be attacked. The attacker could even setup a url that when clicked on will perform the steps in the background and then redirecting them. Making sure the token is always valid.

The issue here is that there is no warning for the victim that what they are about to do is potentially giving an attacker access to their data. And they can do all the checks when they are on the auth page but it is actually the legit page of their Nextcloud instance.

I'd suggest to work with some verification.For example. Show a 2 digit code (or as many digits as you are comfortable with) and have that be entered in the desktop client screen. That way the attacker has to time it right and be very lucky. Making the attack a lot less likely. As the victim would also notice 'what do you mean I have to enter a code on my device?'

Impact

Possible granting of access token to the attacker. Resulting in access to all data of a victim.

The original report as published on HackerOne, by rtod. 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 login flow does not include any verification that the user intended to grant access to a specific client, so an attacker can initiate the flow and send the resulting login URL to the victim.

Impact

The attacker could gain an access token granting access to all of the victim's data, though the login URL is only valid for 10 minutes.

What the attacker needed

Attacker knows victim's username and email; victim clicks a link and logs in; login URL valid for 10 minutes

The fix

The login flow should include a verification step, such as showing a short code that the user must enter in the desktop client, to make the attack much less likely.

How it was found

  1. Attacker sends a request to the login flow v2 endpoint.
  2. Attacker obtains a login URL and a poll token from the response.
  3. Attacker sends the login URL to the victim.
  4. Victim logs in, granting the attacker an access token.

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.

This is about a login system where a website gives you a special link to log in. An attacker can create such a link and trick you into clicking it. If you log in through that link, the attacker gets a key to your account without you knowing.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More by rtod

View all

33 more disclosed reports, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.