Bug 39939 - Self Service allows scanning for usernames
Self Service allows scanning for usernames
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Self Service
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.1-0-errata
Assigned To: Florian Best
Daniel Tröder
:
Depends on:
Blocks: 37890
  Show dependency treegraph
 
Reported: 2015-11-13 14:49 CET by Sönke Schwardt-Krummrich
Modified: 2021-06-23 07:29 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Security Issue
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Security
Max CVSS v3 score:


Attachments
Change reply to the same as with bad password. (1.70 KB, patch)
2015-11-25 10:43 CET, Daniel Tröder
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2015-11-13 14:49:49 CET
If a unknown username has been entered during password reset, the following message is returned: "Unbekannter Benutzer 'user5'"

With this message, it is possible to scan for all valid usernames within the UCS domain. It would be better, if the backend returns the same error message as if no contact information have been deposited.
Comment 1 Daniel Tröder univentionstaff 2015-11-25 10:43:51 CET
Created attachment 7317 [details]
Change reply to the same as with bad password.
Comment 2 Daniel Tröder univentionstaff 2015-11-25 10:49:55 CET
Forget that patch - it doesn't solve the problem.
Comment 3 Daniel Tröder univentionstaff 2015-11-25 11:15:09 CET
Fixed with commit 65892 (incl YAML).

If an unknown username is provided, the error message is now the same as for users that have not (yet) registered a contact.
Comment 4 Daniel Tröder univentionstaff 2015-11-25 11:47:27 CET
The the last commit only get_reset_methods() was protected against scanning for usernames, but the other functions could be used in the same way. Commit 65893 changes that.
Comment 5 Florian Best univentionstaff 2015-12-04 16:02:12 CET
Still possible in various ways:

> curl 'http://10.200.27.30/univention-self-service/passwordreset/send_token' -H 'Accept-Language: en-US' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary '{"username":"anton2","method":"foobar"}'  
{"message": "Unknown recovery method 'foobar'."}
→ user/mail address exists

> curl 'http://10.200.27.30/univention-self-service/passwordreset/send_token' -H 'Accept-Language: en-US' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary '{"username":"anton","method":"foobar"}'  
{"message": "No contact information to send a token for password recovery to has been found."}

→ user/mail address doesn't exists.


get_reset_methods() is still vulnerable because you can expect a specific response for existing users. Requiring the password here would solve this.

If you are able (due to a race condition and multiple module processes) to have mutliple tokens in the database you can also use set_password() to guess usernames.

It's possible also to guess usernames because they are blacklisted. Every "Domain Administrator" username can therefore be gained.

If the ldap server is down some exceptions are also providing information because you know in which lines LDAP operations are done (and not done if the user is okay).

The implementation is also a little bit error prone to future adaptions because the string literals are copied.

I took the bug and corrected all those points in svn r66116.
Switching QA therefore.
Comment 6 Daniel Tröder univentionstaff 2015-12-09 08:31:23 CET
Code: OK: each method raises only one type of Exception (before user is authenticated) with each only one textual response
Tests: OK

* Ran for each USERNAME in {existing_user_without_contact, not_a_user, "", "@", "Administrator"}:
curl -H "Content-Type: application/json" -H "Accept-Language: en_EN" -X POST -d '{"username": $USERNAME}' http://10.200.3.35/univention-self-service/passwordreset/get_reset_methods
And the result was always the same: {"message": "No contact information is stored for this user. Resetting the password is not possible."}

get_reset_methods() is still "vulnerable" in that existing users with stored contacts can be found - but that is by design (and is at least a little dampened by the request rate limiting).

* The reply for all requests, if the LDAP server is down, is in all cases the same: {"message": "Cannot connect to the LDAP service.\nThe following steps can help...}.
Comment 7 Janek Walkenhorst univentionstaff 2015-12-09 16:48:29 CET
<http://errata.software-univention.de/ucs/4.1/24.html>