From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0JeGOQmvv2VY6hIAWB0awg (envelope-from ) for ; Sun, 04 Feb 2024 10:36:41 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E8H2Euwl; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E7CA21E0C3; Sun, 4 Feb 2024 10:36:41 -0500 (EST) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D18CA1E098 for ; Sun, 4 Feb 2024 10:36:39 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 49D3C385842D for ; Sun, 4 Feb 2024 15:36:39 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 85AAE3858CDB for ; Sun, 4 Feb 2024 15:36:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 85AAE3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 85AAE3858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707060981; cv=none; b=i4WXv9kqfqVJBncMfEbuv5RnUnfF/zRIpW6xmhgrlR8JBsY/LSNJpIeK3TOipn3RvVLzMlmI6RgzWrUwrg8zYr08jFw+fxbd5S3lTuCwnOJR+OBfqoPAqSRYOyAeciXIRDXGu0O8a9I3o7jRvnewBV6IAFz2wXO/29qUWkTBpMY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707060981; c=relaxed/simple; bh=RjrcpYJKTc3NhVHixPRvtuWMGZrLi/rUsM6Yzaksa+s=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=J0YcgIsEu8cz7MV1y0A6qMdwGUmdIm09lP1DHN8iBa8418Owc4HSGGYxwj1lgDGPUR3SZGSrGWON6SDGzk/vNgEf+lzmeEt6OZNrKTv+V96G8rOj1BVL3CYi73ax6cdOJ/YTPNj272gNfgj0fQRE6w3Vwrp5js8l0H4ueCEcUzs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707060979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6wYLSjW68P/FrcstzJ8ik4dx88w4fm7QtDOkVdVf3aQ=; b=E8H2EuwlQdThB2OHmKhYYYpB29iNIUSgO8coj4E7k0DDb+7k/BjKVLgR8F4MKe/rEv2Zip d/e2xSF+ltOFiFPUrAFQFfEJ2w42H31O/n7VSuZYjjZE/PHDS9ahfcud/7MeopS7eFyZps VebQiZzNucWJ+LmbX7xU++/2oV7+5hU= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-4-lNv-yHPTao_R8MAw3pUA-1; Sun, 04 Feb 2024 10:36:17 -0500 X-MC-Unique: 4-lNv-yHPTao_R8MAw3pUA-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2d099291380so7489611fa.1 for ; Sun, 04 Feb 2024 07:36:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707060976; x=1707665776; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6wYLSjW68P/FrcstzJ8ik4dx88w4fm7QtDOkVdVf3aQ=; b=Kpqksto97MTFHV5OOidkGAFQZeW7LPogIFE0cFwRjBQrWFyr3Fc76BCrxF/IYEE0ah hFm0JQhwxvqq8NH47xtsKly+RNWhd0idsyXsg5+SO+YyNeqaY8FQnYkPnVfvDhW5+Yfe 7PyxsjhqNZ382ivYXaICWLALC6hcDcP543wRc8iN6wdPqOiM42m4SymVCKd+d45xlw5W 4WZCel9sJQz8O6OHSuKEYk8iU60FiyrEqcjjAidrJaixnk8Vzuoh6oIJI3IPpxVcrrQA 6zJwT2zuJt7tn8Fvs0uJLA9t4oRalhMPcIY7QdXTLocI7GXkvt2prFanYKDyMnP2ZEt2 eFfg== X-Gm-Message-State: AOJu0YxKgESP/kJeklDRM9ZJBcH+Rj29mZPfHc4hr+DYfUgW0OvPj6Bk r3tOzm/2ebXmMqiG06+GE6TrdsAlBjdNPh3d3lQXqTdcDXsDVL4EHzIG/u4e1oCrtJQOt48Bj9S UBFB+mN7uO/KFrgLzIJ4DRSHzQyTA3f7BXZGhdIBXNyX178fcNiSB1Ptg8E2vvirnl9ksU7Oitp gRcTlC38XaiiqGcCVH9yxcHSDE9KkXoXEcJ86CcmeC9No= X-Received: by 2002:a2e:9081:0:b0:2d0:643c:c2aa with SMTP id l1-20020a2e9081000000b002d0643cc2aamr4767680ljg.20.1707060975730; Sun, 04 Feb 2024 07:36:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzQ1Q06INLSz9SR19TVXfMIQ+QbqtYEtq4uBssljrMXjWw5r1NFWhwNRBAKXaJRWeSQXMWnA== X-Received: by 2002:a2e:9081:0:b0:2d0:643c:c2aa with SMTP id l1-20020a2e9081000000b002d0643cc2aamr4767665ljg.20.1707060975264; Sun, 04 Feb 2024 07:36:15 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWfpxu9GlKkVEeWG5V8EF3cqpEakc4IJJP2/Qlaz2Qvq+wYnyFRpzWd/OtmaNG9TC/Lpud8VxPHu9zD4aE9DZbx7fl2/3wlpnph2pFZwikp37TqzlhIW7h6NtqWY4O/apSyBBvp/v1KPAq7sxiHrProvB98Aqh03JSKAFnGg9g4BnIXquYJpnc= Received: from localhost (92.40.184.53.threembb.co.uk. [92.40.184.53]) by smtp.gmail.com with ESMTPSA id fk24-20020a056402399800b0055d18d6a586sm2800717edb.13.2024.02.04.07.36.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 07:36:15 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Siddhesh Poyarekar , Kevin Buettner , Simon Marchi , felix.willgerodt@intel.com, Paul Koning Subject: Re: [V3] [RFC] Adding a SECURITY policy for GDB In-Reply-To: <87wmtog2f4.fsf@redhat.com> References: <877cmvui64.fsf@redhat.com> <87wmtog2f4.fsf@redhat.com> Date: Sun, 04 Feb 2024 15:36:14 +0000 Message-ID: <874jeo5jip.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Here is a V3 proposal for a SECURITY.txt document. There is much less change from V2 to V3 than V1 to V2. This was really me going through and addressing Eli's feedback. There are still a couple of open questions from Eli's feedback, so further updates may be need in the future, hopefully I can get later revisions out quicker than V3. All feedback would be great. Thanks, Andrew -- GNU Debugger Security Policy ============================ Introduction ------------ The GNU Debugger (GDB) is a tool for diagnosing issues "inside" another program. This can be done by controlling the execution of the program being debugged and allowing the user to inspect and modify the state of the running program. Or GDB can be used to analyse the program or a core file generated from the program without needing to execute the program. The program being debugged may be local i.e. on the system on which GDB runs or remote, on a different system. Policy Objectives ----------------- The objective of this policy is define what the GDB project considers a security bug and what is a non-security bug, and how each category of bug should be reported. Additionally, this policy will give some general advice to users on how to use GDB securely. Scope Of This Policy -------------------- This policy covers all currently supported versions of GDB as released from the official GDB website and covers gdb, gdbserver, as well as gcore and gdb-add-index, which are packaged with each GDB release. The official GDB website can be found here: https://sourceware.org/gdb/ Remote debugging uses GDB to connect to a remote target. GDB sends commands to the remote target which then controls the process being debugged. The GDB project provides one remote target, gdbserver, which is included with official GDB releases. Bugs within gdbserver are in scope for this policy. Other projects also implement remote targets to which GDB can connect. Any bugs in these remote targets are out of scope for this policy and should be reported to the relevant project. However, any bugs in GDB caused by a misbehaving remote target, even when that target is not gdbserver, are in scope for this policy. What Is Not A Security Bug? --------------------------- In the context of local debugging, when GDB is used to execute a program, the program runs with the same privileges as GDB itself. Additionally, it is possible for a program to detect when it is run under GDB and to change its behavior, so that unwanted behavior may only appear when a program is run under GDB. Therefore, when debugging an untrusted program, the user should ensure that this is done in a secure environment. Any issues that arise from running an untrusted binary not inside a secure environment are not security bugs in GDB. In the context of remote debugging, the program being debugged is run with the same privileges as gdbserver. As with GDB in the local debugging case, any issues that arise from running an untrusted binary not inside a secure environment are not security bugs in gdbserver. The connection between GDB and a remote target is not protected by either authentication or encryption. Connecting to a remote target allows for arbitrary code execution on the remote system with the same privileges as the remote user, and any resource that the remote user can access can be read by GDB, and downloaded to the local machine on which GDB is running. As such, users need to take independent measures to secure the connection between GDB and the remote target. Any issues that arise due to a failure to protect the connection between GDB and a remote target are not security bugs in either GDB or gdbserver. What Is A Security Bug? ----------------------- Any bugs in GDB or gdbserver that result in an unexpected crossing of a privilege boundary are considered security bugs. Some examples of crossing a privilege boundary include: being able to execute code as an arbitrarily different user, or accessing resources (e.g. files, sockets, etc) for which the original user would not normally have access. Any bugs in GDB that result in execution of the program being debugged without the user issuing a GDB command triggering execution (either from the GDB command line, a GDB configuration file, or from the GDB prompt) are considered security bugs. When gdbserver is started, if it is passed a program on its command line then that program will be started, but paused before executing its first instruction. Any bug which results in execution of the program being debugged without GDB first connecting to the target and sending a command that is intended to trigger execution is a security bug in gdbserver. Any bug in GDB or gdbserver that can trigger arbitrary code execution without the program being debugged having been executed by a user command, would be considered a security bug. For example, if simply loading a program into GDB could trigger arbitrary code execution, then this would be a security issue. The additional tools gcore and gdb-add-index are scripts that wrap around GDB. Any issue in these tools that meet the above definitions of a security bug, are considered a security bug. Security Considerations ----------------------- Within this section, references to GDB should be read as meaning GDB, gdbserver, gcore, or gdb-add-index, unless specifically stated otherwise. The most common use case for GDB is a developer trying to resolve issues within a program that they have either written themselves, or within a program that they trust not to be malicious. In this situation we would say GDB is being used to debug trusted code. There is no greater security risk from running the program to debug through GDB than there is running the program directly. Additional process isolation for the GDB process is only needed if additional isolation would have been applied anyway when running the program to debug. In some cases a developer may be given a program from an untrusted source and be asked to debug an issue. In this situation we would say GDB is being used to debug untrusted code. In this case the user should take all the precautions when running GDB that they would normally take when running an untrusted program outside of GDB, e.g. running within a secure, sandboxed environment. When using GDB to examine an untrusted program (with gdbserver, the program can be started, but paused at the first instruction and never run further), there should be no security risk, however, there are two things to consider: 1. The risk of inadvertently executing the untrusted program. It would be easy for a user to accidentally issue one of the many commands that would start the untrusted program executing. Even the 'start' command, which stops the program being debugged at the start of the main function might not be safe, a program can embed a malicious payload before the main function is reached. 2. Though every effort is made to ensure GDB is free from bugs, it cannot be guaranteed that GDB is bug free. It might be possible that even examining an untrusted program could trigger a bug in GDB which, in turn could trigger an unwanted effect on the system running GDB. Given these risks, the advice of the GDB project is, when using GDB with an untrusted binary, to do so in a secure, sandboxed environment. When using GDB and gdbserver to perform remote debug, the connection between the two components is by design insecure. It is up to the user to protect this connection, for example, only starting gdbserver within a secure network. Reporting Non-Security Bugs --------------------------- NOTE: All bugs reported in the GDB Bugzilla are public. Non-security bugs, as well as any security bugs that pose limited risk to users should be reported in GDB's bugzilla system. Bugs reported in this way will be public. The bugzilla system can be found here: https://sourceware.org/bugzilla/ Reporting Security Bugs ----------------------- In order to report a private security bug that is not immediately made public, please contact one of the downstream distributions with security teams. The following teams have volunteered to handle such bugs: Red Hat: secalert@redhat.com SUSE: security@suse.de Please report the bug to just one of these teams. It will be shared with other teams as necessary. The team contacted will take care of details such as vulnerability rating and CVE assignment (http://cve.mitre.org/about/). It is likely that the team will ask to file a public bug because the issue is sufficiently minor and does not warrant keeping details of the bug private.