From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E23C9C433E0 for ; Tue, 2 Mar 2021 16:55:59 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6ED2864F32 for ; Tue, 2 Mar 2021 16:55:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6ED2864F32 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=linux-audit-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614704158; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CUqcQ7bYGivTB+nkmP8mABogVTB9iIMtppS8V5fLUhQ=; b=CQP/E5Kdb0YC2YQCttCFKz6MAI3VjH1PaxcMMeaoG47my/Du5qoKuibVV1F+JwEFRYl8Hh MH7yWJwg3i4GFH9w7wGYcJtp7ZkpAo7lVNEwgnSSILiqjhL2aXS+rBDTdti0EJM76XvakW AxAdnxWTrmK72AlD8KpDQdF4ZpK366M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-532-SPoSUP0ONBOU-BaTioip9g-1; Tue, 02 Mar 2021 11:55:55 -0500 X-MC-Unique: SPoSUP0ONBOU-BaTioip9g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9673BAFA80; Tue, 2 Mar 2021 16:55:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F4B12617F; Tue, 2 Mar 2021 16:55:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A3D554E58E; Tue, 2 Mar 2021 16:55:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 122GtYWo029056 for ; Tue, 2 Mar 2021 11:55:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id D30FC18E2B; Tue, 2 Mar 2021 16:55:34 +0000 (UTC) Received: from madcap2.tricolour.ca (unknown [10.10.110.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1BDB5D9E2; Tue, 2 Mar 2021 16:55:27 +0000 (UTC) Date: Tue, 2 Mar 2021 11:55:25 -0500 From: Richard Guy Briggs To: Alan Evangelista Subject: Re: Getting the value of a syscall's memory address argument - setxattr Message-ID: <20210302165525.GV3141668@madcap2.tricolour.ca> References: <20210227214432.GT2015948@madcap2.tricolour.ca> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: linux-audit@redhat.com Cc: linux-audit@redhat.com X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 2021-03-01 07:24, Alan Evangelista wrote: > > They would not be safe to access from userspace after the syscall has > > finished. audit records the values of a number of specific syscall > > parameters in special records so this would most likely need a new > > special record to add to the audit syscall event to record those pointer > > contents. > > AFAIK, that would require a patch to the kernel part of the Linux Audit > framework? Yes. See: https://github.com/linux-audit/audit-kernel/issues/39 > > This use case adds and additional challenge. Since this is a filesystem > > that is changed remotely, you may not have a record of the remote user > > who made the change, but only the server daemon locally that brokered > > the change unless that information is in those pointers. > > I know. The username is not a problem because I have Windows/Linux > users mapped with Centrify. If I can get the extended attributes > updated on the Linux side, I'm hoping my code can infer the equivalent > operations on the Windows side. > > On Sat, Feb 27, 2021 at 6:44 PM Richard Guy Briggs wrote: > > On 2021-02-26 22:17, Alan Evangelista wrote: > > > Each syscall has some arguments and the Linux Audit framework logs each > > > pointer argument as a memory address instead of its values. For instance, > > > when tracking the setxattr syscall, I get its arguments in the following > > > format: > > > > > > "a0":"55f3604ba000" > > > "a1":"7f1b0bd342fd" > > > "a2":"55f3604d9b20" > > > "a3":"38" > > > > > > According to https://man7.org/linux/man-pages/man2/setxattr.2.html, a0 > > is > > > the file path's starting memory address, a1 is the extended attribute > > > name's starting memory address, a2 is the extended attribute > > > value's starting memory address and a3 is the size in bytes of the > > extended > > > attribute value. > > > > > > Is it safe to access those memory addresses in order to get their > > values? I > > > guess not because their content may have been overwritten between the > > time > > > the syscall log entry was generated by the kernel and the time it's > > > consumed by a Linux Audit client. If indeed it's unsafe to access these > > > memory addresses, is there any other way to get the extended attribute > > > name/value in the setxattr syscall using the Linux Audit framework? > > > > They would not be safe to access from userspace after the syscall has > > finished. audit records the values of a number of specific syscall > > parameters in special records so this would most likely need a new > > special record to add to the audit syscall event to record those pointer > > contents. > > > > > My specific use case: I'm using Auditbeat/Linux Audit to track permission > > > changes done to a disk partition which is mounted by Samba on a Windows > > > Server box. When a Windows user changes permissions of a file in the > > Samba > > > mount, Linux Audit records a setxattr event and Auditbeat (connected to > > the > > > kernel's Audit framework via netlink) notifies me of the event. I need to > > > know what permission changes the user has done in the file and AFAIK > > > parsing the ext attrib name/value is the only way to do that. > > > > This use case adds and additional challenge. Since this is a filesystem > > that is changed remotely, you may not have a record of the remote user > > who made the change, but only the server daemon locally that brokered > > the change unless that information is in those pointers. > > > > > Thanks in advance. > > > > - RGB - RGB -- Richard Guy Briggs Sr. S/W Engineer, Kernel Security, Base Operating Systems Remote, Ottawa, Red Hat Canada IRC: rgb, SunRaycer Voice: +1.647.777.2635, Internal: (81) 32635 -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit