linux-audit.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steve Grubb <sgrubb@redhat.com>
To: linux-audit@redhat.com
Subject: Re: Audit record created by  echo "ThisIsATest" >>/tmp/test/file11
Date: Fri, 09 Oct 2015 11:02:23 -0400	[thread overview]
Message-ID: <4202584.GUBde7GBZO@x2> (raw)
In-Reply-To: <A00B071BFA01DA43B042DB000B1F1EDC012E1ABC@prvxmb02.microfocus.com>

On Friday, October 09, 2015 02:43:59 PM Boyd Memmott wrote:
> I have an audit question concerning echo "ThisIsATest" >>/tmp/test/file11
> 
> I have a rule: -w /tmp/test -p war -S all -k thekey
> 
> It produces the following audit record.
> type=SYSCALL msg=audit(1444398577.247:1581): arch=c000003e syscall=2
> success=yes exit=3 a0=1f5bca0 a1=441 a2=1b6 a3=20 items=2 ppid=17766
> pid=17808 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0
> tty=pts3 ses=1 comm="bash" exe="/bin/bash" key="thekey" type=CWD
> msg=audit(1444398577.247:1581):  cwd="/tmp/test"
> type=PATH msg=audit(1444398577.247:1581): item=0 name="/tmp/test" inode=1436
> dev=00:2e mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT type=PATH
> msg=audit(1444398577.247:1581): item=1 name="file11" inode=6797 dev=00:2e
> mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=CREATE
> 
> I understand bash is the executable, because ">" is writing to the file via
> a file handle.
> 
> Is there another switch or rule that would improve the audit record to
> capture echo as being the initiator of the command??

In this particular example, keystroke logging would. But in general, the 
answer is no. The reason being that echo is built-in to the shell while 
/bin/echo is an actual program.

For reference, this is what happens when you type a command:

* Bash checks if internal command and handles it
* If its a subshell,
  – forks and starts reading lines and performing them
* Else it: forks, sets up pipes, calls execve(filename, argv, envp)
* Kernel has a list of supported formats
  –ia_32aout
  -Flat
  -Aout
  -Script
  -Em86
  -Elf
  -elf_fdpic
* It iterates through each handler until one accepts the file
* Otherwise bash reports not an executable

-Steve

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit

      reply	other threads:[~2015-10-09 15:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 14:43 Audit record created by echo "ThisIsATest" >>/tmp/test/file11 Boyd Memmott
2015-10-09 15:02 ` Steve Grubb [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4202584.GUBde7GBZO@x2 \
    --to=sgrubb@redhat.com \
    --cc=linux-audit@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).