what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Android fps sysfs Entry Buffer Overflow

Android fps sysfs Entry Buffer Overflow
Posted Jan 18, 2017
Authored by Google Security Research, laginimaineb

Android suffers from a buffer overflow vulnerability in the fps sysfs entry.

tags | advisory, overflow
SHA-256 | 25b12398d3ab499a9858e18014b79e83ac449fe0890dbe2d143f2c31726f1a1f

Android fps sysfs Entry Buffer Overflow

Change Mirror Download
 Android: Buffer overflow in "fps" sysfs entry 




The GPU driver on Exynos SoCs exposes several sysfs entries. One such entry, "fps", allows the user to overwrite or query to global FPS string.

The "fps" sysfs entry is present under:

/sys/devices/platform/gpusysfs/fps

Writes to this entry are handled by the function "fps_show", under:

drivers/gpu/gpu_sysfs/gpu_sysfs_target_exynos<VERSION>.c

This function fails to validate the length of the user-supplied string, before copying it into a static global variable, "global_fps_string".

ssize_t fps_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
pr_info("SRUK ----------- %s -- %d", __FUNCTION__, __LINE__);

if (buf != NULL)
sprintf(global_fps_string,"%s", buf);
else
sprintf(global_fps_string,"0");

/* Return success status. */
return count;
}

The "buf" argument contains the user-supplied data.

Supplying a string larger than the static buffer (i.e., larger than 32 bytes), will allow an attacker to trigger the overflow.

I've statically verified this issue on an SM-G935F device. The open-source kernel package I analysed was "SM-G935F_MM_Opensource".

The sysfs entry mentioned above is owned by the "root" user and group and has an SELinux context of: "u:object_r:sysfs:s0".

According to the default SELinux rules as present on the SM-G935F (version XXS1APG3), the following contexts may access these files:

