Skip to content

Usernames and session ids are concatenated into SQL and LDAP filters #442

Open

Description

@caseysoftware

Several authentication queries build SQL by hand:

  • classes/w2p/Authenticators/SQL.class.php L20, L29
  • classes/w2p/Authenticators/LDAP.class.php L105 (userId()); L59 puts the username into the LDAP filter without ldap_escape()
  • classes/w2p/Core/CAppUI.class.php L845
  • classes/w2p/System/Session.class.php L33, L64, L70, L99, L107 (session id)

Today this is held back by the username filter in CAppUI::login() (L790, everything but A-Za-z0-9._@- stripped) and by PHP's own check of session id characters. Usernames from identity providers (Phase 1 onwards) can contain ', + and non-ASCII characters, and won't pass through that filter.

Fix: use $q->quote() for every username and session id, and ldap_escape($username, '', LDAP_ESCAPE_FILTER) in the LDAP filter.

Blocks #458.

Fix before Phase 0 of the Identity Layer proposal (#435).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions