NetBSD Problem Report #58390

From www@netbsd.org  Mon Jul  1 22:53:31 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 77CCE1A923A
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  1 Jul 2024 22:53:31 +0000 (UTC)
Message-Id: <20240701225330.1695B1A923C@mollari.NetBSD.org>
Date: Mon,  1 Jul 2024 22:53:30 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: vis(3) and family should be async-signal-safe
X-Send-Pr-Version: www-1.0

>Number:         58390
>Category:       lib
>Synopsis:       vis(3) and family should be async-signal-safe
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 01 22:55:01 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The\040NetBSD\040Foundation\012
>Environment:
>Description:
vis(3) is useful for formatting terminal-safe log messages of untrusted inputs, which is sometimes tempting and/or useful to do in signal handlers.

Most of the vis(3) functions, with the exception of stravis, place their output in a caller-allocated buffer, so there is no need for them to allocate storage.

They should be rewritten to avoid malloc so they can be safe to call in signal handlers.
>How-To-Repeat:
find a self-inflicted NetBSD-specific possible remote code execution vector in openssh (our local patches pass log messages through strnvis for some reason)
>Fix:
Yes, please!

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.