Lucene search

K
hackeroneRtodH1:1193321
HistoryMay 12, 2021 - 11:09 a.m.

Nextcloud: Scoped apptokens can be changed by that very apptoken

2021-05-1211:09:51
rtod
hackerone.com
$1000
12

8.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

7.5 High

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:N/C:P/I:P/A:P

0.002 Low

EPSS

Percentile

60.7%

I noticed that there is the possibility to limit apptokens to not be able to access the filesystem.

  1. Create a new apptoken in https://server/settings/user/security
  2. Click the … of your new apptoken and make it not allowed to access the filesystem
  3. Log out
  4. Navigate to https://server/remote.php/dav and login with your username + apptoken
  5. Navigate again to https://server/settings/user/security
  6. You won’t be able to access the apptoken data
  7. Obtain the CSRF token
  8. Send a PUT request to https://server/settings/personal/authtokens/ID chaging the scope

Now the ID you do not know. However even on a decent sized system it is not hard to iterate this as there is no rate limiting or throttling at all.
And voila. You have filesystem access.

You could also remove other apptokens of the same user (if you’d want).

Impact

Leaked scoped tokens could be used to gain full access to all your data. Defeating the whole purpose of scoped tokens.

I recommend.

  1. Only allow tokens that result from a real login (so user+pass+2fa) to modify/delete tokens
  2. Do not allow the current token in use to edit itself

8.8 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

7.5 High

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:N/C:P/I:P/A:P

0.002 Low

EPSS

Percentile

60.7%