Skip to contentSkip to conversation

Process system call access list.

DISCUSSION Bill Pringlemeir 2 participants 2 messages Jan 16, 2005

lore
Share & tools
lore
#0 lore raw

[please CC me.]

I was looking at phrack and many of the remote exploits rely on injecting some arbitrary code. Generally is is something like 'exec("/bin/sh")' or something like that.

I was wondering if a section could be added to the link phase of a user application that would keep a list/bit mask of all kernel calls that the compiler had encountered in some section.

When the kernel loaded a process, it would keep a copy of the bit mask and perform a comparison to see if the process was intended to make the system call (perhaps only a sub-set of the entire system calls are needed).

Of course, I imagine there is some reason that a process would like to dynamically create it's own code [although it wouldn't be the majority?], so the bit mask could be set to all ones via some linker magic when building the user application.

Generally it would help protect against remote code injection and some possible privilege elevation exploits by restricting system calls. On the down side, it is probably not fool proof and might give people a false sense of security. So perhaps it is not a good feature for the kernel to have.

Sorry if this has been discussed before. Unlike disk encryption, I couldn't find a reference to this topic, but maybe my search was using the wrong nomenclature. The susinct question would be is this worth implementing?

tia,
Bill Pringlemeir.

#1 lore raw

Hi,

Quoted 7 lines · Bill Pringlemeir

[please CC me.]

I was looking at phrack and many of the remote exploits rely on injecting some arbitrary code. Generally is is something like 'exec("/bin/sh")' or something like that.

Quoted 8 lines

I was wondering if a section could be added to the link phase of a user application that would keep a list/bit mask of all kernel calls that the compiler had encountered in some section.

When the kernel loaded a process, it would keep a copy of the bit mask and perform a comparison to see if the process was intended to make the system call (perhaps only a sub-set of the entire system calls are needed).

A friend of mine worked on something a bit like this for kernel 2.2. He had a module which accepted syscall-based sets of rules based on prog name, pid, uid, argument size and values, etc... He could even execute code before and after the syscall (he could use it to keep an image of what 'make install' touches). The goal was to identify all syscalls needed from opensource programs through code reviewing, and try to identify them using strace for closed-source programs (or simply let them be vulnerable). We found it useful to protect against some attacks on network-only programs; For example, a reverse-proxy has no reason to either fork, exec, mount, mknod, etc... We did not have time to port this to 2.4. However, now that the syscall_table is unexported, this is history.

There are other programs which do more or less the same (systrace comes to mind). But in your case where the compiler gives the syscall list itself, I have no knowledge of any similar tool. But I fear that if the bitmask is kept within an ELF section, the attacker would first have to rewrite the mask before using syscalls again (or put it in an RO section ?).

Regards,
Willy