From patchwork Sat Jul 6 19:38:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 2344 Return-Path: Received: from mail01.ipfire.org (mail01.i.ipfire.org [172.28.1.200]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail01.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web07.i.ipfire.org (Postfix) with ESMTPS id 211BD8808A1 for ; Sat, 6 Jul 2019 10:38:48 +0100 (BST) Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 45gmqq17Pfz5M5fJ; Sat, 6 Jul 2019 10:38:47 +0100 (BST) Received: from [127.0.0.1] (gepapt.largestor.com [194.88.143.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 45gmql0r30z5M5dd for ; Sat, 6 Jul 2019 10:38:42 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904rsa; t=1562405923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRa1TM7VtDTpq3IUyEgMbKgrwmGVfaTj1ZaYXlVfYdM=; b=RGsLfqGFZFerWGwUZMBBAd8MP1xYwaiaB4LFivzQgqIl2hwGJN90quaVU9kTWz0KExMdXE WBf76jy62c/Shh2p1GDsIBK/0wODKbMUPnLGaeLRgGjYYtLnLgWnuGMimiEgHlMBjfCZ99 63aYZwGcidK7OIXp80kfVmhK2HEJEpMn24kyfDWntDKw/gKxn/wJ2IGWHjNRnJozDr4+Ko ZE4AN5xCIb9WKTAhzhgmXpGWBfgSzcQzkIRcjZ+93DNE3vrvnyGQRWOyj7RtyzlNRVn5b5 PtXSBb/ROuPFcuEaVFZLQDxZnJ1ACE0tPdqB0CH2/5bzeZhhlUi4iIoDwVPWCQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904ed25519; t=1562405923; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRa1TM7VtDTpq3IUyEgMbKgrwmGVfaTj1ZaYXlVfYdM=; b=YPylRWlpib6rtkXTvjud6K2z+oNpsb+0i9YwUZjuHB0GqvQ5M13sUH3fz6p6hZraVzC5T7 M0KdGL7qqWidNLBw== To: "IPFire: Development-List" From: =?utf-8?q?Peter_M=C3=BCller?= Subject: [PATCH] sysctl: improve KASLR effectiveness for mmap Organization: IPFire.org Message-ID: <3efce5d6-1679-cb70-b119-64c8bfe55237@ipfire.org> Date: Sat, 06 Jul 2019 09:38:00 +0000 MIME-Version: 1.0 Content-Language: en-US Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=pmueller smtp.mailfrom=peter.mueller@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" By feeding more random bits into mmap allocation, the effectiveness of KASLR will be improved, making attacks trying to bypass address randomisation more difficult. Changed sysctl values are: vm.mmap_rnd_bits = 32 (default: 28) vm.mmap_rnd_compat_bits = 16 (default: 8) This patch backports the same change made in IPFire 2.x into IPFire 3.x . Signed-off-by: Peter Müller --- setup/setup.nm | 2 +- setup/sysctl/kernel-hardening.conf | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup/setup.nm b/setup/setup.nm index be0ca4ba0..09d94e23d 100644 --- a/setup/setup.nm +++ b/setup/setup.nm @@ -5,7 +5,7 @@ name = setup version = 3.0 -release = 13 +release = 14 arch = noarch groups = Base Build System/Base diff --git a/setup/sysctl/kernel-hardening.conf b/setup/sysctl/kernel-hardening.conf index 9bb6e9f45..33e096c7c 100644 --- a/setup/sysctl/kernel-hardening.conf +++ b/setup/sysctl/kernel-hardening.conf @@ -4,3 +4,6 @@ kernel.kptr_restrict = 2 # Avoid kernel memory address exposures via dmesg. kernel.dmesg_restrict = 1 +# Improve KASLR effectiveness for mmap. +vm.mmap_rnd_bits = 32 +vm.mmap_rnd_compat_bits = 16