Re: 答复: [chrony-users] about CVE-2020-14367 |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-users Archives
]
- To: chrony-users@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: 答复: [chrony-users] about CVE-2020-14367
- From: Miroslav Lichvar <mlichvar@xxxxxxxxxx>
- Date: Mon, 6 Jun 2022 15:03:03 +0200
- Authentication-results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mlichvar@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654520585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3b8EdJsIAnDvfYpuUm4NOSPtQ2JE0qlmIb0fvcudN3c=; b=e3PCbLG2OAQqVxmtZZEWi2Ay7HZxJUC9Dp1GSZQR2KWexdJGMij4XFELbfdV4yHvkF+EoR IWzztZYeMGmChyq7hmRK+KitEdwwOwEujr9MvGw/vVXKB39rhzc7DQudhISfER3iSmNN2f K01sG/QJ8qmxBGG7oXYQsMTfGqL3POU=
On Mon, Jun 06, 2022 at 11:18:58AM +0000, chengyechun wrote:
> I understand that modifying the chronyd.pid file requires the root permission, whereas in CVE-2020-14367, only creating smylinks does not require a higher permission.
The pidfile is in a directory where the chrony user has write
permissions. If the pidfile is owned by root, the chrony user cannot
modify it directly, but it can replace it with a new file or symlink.
If the chrony user is compromised, it's game over for chronyd. Denial
of service cannot be prevented.
CVE-2020-14367 was about chronyd following a symlink when writing
the pidfile, before it dropped root privileges. It allowed the chrony
user to write a PID to a file where it didn't have permissions to
write, assuming the directory containing the pidfile already existed
and the service wasn't started yet (e.g. when the service was being
restarted).
> int check_run(char *proname)
> {
> FILE *fp = NULL;
> char command[150];
> char buf[300];
> int count = 3;
>
> snprintf(command, sizeof(command), "ps -ef | grep -w %s | wc -l ", proname);
>
> fp=popen(command, "r");
Calling ps might be portable, but probably wouldn't be acceptable here
as a good solution.
This would not detect chronyd running under a different name. It would
be susceptible to DoS attacks as it does not check the process owner
(any user could fail the check by running something called chronyd).
Expecting 3 matched lines from grep would be unreliable as ps might
not see the newly started grep process yet.
--
Miroslav Lichvar
--
To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx
with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.