Skip to content

Fix inefficient regular expression in the schema tokenizer #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ The following undocumented functions are deprecated and scheduled for removal:
- ``ldap.cidict.strlist_minus``
- ``ldap.cidict.strlist_union``

Security fixes:
* Fix inefficient regular expression which allows denial-of-service attacks
when parsing specially-crafted LDAP schema.
(GHSL-2021-117)

Changes:
* On MacOS, remove option to make LDAP connections from a file descriptor
when built with the system libldap (which lacks the underlying function,
Expand Down
2 changes: 1 addition & 1 deletion Lib/ldap/schema/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
r"|" # or
r"([^'$()\s]+)" # string of length >= 1 without '$() or whitespace
r"|" # or
r"('(?:[^'\\]|\\\\|\\.)*?'(?!\w))"
r"('(?:[^'\\]|\\.)*'(?!\w))"
# any string or empty string surrounded by unescaped
# single quotes except if right quote is succeeded by
# alphanumeric char
Expand Down