From owner-freebsd-security@freebsd.org Tue Sep 26 22:02:55 2017 Return-Path: Delivered-To: freebsd-security@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50757E233B5 for ; Tue, 26 Sep 2017 22:02:55 +0000 (UTC) (envelope-from benlaurie@gmail.com) Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0ABE27C9E4 for ; Tue, 26 Sep 2017 22:02:55 +0000 (UTC) (envelope-from benlaurie@gmail.com) Received: by mail-qt0-x22b.google.com with SMTP id i50so11922473qtf.0 for ; Tue, 26 Sep 2017 15:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=B+wFVOIrukL+bN5b+ljDrJDSYc8Mk5uaqINn6/R3xPc=; b=CUs4XGcalWDFLAQ114vVG6Jf4J6v2h492WtM4TtDFZWbGUS6zhJ6vsq2MeOojfLAzA O5Mfyu9AVUKfWz+ybQ7FrOoXKyeYfpIHFczBs+VzvSe/2ewi5DYT3Sbkve6kvotfW0bb S6i6x3tem5wHrzgcHUriW+SKiZG9wfmkZUlADELS0G0KQ5ulWXR4lvcZJ5DpeCU6G+XP hY5CS7j8hypqCwRRyNt1vYIvuP5ZkuvU9vYOzswW3oryhGadbEGl1uVy8T4E2t5JEitY 5q/XzVmQFZJaZbpg2V606L359lRddIxQaLM4QcxFVUHtN4LPe3gmqDex43i6Cg6rgV+0 rsoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=B+wFVOIrukL+bN5b+ljDrJDSYc8Mk5uaqINn6/R3xPc=; b=ujy1cLIjGlm6goiwmB0LDNvWbQqQYYYQeh1wQU8U2YUTXTRxBlsyym8Gn+73z02Vyq VVRUS/OPQ4cSiClq9Rl8mOiTtZfnw08+/+HMCiOjbjz6YD6NczN/svMvkY1RwCxPtxCD +9WNNUqF7UAyNntT/q7nGUT4ZRln+DYCXhZDjm4XPFRavqzTZ69M1YeBvcLB0PuU+02/ RrIcD4llk9nd/4z8kwseAUnCoK5pcVk1WJNTi4c5ngPMdQez4LNKNQfzXtMOyrnaYBb0 lw8h+P7pwJDJFwzYh8kD6xMYxh7PSjro5EkZQKWyCrOsBpO+O2XiaZU7nxvXQsjydrmz Jnlw== X-Gm-Message-State: AHPjjUjcjjShAGe2gBarLVJ2aWQRqofOkdPdr3THvBLBUaQuqFPRXeAP f5HdcZGlWgok6fhXw1cofQoujh0+qck4w061TXNJ1g== X-Google-Smtp-Source: AOwi7QBxmsZRG/gWa4ASIOsc6F40F1gyZjg3gbZPxgfiotknFHLVQLB9rsuMDFvFvPzCQbIP1ipQE8NFBzciTPHRGcg= X-Received: by 10.200.3.224 with SMTP id z32mr18337667qtg.72.1506463374168; Tue, 26 Sep 2017 15:02:54 -0700 (PDT) MIME-Version: 1.0 Sender: benlaurie@gmail.com Received: by 10.200.3.80 with HTTP; Tue, 26 Sep 2017 15:02:53 -0700 (PDT) In-Reply-To: <20170926193753.eolxa6lk5qvejtgc@mutt-hbsd> References: <20170926193753.eolxa6lk5qvejtgc@mutt-hbsd> From: Ben Laurie Date: Tue, 26 Sep 2017 23:02:53 +0100 X-Google-Sender-Auth: 0yHFv9DIpAQc0guSMc23gHdUfIo Message-ID: Subject: Re: Capsicum and connect(2) To: Shawn Webb Cc: "freebsd-security@freebsd.org security" Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Tue, 26 Sep 2017 22:32:48 +0000 X-BeenThere: freebsd-security@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Security issues \[members-only posting\]" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 22:02:55 -0000 ECAPMODE means the syscall is forbidden, surely? On 26 September 2017 at 20:37, Shawn Webb wrote: > Hey All, > > I'm working on applying Capsicum to Tor. I've got a PoC design for how > I'm going to do it posted here: > > https://github.com/lattera/PoCs/tree/master/capsicum_fdpassing > > Note that the above code might have ugly spots. It's mostly just a brain > dump. > > Essentially, the child process creates the socket and passes the > socket's file descriptor back to the parent. The socket file descriptor > has the capabilities sets already applied to it before it goes back to > the parent. The socket creation and file descriptor passing seems to > work well. > > However, what isn't working is calling connect(2) on the socket file > descriptor in the parent. errno gets set to ECAPMODE. This is puzzling > to me since CAP_CONNECT is set on the descriptor. > > Any help would be appreciated. > > Thanks, > > -- > Shawn Webb > Cofounder and Security Engineer > HardenedBSD > > GPG Key ID: 0x6A84658F52456EEE > GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE