Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1179745

Summary: Improve deal with embedded NULLs better, and use the text versions of attribute values in rlm_ldap.
Product: Red Hat Enterprise Linux 7 Reporter: David Spurek <dspurek>
Component: freeradiusAssignee: Nikolai Kondrashov <nikolai.kondrashov>
Status: CLOSED ERRATA QA Contact: Jaroslav Aster <jaster>
Severity: low Docs Contact:
Priority: low    
Version: 7.1CC: dpal, jaster, nikolai.kondrashov, pkis
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 20:36:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Captured packages for 3.0.4 null test.
none
Captured packages for 3.0.13 null test. none

Description David Spurek 2015-01-07 13:06:53 UTC
Description of problem:
Improve deal with embedded NULLs better,  and use the text versions of attribute values in rlm_ldap.



Version-Release number of selected component (if applicable):
freeradius-3.0.4-6.el7

How reproducible:


Steps to Reproduce:
1.setup radiusd with rlm_ldap
2. # allow reply message from ldap
sed -i '/update {/,/}/ s/^#\([[:space:]]*reply:Reply-Message\)/\1/' /etc/raddb/mods-available/ldap

3.Store following entry to ldap
dn: uid=nulltestuser6,dc=example,dc=com
cn: nulltestuser6
objectClass: top
objectClass: radiusObjectProfile
objectClass: radiusprofile
uid: nulltestuser6
userPassword: {SSHA}op2zlZmLW5uX3549vmuemfMOTUQ6IHIy
radiusReplyMessage:: cmVwbHkgd2l0aCBhAGI=

#nulltestuser6 - radiusReplyMessage:: cmVwbHkgd2l0aCBhAGI= (base64 encoded 'reply with a\0b'), e.g. printf 'reply with a\0b' | base64

4. radtest nulltestuser6 redhat localhost 0 testing123
5. Check reply-message

Actual results:
Sending Access-Request Id 62 from 0.0.0.0:50840 to 127.0.0.1:1812
	User-Name = 'nulltestuser6'
	User-Password = 'redhat'
	NAS-IP-Address = 10.34.59.91
	NAS-Port = 0
	Message-Authenticator = 0x00
Received Access-Accept Id 62 from 127.0.0.1:1812 to 127.0.0.1:50840 length 34
	Reply-Message = 'reply with a'

Expected results:
Sending Access-Request Id 62 from 0.0.0.0:50840 to 127.0.0.1:1812
	User-Name = 'nulltestuser6'
	User-Password = 'redhat'
	NAS-IP-Address = 10.34.59.91
	NAS-Port = 0
	Message-Authenticator = 0x00
Received Access-Accept Id 62 from 127.0.0.1:1812 to 127.0.0.1:50840 length 34
	Reply-Message = 'reply with a\\0b'

Additional info:

Comment 7 Jaroslav Aster 2017-03-22 13:54:47 UTC
Hi Nikolai,

this bug does not seem to be fix in re-base package freeradius-3.0.13-1.el7.

Comment 8 Nikolai Kondrashov 2017-03-23 09:26:59 UTC
Hi Jaroslav! Thank you for testing this. There was a discussion with upstream regarding this earlier:

http://lists.freeradius.org/pipermail/freeradius-users/2014-December/074962.html
http://lists.freeradius.org/pipermail/freeradius-users/2015-January/075215.html

However, it is still not clear to me whether this should or shouldn't work, so I asked upstream for clarification:

http://lists.freeradius.org/pipermail/freeradius-users/2017-March/087004.html

Comment 9 Nikolai Kondrashov 2017-03-24 09:17:15 UTC
The response from upstream was that zero (or NULL) characters are not expected to be handled in LDAP attribute values. Instead, if you want to have zero character in e.g. your Reply-Message, you should have it escaped in the LDAP attribute. I.e. have it set to "reply with a\0b".

Jaroslav, could you please check if that works? Thank you.

Comment 10 Jaroslav Aster 2017-03-28 12:48:27 UTC
Hi Nikolai,

I realized, my test was wrong, not freeradius. Test checked bad value in the test. Freeradius returns "reply with a\000b" and test checks "reply with a\0b", but it is the same.

# echo -en "reply with a\000b" | base64
cmVwbHkgd2l0aCBhAGI=

#printf "reply with a\000b" | base64
cmVwbHkgd2l0aCBhAGI=

#printf "reply with a\0b" | base64
cmVwbHkgd2l0aCBhAGI=

Comment 11 Nikolai Kondrashov 2017-03-28 13:29:48 UTC
I see. Could you check that if LDAP attribute contains exactly "reply with a\0b", then the FreeRADIUS response contains the zero character?

Comment 12 Jaroslav Aster 2017-03-29 08:59:40 UTC
LDAP atributes contains this 'cmVwbHkgd2l0aCBhAGI=', which is output of the command printf 'reply with a\0b' | base 64. Freeradius returns 'reply with a\000b', which is the same.

Wireshark shows the same. In 3.0.13, last 3 bytes are 61 00 62. In 3.0.4, last byte is 61, rest is truncated. So you can see zero byte in new version. Pcap files are attached.

Based on that, it seems to be fixed in new version.

Comment 13 Jaroslav Aster 2017-03-29 09:01:29 UTC
Created attachment 1267262 [details]
Captured packages for 3.0.4 null test.

Comment 14 Jaroslav Aster 2017-03-29 09:01:57 UTC
Created attachment 1267263 [details]
Captured packages for 3.0.13 null test.

Comment 15 Nikolai Kondrashov 2017-03-29 10:41:05 UTC
Great! Thanks for testing, Jaroslav.

Comment 17 errata-xmlrpc 2017-08-01 20:36:03 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://access.redhat.com/errata/RHEA-2017:1954