Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 795321 (CVE-2021-22212) - <net-misc/ntpsec-1.2.1: ntpkeygen insufficent key generation (CVE-2021-22212)
Summary: <net-misc/ntpsec-1.2.1: ntpkeygen insufficent key generation (CVE-2021-22212)
Alias: CVE-2021-22212
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Security
Whiteboard: ?? [glsa? cleanup]
Depends on:
Reported: 2021-06-11 06:36 UTC by Sam James
Modified: 2021-06-23 03:08 UTC (History)
2 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester gentoo-dev Security 2021-06-11 06:36:37 UTC
"Update ntpkeygen/keygone to properly filter # characters. (CVE-2021-22212)"
Comment 1 Larry the Git Cow gentoo-dev 2021-06-11 06:39:16 UTC
The bug has been referenced in the following commit(s):

commit e448a0c3088ea0088b62f9b16debaccbba4d3334
Author:     Sam James <>
AuthorDate: 2021-06-11 06:38:52 +0000
Commit:     Sam James <>
CommitDate: 2021-06-11 06:38:52 +0000

    net-misc/ntpsec: add 1.2.1
    Signed-off-by: Sam James <>

 net-misc/ntpsec/Manifest            |   1 +
 net-misc/ntpsec/ntpsec-1.2.1.ebuild | 169 ++++++++++++++++++++++++++++++++++++
 2 files changed, 170 insertions(+)
Comment 2 Sam James archtester gentoo-dev Security 2021-06-21 19:04:02 UTC
arm64 done
Comment 3 Sam James archtester gentoo-dev Security 2021-06-21 19:04:13 UTC
amd64 done
Comment 4 Sam James archtester gentoo-dev Security 2021-06-22 19:37:57 UTC
arm done

all arches done
Comment 5 John Helmert III gentoo-dev Security 2021-06-22 23:03:06 UTC
Please cleanup
Comment 6 John Helmert III gentoo-dev Security 2021-06-23 03:08:31 UTC

ntpkeygen can generate keys that ntpd fails to parse. NTPsec 1.2.0 allows ntpkeygen to generate keys with '#' characters. ntpd then either pads, shortens the key, or fails to load these keys entirely, depending on the key type and the placement of the '#'. This results in the administrator not being able to use the keys as expected or the keys are shorter than expected and easier to brute-force, possibly resulting in MITM attacks between ntp clients and ntp servers. For short AES128 keys, ntpd generates a warning that it is padding them.