execution via bang-line not mediated by apparmor
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
AppArmor |
Confirmed
|
Wishlist
|
Unassigned |
Bug Description
Demonstration of problem:
testuser@bizarro:~$ /usr/bin/perl
-testbash: /usr/bin/perl: Permission denied
testuser@bizarro:~$ echo '#!/usr/bin/perl' > hello.pl
testuser@bizarro:~$ echo 'print "hello\n"' >> hello.pl
testuser@bizarro:~$ chmod a+x hello.pl
testuser@bizarro:~$ ./hello.pl
hello
testuser@bizarro:~$
Policy used in demonstration:
# Last Modified: Sat Jul 19 18:48:21 2014
#include <tunables/global>
/usr/local/
#include <abstractions/base>
owner /home/*/** rwkix,
/bin/cat rix,
/bin/chmod rix,
/usr/
/dev/tty rw,
/dev/pts/* rw,
/etc/bash.bashrc r,
/etc/inputrc r,
/etc/
/etc/passwd r,
/etc/profile r,
/etc/profile.d/ r,
/etc/profile.d/** r,
/etc/vim/** r,
/usr/share/vim/** r,
/run/nscd/socket rw,
/var/
/var/
}
Changed in apparmor: | |
status: | New → Won't Fix |
information type: | Private Security → Public Security |
tags: | added: aa-kernel |
Okay, I've got a minimal test for this that doesn't rely upon anything outside of these files.
cp ~/Downloads/ confined_ interpreter. c /tmp interpreter interpreter { x86_64- linux-gnu/ libc-2. 19.so rm, confined_ interpreter ix, interpreter
cd /tmp
make confined_
sudo -s
apparmor_parser --replace <<EOF
profile /tmp/confined_
/etc/ld.so.cache r,
/lib/
/tmp/
/tmp/runme.pl wix,
}
EOF
exit
/tmp/confined_
Even though /tmp/confined_ interpreter is executing in a profile that doesn't include /usr/bin/perl in any way, the /usr/bin/perl executable is started, as evidenced by failure to load perl libraries:
/usr/bin/perl: error while loading shared libraries: libperl.so.5.18: cannot open shared object file: Permission denied
type=AVC msg=audit( 1405991249. 694:8453) : apparmor="DENIED" operation="open" profile= "/tmp/confined_ interpreter" name="/ usr/lib/ libperl. so.5.18. 2" pid=13472 comm="runme.pl" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0