Skip to contentSkip to conversation

Why doesn't chown produce an event

DISCUSSION Robert Evans 3 participants 7 messages May 2, 2007

lore
Share & tools
lore
#0 lore raw

Greetings,

I have the following rule in audit.rules

-a exit,always -S chmod -S chown -S lchown -S fchown -F success!-1 -F key=mod

If I log in as a typical user and try "chown bob /etc/shadow" I don't get an event produced, however if I try "chmod 666 /etc/shadow" I do.

What am I missing here?

Thanks!

Bob

#1 lore raw
Quoted 7 lines · Robert Evans

Greetings,

I have the following rule in audit.rules

-a exit,always -S chmod -S chown -S lchown -S fchown -F success!-1 -F key=mod

Quoted 6 lines

If I log in as a typical user and try "chown bob /etc/shadow" I don't get an event produced, however if I try "chmod 666 /etc/shadow" I do.

What am I missing here?

Thanks!

You need to give 1 systemcall per line I guess.

-a exit,always -S chmod -F success!-1 -F key=mod
-a exit,always -S chown -F success!-1 -F key=mod
-a exit,always -S lchown -F success!-1 -F key=mod
-a exit,always -S fchown -F success!-1 -F key=mod

Ciao, Marcus

#2 lore raw

Hmm... The documentation says that it is best to combine system calls on one line.
And in fact the sample audit.rules for NISPOM coverage posted by this site have the system calls on one line as well.

Bob

-----Original Message-----
From: Marcus Meissner [mailto:[email protected]]
Sent: Wednesday, May 02, 2007 11:15 AM
To: Evans, Robert B.
Cc: [email protected]
Subject: Re: Why doesn't chown produce an event

Quoted 7 lines · Robert Evans

Greetings,

I have the following rule in audit.rules

-a exit,always -S chmod -S chown -S lchown -S fchown -F success!-1 -F key=mod

Quoted 6 lines

If I log in as a typical user and try "chown bob /etc/shadow" I don't get an event produced, however if I try "chmod 666 /etc/shadow" I do.

What am I missing here?

Thanks!

You need to give 1 systemcall per line I guess.

-a exit,always -S chmod -F success!-1 -F key=mod -a exit,always -S chown -F success!-1 -F key=mod -a exit,always -S lchown -F success!-1 -F key=mod -a exit,always -S fchown -F success!-1 -F key=mod

Ciao, Marcus

#4 lore raw
In reply to Robert Evans
Quoted 4 lines · Robert Evans

If I log in as a typical user and try "chown bob /etc/shadow" I don't get an event produced, however if I try "chmod 666 /etc/shadow" I do.

What am I missing here?

A syscall. If I am on a i386 machine and I strace chmod root file.txt, I see this:

chown32("file.txt", 0, -1) = 0

So, you would want to use chown32 instead of chown on i386 machines. On x86_64 the chown syscall is used.

-Steve

#5 lore raw
In reply to Steve Grubb

Got it! So when I want to figure out how to trace something, the recommended course of action is do a strace on the operation, and look for a good syscall to tag...

Bob

Quoted 14 lines · Steve Grubb
Quoted 4 lines · Robert Evans

If I log in as a typical user and try "chown bob /etc/shadow" I don't get an event produced, however if I try "chmod 666 /etc/shadow" I do.

What am I missing here?

A syscall. If I am on a i386 machine and I strace chmod root file.txt, I see this:

chown32("file.txt", 0, -1) = 0

So, you would want to use chown32 instead of chown on i386 machines. On x86_64 the chown syscall is used.

-Steve

#6 lore raw
Quoted 3 lines · Robert Evans

Got it!  So when I want to figure out how to trace something, the recommended course of action is do a strace on the operation, and look for a good syscall to tag...

You should do that whenever you don't get a hit when you think you should. It should also be trivial for me to write a simple app that iterates the syscalls it knows about for a given arch.

-Steve