Bug 1316328 - search returns no entry when OR filter component contains non readable attribute
Summary: search returns no entry when OR filter component contains non readable attri...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: 389-ds-base
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-10 01:02 UTC by Noriko Hosoi
Modified: 2016-11-03 20:40 UTC (History)
4 users (show)

Fixed In Version: 389-ds-base-1.3.5.5-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 20:40:15 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2594 normal SHIPPED_LIVE Moderate: 389-ds-base security, bug fix, and enhancement update 2016-11-03 12:11:08 UTC

Description Noriko Hosoi 2016-03-10 01:02:14 UTC
Problem description
	access control requires that a user has read access to all attributes in OR filter components. 
	Else no entry is returned, even if the filter matches some entries.
	This is to prevent guessing of attribute values using OR filter.
	The problem is that this requirement prevents to use non readable attribute in filter.
	If we make sure that component, with non readable attributes, do not match the selected entry. 
	then guessing would be prevented and it will allow non readable attributes in the filter.

For example, 'user' has read access on 'cn' but no read access over 'telephonenumber' attribute

dn: cn=foo,dc=example,dc=com
objectClass: top
objectClass: person
sn: foo
cn: foo
telephoneNumber: 123

Without this access control guessing could be done this way

ldapsearch -D "cn=user,dc=example,dc=com" -w xxx -b "dc=example, dc=com" "(cn=foo)" dn cn
dn: cn=foo,dc=example,dc=com
cn: foo
ldapsearch -D "cn=user,dc=example,dc=com" -w xxx -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=0*)(cn=bar))" dn
<no entry>
ldapsearch -D "cn=user,dc=example,dc=com" -w xxx -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=1*)(cn=bar))" dn
dn: cn=foo,dc=example,dc=com
ldapsearch -D "cn=user,dc=example,dc=com" -w xxx -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=10*)(cn=bar))" dn
<no entry>
ldapsearch -D "cn=user,dc=example,dc=com" -w xxx -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=11*)(cn=bar))" dn
<no entry>
ldapsearch -D "cn=user,dc=example,dc=com" -w xxx -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=12*)(cn=bar))" dn
dn: cn=foo,dc=example,dc=com
...

With the current access control, last 5 searches return <no entry> (preventing guessing)
But also
ldapsearch -D "cn=user,dc=example,dc=com" -w xxx -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=*)(cn=foo))" dn
<no entry>

Now if access control allows non readable attribute ('telephonenumber') but systematically reject matching with it
the last 5 searches also return <no entry>
But the following searches would be successfull
ldapsearch -D "cn=user,dc=example,dc=com" -w xxx -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=*)(cn=foo))" dn telephonenumber cn
dn: cn=foo,dc=example,dc=com
cn: foo

Comment 5 Kamlesh 2016-08-23 07:28:11 UTC
Thanks Ludwig, for clearing my doubt.
I verified this bug;

Step perform 

[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "dc=example, dc=com" "(cn=foo)" dn cn

# foo, example.com
dn: cn=foo,dc=example,dc=com
cn: foo
-----------------------

[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=0*)(cn=bar))" dn
No Result
----------------------
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=1*)(cn=bar))" dn

# foo, example.com
dn: cn=foo,dc=example,dc=com

----------------------

[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=10*)(cn=bar))" dn
No Result
---------------------
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=11*)(cn=bar))" dn

No Result

--------------------
ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=12*)(cn=bar))" dn
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=12*)(cn=bar))" dn

# foo, example.com
dn: cn=foo,dc=example,dc=com
--------------------

dn: dc=example,dc=com
changetype: modify
replace: aci
aci: (targetattr = "cn")(version 3.0;acl "cn allow";allow (read)(userdn = "ldap:///cn=user,dc=example,dc=com");)
-
aci: (targetattr = "telephoneNumber")(version 3.0;acl "deny Read and seach";deny (read)(userdn = "ldap:///cn=user,dc=example,dc=com");)

--------
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "dc=example, dc=com" "(cn=foo)" dn cn
No Result
----------------------
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=0*)(cn=bar))" dn
No Result
----------------------
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=1*)(cn=bar))" dn
No Result
-----------------
ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=10*)(cn=bar))" dn 
No Result
---------------
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=12*)(cn=bar))" dn
No Result
--------------
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=*)(cn=foo))" dn
No Result
-------------
[root@test ~]# ldapsearch -D "cn=user,dc=example,dc=com" -w test1234 -b "cn=foo,dc=example, dc=com" "(|(telephonenumber=*)(cn=foo))" dn telephonenumber cn
No Result

Comment 7 errata-xmlrpc 2016-11-03 20:40:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2594.html


Note You need to log in before you can comment on or make changes to this bug.