Skip to content

Commit 4ed05da

Browse files
committed
handle_suspend: Only allow STOP, TSTP, CONT, TTIN, TTOU signals
Found by the ZeroPath AI Security Engineer <https://zeropath.com>
1 parent c3975e5 commit 4ed05da

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

logsrvd/logsrvd.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,11 +794,20 @@ handle_suspend(const CommandSuspend *msg, const uint8_t *buf, size_t len,
794794
}
795795

796796
/* Check that message is valid. */
797-
if (msg == NULL || msg->delay == NULL || msg->signal[0] == '\0') {
797+
if (msg == NULL || msg->delay == NULL) {
798+
sudo_warnx(U_("%s: %s"), source, U_("invalid CommandSuspend"));
799+
closure->errstr = _("invalid CommandSuspend");
800+
debug_return_bool(false);
801+
}
802+
if (strcmp(msg->signal, "STOP") != 0 && strcmp(msg->signal, "TSTP") != 0 &&
803+
strcmp(msg->signal, "CONT") != 0 &&
804+
strcmp(msg->signal, "TTIN") != 0 &&
805+
strcmp(msg->signal, "TTOU") != 0) {
798806
sudo_warnx(U_("%s: %s"), source, U_("invalid CommandSuspend"));
799807
closure->errstr = _("invalid CommandSuspend");
800808
debug_return_bool(false);
801809
}
810+
802811
sudo_debug_printf(SUDO_DEBUG_INFO, "%s: received CommandSuspend from %s",
803812
source, __func__);
804813

0 commit comments

Comments
 (0)