allow ipm sysfs : file { write setattr } ;
allow netd sysfs : file write ;
allow perfd sysfs : file { ioctl read write getattr lock append open } ;
allow qti_init_shell sysfs : dir write ;
allow rtcc sysfs : file { write setattr } ;
allow nfc sysfs : file write ;
allow mm-pp-daemon sysfs : file { ioctl read write getattr lock append open } ;
allow geomagneticd sysfs : file { write append open } ;
allow qti_init_shell sysfs : file { write setattr append open } ;
allow sysfs tmpfs : filesystem associate ;
allow energyawareness sysfs : file { write append open } ;
allow mfgloader sysfs : file write ;
allow eeh sysfs : file { ioctl read write create getattr setattr lock append unlink rename open } ;
allow lmkd sysfs : file write ;
allow sec-ril sysfs : file { ioctl read write create getattr setattr lock append unlink rename open } ;
allow cellgeofenced sysfs : dir { ioctl read write getattr add_name remove_name search open } ;
allow connfwexe sysfs : file { ioctl read write getattr lock append open } ;
allow mm-qcamerad sysfs : file { ioctl read write getattr lock append open } ;
allow surfaceflinger sysfs : file { ioctl read write getattr setattr lock append open } ;
allow mediaserver sysfs : file { ioctl read write getattr lock append open } ;
allow fstman sysfs : file write ;
allow mdm_helper sysfs : file { ioctl read write getattr lock append open } ;
allow sprd_res_monitor sysfs : file { ioctl read write getattr lock append open } ;
allow sysfs_type sysfs : filesystem associate ;
allow domain sysfs : lnk_file { ioctl read getattr lock open } ;
allow debuggerd sysfs : file { write append open } ;
allow bintvoutservice sysfs : file { write append open } ;
allow dumpstate sysfs : file { write append open } ;
allow mlexe sysfs : file { write append open } ;
allow configfs sysfs : filesystem associate ;
allow diag sysfs : file { write append open } ;
allow qmuxd sysfs : file { write append open } ;
allow vmwared sysfs : file write ;
allow lpm sysfs : file { ioctl read write getattr lock append open } ;
allow domain sysfs : dir { ioctl read getattr search open } ;
allow init sysfs : dir { write getattr relabelfrom mounton } ;
allow zygote sysfs : file write ;
allow rtcc sysfs : dir setattr ;
allow ueventd sysfs : file { ioctl read write getattr lock relabelfrom relabelto append open } ;
allow phasecheckserver sysfs : file write ;
allow vm_bms sysfs : file { write append open } ;
allow modem_control sysfs : file write ;
allow tbased sysfs : file write ;
allow jackservice sysfs : file write ;
allow radio sysfs : file { append open } ;
allow cnd sysfs : file { write append open } ;
allow sswap sysfs : file { write append open } ;
allow factorytest sysfs : file { write open } ;
allow hvdcp sysfs : file { ioctl read write getattr lock append open } ;
allow marvelltel sysfs : file { ioctl read write create getattr setattr lock append unlink rename open } ;
allow cbd sysfs : file { write append open } ;
allow batterysrv sysfs : file write ;
allow sensors sysfs : file { write append open } ;
allow bauthserver sysfs : file { ioctl read write getattr lock append open } ;
allow netmgrd sysfs : file { write append open } ;
allow init sysfs : file { getattr relabelfrom } ;
allow domain sysfs : file { ioctl read getattr lock open } ;
allow kiesexe sysfs : file { write append open } ;
allow lhd sysfs : file { ioctl read write getattr lock append open } ;
allow at_distributor sysfs : file { write append open } ;
allow mmb_mw sysfs : file { write append open } ;
allow FMRadiod sysfs : file { ioctl read write create getattr setattr lock append unlink rename open } ;
allow gpsd sysfs : file { ioctl read write getattr lock append open } ;
allow oneseg_mw sysfs : file { write append open } ;
allow mmi sysfs : file { write append open } ;
allow sensorhubservice sysfs : file write ;
allow kernel sysfs : file setattr ;
allow rootfs sysfs : filesystem associate ;
allow system_server sysfs : file { ioctl read write create getattr setattr lock append unlink rename open } ;
allow qcks sysfs : file { write append open } ;
allow qosmgr sysfs : file write ;
allow surfaceflinger sysfs : lnk_file { ioctl read write getattr lock append open } ;
allow smdexe sysfs : file { ioctl read write getattr lock append open } ;
allow zram sysfs : file write ;
allow wcnss_service sysfs : file { write append open } ;
allow phservice sysfs : file { ioctl read write create getattr setattr lock append unlink rename open } ;
allow sysfs sysfs : filesystem associate ;
allow ssr_setup sysfs : file { write append open } ;
allow mwirelessd sysfs : file write ;
allow macloader sysfs : file { ioctl read write getattr lock append open } ;
allow bluetooth sysfs : file { ioctl read write getattr lock append open } ;
allow RIDL sysfs : file write ;
allow autotest sysfs : file { write open } ;
allow bootanim sysfs : file { ioctl read write getattr lock append open } ;
allow vold sysfs : file { ioctl read write getattr lock append open } ;
allow ueventd sysfs : dir { setattr relabelfrom relabelto } ;
allow charger_monitor sysfs : file { write append open } ;
allow mpdecision sysfs : file { ioctl read write getattr lock append open } ;
allow engpc sysfs : file write ;
allow rild sysfs : file { ioctl read write create getattr setattr lock append unlink rename open } ;
allow thermal-engine sysfs : file { write append open } ;
allow init sysfs : lnk_file { getattr setattr relabelfrom } ;
allow rmt_storage sysfs : file { write append open } ;
allow healthd sysfs : file write ;
allow cellgeofenced sysfs : file { ioctl read write getattr lock append open } ;
allow system_server sysfs : dir { ioctl read write create getattr setattr rename add_name remove_name reparent search rmdir open } ;
allow efsks sysfs : file { write append open } ;



This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without a broadly available patch, then the bug report will automatically
become visible to the public.




Found by: laginimaineb

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close