https://github.com/torvalds/linux
Revision 462e635e5b73ba9a4c03913b77138cd57ce4b050 authored by Tavis Ormandy on 09 December 2010, 14:29:42 UTC, committed by Linus Torvalds on 15 December 2010, 20:30:36 UTC
The install_special_mapping routine (used, for example, to setup the
vdso) skips the security check before insert_vm_struct, allowing a local
attacker to bypass the mmap_min_addr security restriction by limiting
the available pages for special mappings.

bprm_mm_init() also skips the check, and although I don't think this can
be used to bypass any restrictions, I don't see any reason not to have
the security check.

  $ uname -m
  x86_64
  $ cat /proc/sys/vm/mmap_min_addr
  65536
  $ cat install_special_mapping.s
  section .bss
      resb BSS_SIZE
  section .text
      global _start
      _start:
          mov     eax, __NR_pause
          int     0x80
  $ nasm -D__NR_pause=29 -DBSS_SIZE=0xfffed000 -f elf -o install_special_mapping.o install_special_mapping.s
  $ ld -m elf_i386 -Ttext=0x10000 -Tbss=0x11000 -o install_special_mapping install_special_mapping.o
  $ ./install_special_mapping &
  [1] 14303
  $ cat /proc/14303/maps
  0000f000-00010000 r-xp 00000000 00:00 0                                  [vdso]
  00010000-00011000 r-xp 00001000 00:19 2453665                            /home/taviso/install_special_mapping
  00011000-ffffe000 rwxp 00000000 00:00 0                                  [stack]

It's worth noting that Red Hat are shipping with mmap_min_addr set to
4096.

Signed-off-by: Tavis Ormandy <taviso@google.com>
Acked-by: Kees Cook <kees@ubuntu.com>
Acked-by: Robert Swiecki <swiecki@google.com>
[ Changed to not drop the error code - akpm ]
Reviewed-by: James Morris <jmorris@namei.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0fcdcfb
History
Tip revision: 462e635e5b73ba9a4c03913b77138cd57ce4b050 authored by Tavis Ormandy on 09 December 2010, 14:29:42 UTC
install_special_mapping skips security_file_mmap check.
Tip revision: 462e635
File Mode Size
debugfs-ec -rw-r--r-- 838 bytes
debugfs-pktcdvd -rw-r--r-- 448 bytes
ima_policy -rw-r--r-- 1.9 KB
procfs-diskstats -rw-r--r-- 655 bytes
sysfs-ata -rw-r--r-- 2.4 KB
sysfs-block -rw-r--r-- 5.2 KB
sysfs-block-zram -rw-r--r-- 3.3 KB
sysfs-bus-css -rw-r--r-- 1.4 KB
sysfs-bus-i2c-devices-hm6352 -rw-r--r-- 640 bytes
sysfs-bus-pci -rw-r--r-- 6.4 KB
sysfs-bus-pci-devices-cciss -rw-r--r-- 1.9 KB
sysfs-bus-rbd -rw-r--r-- 1.7 KB
sysfs-bus-umc -rw-r--r-- 1018 bytes
sysfs-bus-usb -rw-r--r-- 5.0 KB
sysfs-bus-usb-devices-usbsevseg -rw-r--r-- 1.5 KB
sysfs-c2port -rw-r--r-- 2.9 KB
sysfs-class -rw-r--r-- 520 bytes
sysfs-class-bdi -rw-r--r-- 1.5 KB
sysfs-class-lcd -rw-r--r-- 681 bytes
sysfs-class-led -rw-r--r-- 966 bytes
sysfs-class-mtd -rw-r--r-- 3.7 KB
sysfs-class-pktcdvd -rw-r--r-- 2.7 KB
sysfs-class-power -rw-r--r-- 756 bytes
sysfs-class-regulator -rw-r--r-- 11.4 KB
sysfs-class-uwb_rc -rw-r--r-- 5.1 KB
sysfs-class-uwb_rc-wusbhc -rw-r--r-- 1.6 KB
sysfs-dev -rw-r--r-- 693 bytes
sysfs-devices -rw-r--r-- 1021 bytes
sysfs-devices-memory -rw-r--r-- 3.3 KB
sysfs-devices-node -rw-r--r-- 299 bytes
sysfs-devices-platform-_UDC_-gadget -rw-r--r-- 667 bytes
sysfs-devices-power -rw-r--r-- 6.8 KB
sysfs-devices-system-cpu -rw-r--r-- 6.9 KB
sysfs-devices-system-ibm-rtl -rw-r--r-- 817 bytes
sysfs-driver-hid-picolcd -rw-r--r-- 1.8 KB
sysfs-driver-hid-prodikeys -rw-r--r-- 985 bytes
sysfs-driver-hid-roccat-kone -rw-r--r-- 4.1 KB
sysfs-driver-hid-roccat-pyra -rw-r--r-- 4.4 KB
sysfs-firmware-acpi -rw-r--r-- 4.2 KB
sysfs-firmware-memmap -rw-r--r-- 2.3 KB
sysfs-firmware-sfi -rw-r--r-- 466 bytes
sysfs-firmware-sgi_uv -rw-r--r-- 889 bytes
sysfs-fs-ext4 -rw-r--r-- 3.0 KB
sysfs-gpio -rw-r--r-- 1.1 KB
sysfs-i2c-bmp085 -rw-r--r-- 1.1 KB
sysfs-ibft -rw-r--r-- 1022 bytes
sysfs-kernel-mm -rw-r--r-- 202 bytes
sysfs-kernel-mm-hugepages -rw-r--r-- 521 bytes
sysfs-kernel-slab -rw-r--r-- 16.9 KB
sysfs-kernel-uids -rw-r--r-- 658 bytes
sysfs-memory-page-offline -rw-r--r-- 1.6 KB
sysfs-module -rw-r--r-- 337 bytes
sysfs-ocfs2 -rw-r--r-- 3.0 KB
sysfs-platform-asus-laptop -rw-r--r-- 2.0 KB
sysfs-platform-eeepc-laptop -rw-r--r-- 1.5 KB
sysfs-platform-eeepc-wmi -rw-r--r-- 344 bytes
sysfs-power -rw-r--r-- 6.7 KB
sysfs-pps -rw-r--r-- 2.1 KB
sysfs-profiling -rw-r--r-- 331 bytes
sysfs-wacom -rw-r--r-- 404 bytes
sysfs-wusb_cbaf -rw-r--r-- 3.9 KB

back to top