Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 908998 - app-text/dictd-1.13.0-r5 buffer overflow and broken authentication, patch attached
Summary: app-text/dictd-1.13.0-r5 buffer overflow and broken authentication, patch att...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL: https://bugs.debian.org/cgi-bin/bugre...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2023-06-22 15:28 UTC by Petre Rodan
Modified: 2023-06-24 03:35 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
proposed patch (uint32_t_typedef.patch,404 bytes, patch)
2023-06-22 15:28 UTC, Petre Rodan
Details | Diff
emerge info (emerge.info,6.02 KB, text/plain)
2023-06-22 15:30 UTC, Petre Rodan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petre Rodan 2023-06-22 15:28:55 UTC
Created attachment 864415 [details, diff]
proposed patch

/usr/sbin/dictd --locale en_GB.UTF-8 --debug nodetach --debug auth
:I: 3205 starting dictd 1.13.1/rf on Linux 6.1.32-k08 Thu Jun 22 18:11:05 2023
:I: using locale "en_GB.UTF-8"
:I: dict_aero           26536       595673       463624      1399087
:I: vera                25620       776649       226491       670523
:I: wn                 147311      3074162      9469482     30958162
Match * with localhost/127.0.0.1
:C: "dict 1.13.1/rf on Linux 6.1.32-k08"
Got eb0dbc9140d01fe16ccc3c5c79ad3d99 expected d331022e8209eda9cabe39a7c28d3da9
:A: guest@localhost/127.0.0.1 denied: hash mismatch
*** stack smashing detected ***: terminated

how to reproduce:
1. # emerge -pv dictd
[ebuild   R    ] app-text/dictd-1.13.1::gentoo  USE="-dbi -judy -minimal -test" 0 KiB

2. add the following line to the end of /etc/dict/dictd.conf, and a few dictionaries:
user guest guest

3. add the following file to client:
 ~ $ cat ~/.dictrc
server 127.0.0.1 { port 2628 user guest guest }

4. start daemon in debug mode as above, get error when trying to query the server:
 ./dict abac
dict: Authentication to 127.0.0.1.2628 denied
dict (client_read_status): Error reading from socket
client_read_status: Connection reset by peer


the attached patch fixes both the buffer overflow and the auth failure.
tested on dictd-1.13.1.
debian also uses a similar patch, see 
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=611203

contrary to discussion on the debian tracker, this auth failure also happens if both client and server are amd64.

tried to contact upstream, but gave up. sf.net tracker is out-of-bounds to mere mortals, mailing list is behind a mail server that does not recognize the destination address, author email address not found in sources.

after patch:

/usr/sbin/dictd --locale en_GB.UTF-8 --debug nodetach --debug auth
:I: 10376 starting dictd 1.13.1/rf on Linux 6.1.32-k08 Thu Jun 22 18:19:21 2023
:I: using locale "en_GB.UTF-8"
:I: dict_aero           26536       595673       463624      1399087
:I: vera                25620       776649       226491       670523
:I: wn                 147311      3074162      9469482     30958162
Match * with localhost/127.0.0.1
:C: "dict 1.13.1/rf on Linux 6.1.32-k08"
Got 6c20f756d4fa1087f6ff70aff87309f0 expected 6c20f756d4fa1087f6ff70aff87309f0
Match * with localhost/127.0.0.1
:D: * "abac" 1
:I: quit: d/m/c = 1/0/42; 0.000r 0.000u 0.000s

much success.
Comment 1 Petre Rodan 2023-06-22 15:30:19 UTC
Created attachment 864416 [details]
emerge info
Comment 2 Larry the Git Cow gentoo-dev 2023-06-24 03:35:26 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f45e8d10b4724c111fdb61446be1b4595dff99ab

commit f45e8d10b4724c111fdb61446be1b4595dff99ab
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-06-24 03:34:49 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-24 03:34:49 +0000

    app-text/dictd: fix stack smashing from silly typedef
    
    Closes: https://bugs.gentoo.org/908998
    Signed-off-by: Sam James <sam@gentoo.org>

 app-text/dictd/dictd-1.13.0-r6.ebuild              | 130 +++++++++++++++++++++
 .../dictd/files/dictd-1.13.0-stack-smashing.patch  |  18 +++
 2 files changed, 148 insertions(+)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-24 03:35:49 UTC
Thanks!