Missing null termination in PROTOCOL_BINARY_CMD_SASL_LIST_MECHS response handling
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libmemcached (Debian) |
New
|
Unknown
|
|||
libmemcached (Ubuntu) |
Fix Released
|
Medium
|
Ioanna Alifieraki | ||
Trusty |
Won't Fix
|
Medium
|
Ioanna Alifieraki | ||
Xenial |
Fix Released
|
Medium
|
Ioanna Alifieraki | ||
Bionic |
Fix Released
|
Medium
|
Ioanna Alifieraki | ||
Cosmic |
Fix Released
|
Medium
|
Ioanna Alifieraki | ||
Disco |
Fix Released
|
Medium
|
Ioanna Alifieraki |
Bug Description
[Impact]
When connecting to a server using SASL, memcached_
The buffer then gets passed to sasl_client_start [3] which treats it as a null-terminated string [4], reading uninitialised bytes in the buffer.
As the buffer lives on the stack, an attacker that can put strings on the stack before the connection gets made, might be able to tamper with the authentication.
[1] libmemcached/
[2] libmemcached/
[1] libmemcached/
[3] http://
[Test Case]
This bug is difficult to reproduce since it depends on the contents of the stack.
However, here is a test case using the fix on Bionic that shows that this fix does not cause any problems.
For testing you need
1) A memcached server.
You can setup one by following the instructions in [1],
or (what I did) create one in the cloud [2].
2) A client test program to connect to the memcached server.
One can be found in [3].
This simple test connects to a memcache server and test basic get/set operations.
Copy paste the C code into a file (sals_test.c) and compile with :
gcc -o sasl_test -O2 sasl_test.c -lmemcached -pthread
3) On a machine with the updated version of libmemcached in which the fix is applied :
jo@bionic-vm:~$ dpkg -l | grep libmemcached
ii libhashkit-
ii libhashkit2:amd64 1.0.18-
ii libmemcached-
ii libmemcached-
ii libmemcached-tools 1.0.18-
ii libmemcached11:
ii libmemcacheduti
Run the sals_test binary :
#./sasl_test [username] [password] [server]
In my case using the credentials and the server created in step 1 :
jo@bionic-vm:~$ ./sasl_test 88BAB0 1A99094B77C8935
Get/Set success!
[1] https:/
[2] https:/
[3] https:/
[Regression Potential]
This fix initialises the buffer to 0.
Any potential regression may include failure of the authentication when using SASL.
* When running autopkgtest for xenial/armhf it fails on gearmand : http://
However this is a long standing issue with gearmand and it is not related with the current SRU.
[Other Info]
This bug affects trusty and later.
* rmadison:
libmemcached | 1.0.8-1ubuntu2 | trusty | source
libmemcached | 1.0.18-4.1 | xenial | source
libmemcached | 1.0.18-4.2 | bionic | source
libmemcached | 1.0.18-4.2 | cosmic | source
libmemcached | 1.0.18-4.2 | disco | source
* Debian bug:
https:/
* Upstream seems pretty quiet since 2014
Unfortunately, because the project seems more or less dead ... it seems like we won't be able submit anything upstream and go straight to fixing Debian and Ubuntu.
- Repo:
bzr branch lp:libmemcached
- Last commit:
revno: 1113 [merge]
committer: Continuous Integration <email address hidden>
branch nick: workspace
timestamp: Sun 2014-02-16 03:31:37 -0800
message:
Merge bzr://soup.haus/ Build: jenkins-
Related branches
- Brian Aker: Approve
- Diff: 0 lines
- git-ubuntu bot: Approve
- Lucas Kanashiro (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 95 lines (+55/-1)4 files modifieddebian/changelog (+35/-0)
debian/control (+2/-1)
debian/patches/fixing_missing_null_termination.patch (+17/-0)
debian/patches/series (+1/-0)
Changed in libmemcached (Ubuntu): | |
status: | Confirmed → In Progress |
Changed in libmemcached (Ubuntu): | |
assignee: | nobody → Ioanna Alifieraki (joalif) |
Changed in libmemcached (Ubuntu Cosmic): | |
assignee: | nobody → Ioanna Alifieraki (joalif) |
Changed in libmemcached (Ubuntu Bionic): | |
assignee: | nobody → Ioanna Alifieraki (joalif) |
Changed in libmemcached (Ubuntu Xenial): | |
assignee: | nobody → Ioanna Alifieraki (joalif) |
Changed in libmemcached (Ubuntu Trusty): | |
assignee: | nobody → Ioanna Alifieraki (joalif) |
Changed in libmemcached (Ubuntu Cosmic): | |
status: | New → In Progress |
Changed in libmemcached (Ubuntu Bionic): | |
status: | New → In Progress |
Changed in libmemcached (Ubuntu Xenial): | |
status: | New → In Progress |
Changed in libmemcached (Ubuntu Trusty): | |
status: | New → In Progress |
importance: | Undecided → Medium |
Changed in libmemcached (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in libmemcached (Ubuntu Bionic): | |
importance: | Undecided → Medium |
Changed in libmemcached (Ubuntu Cosmic): | |
importance: | Undecided → Medium |
Changed in libmemcached (Ubuntu Disco): | |
importance: | Undecided → Medium |
description: | updated |
tags: |
added: sts-sponsor-slashd removed: sts-sponsor-ddstreet |
description: | updated |
Changed in libmemcached (Debian): | |
status: | Unknown → New |
description: | updated |
affects: | libmemcached → ubuntu-translations |
no longer affects: | ubuntu-translations |
description: | updated |
Changed in libmemcached (Ubuntu Trusty): | |
status: | Fix Committed → Invalid |
Changed in libmemcached (Ubuntu Trusty): | |
status: | Invalid → Won't Fix |
tags: |
added: verification-done removed: verification-needed |
tags: | removed: sts-sponsor-slashd |
Reporting here as it might be security relevant and the upstream is dead