Re: [PATCH 1/2] audit: add call argument to socketcall auditing

From: Steve Grubb
Date: Tue May 03 2022 - 13:16:56 EST


Hello,

On Tuesday, May 3, 2022 5:02:11 AM EDT Sven Schnelle wrote:
> socketcall auditing misses the call argument:
>
> type=SOCKETCALL msg=audit: nargs=3 a0=10 a1=3 a2=c
>
> which renders socketcall auditing (almost) useless. Add the call
> argument so it is possible to decode the actual syscall from the
> audit log:
>
> type=SOCKETCALL msg=audit: call=1 nargs=3 a0=10 a1=3 a2=c

The call argument is in arg0 in the syscall record

type=PROCTITLE msg=audit(1651597634.301:1034): proctitle="./test"
type=SOCKADDR msg=audit(1651597634.301:1034):
saddr=020000357F0000013030303030303030
type=SOCKETCALL msg=audit(1651597634.301:1034): nargs=3 a0=3 a1=fff47510
a2=10
type=SYSCALL msg=audit(1651597634.301:1034): arch=40000003 syscall=102
success=no exit=-111 a0=3 a1=fff47520 a2=f7f306cb a3=35000002 items=0
ppid=10425 pid=10428 auid=325 uid=1325 gid=1325 euid=1325 suid=1325
fsuid=1325 egid=1325 sgid=1325 fsgid=1325 tty=pts2 ses=3 comm="test" exe="/
home/socketcall/test" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
key="32bit-abi"

which user space translates into:

type=PROCTITLE msg=audit(05/03/2022 13:07:14.301:1034) : proctitle=./test
type=SOCKADDR msg=audit(05/03/2022 13:07:14.301:1034) : saddr={
saddr_fam=inet laddr=127.0.0.1 lport=53 }
type=SOCKETCALL msg=audit(05/03/2022 13:07:14.301:1034) : nargs=3 a0=0x3
a1=0xfff47510 a2=0x10
type=SYSCALL msg=audit(05/03/2022 13:07:14.301:1034) : arch=i386
syscall=socketcall(connect) success=no exit=ECONNREFUSED(Connection refused)
a0=connect a1=0xfff47520 a2=0xf7f306cb a3=0x35000002 items=0 ppid=10425
pid=10428 auid=sgrubb uid=sgrubb gid=sgrubb euid=sgrubb suid=sgrubb
fsuid=sgrubb egid=sgrubb sgid=sgrubb fsgid=sgrubb tty=pts2 ses=3 comm=test
exe=/home/test/socketcall/test subj=unconfined_u:unconfined_r:unconfined_t:s0-
s0:c0.c1023 key=32bit-abi

Nothing is missing.

-Steve