Scoped apptokens can be changed by that very apptoken
An app token that was deliberately restricted from accessing the filesystem could still be used to change its own scope through the token settings endpoint. An attacker holding a leaked, scoped token could widen it to full filesystem access, or delete the user's other tokens.
- Triaged in under an hour
- Fixed in 7 days
- Paid in 7 days
- Disclosed after 2 months
I noticed that there is the possibility to limit apptokens to not be able to access the filesystem.
- Create a new apptoken in
https://server/settings/user/security - Click the .. of your new apptoken and make it not allowed to access the filesystem
- Log out
- Navigate to
https://server/remote.php/davand login with your username + apptoken - Navigate again to
https://server/settings/user/security - You won't be able to access the apptoken data
- Obtain the CSRF token
- Send a PUT request to
https://server/settings/personal/authtokens/IDchaging 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.
- Only allow tokens that result from a real login (so user+pass+2fa) to modify/delete tokens
- Do not allow the current token in use to edit itself
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 token-management endpoint authorised any valid session, including one created from an app token, so a token could modify its own scope.
Impact
A leaked scoped token could be escalated to full access to all the user's data, and other tokens of the same user could be removed; the token ID must be guessed, but the text says there is no rate limiting to stop iteration.
What the attacker needed
A valid app token for the account; token ID guessed by iteration; no rate limiting on the endpoint
The fix
Only tokens created by a real login with password and second factor should be able to modify or delete tokens, and a token should not be able to edit itself.
How it was found
- Create a new app token in the user security settings.
- Edit the token so filesystem access is not allowed.
- Log out.
- Log in to the WebDAV endpoint using the username and the app token.
- Open the security settings again and obtain the CSRF token.
- Send a PUT request to the auth tokens endpoint with the token ID to change its scope.
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.
An app token is a password-like string an app uses to log in on your behalf, and it can be limited so it only does certain things. Here a limited token was still allowed to edit its own limits, so anyone who stole it could remove the limits and reach everything. The report suggests only a full login with password and second factor should be able to change tokens.
What is Access control?
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.