Äú¿ÉÒÔ¾èÖú£¬Ö§³ÖÎÒÃǵĹ«ÒæÊÂÒµ¡£

1Ôª 10Ôª 50Ôª





ÈÏÖ¤Â룺  ÑéÖ¤Âë,¿´²»Çå³þ?Çëµã»÷Ë¢ÐÂÑéÖ¤Âë ±ØÌî



  ÇóÖª ÎÄÕ ÎÄ¿â Lib ÊÓÆµ iPerson ¿Î³Ì ÈÏÖ¤ ×Éѯ ¹¤¾ß ½²×ù Modeler   Code  
»áÔ±   
 
   
 
 
     
   
 ¶©ÔÄ
  ¾èÖú
SEAndroid°²È«»úÖÆ¼òÒª½éÉܺÍѧϰ¼Æ»®
 
×÷Õß ÉÆË¼ÉÆÑ§µÄBLOG£¬»ðÁú¹ûÈí¼þ    ·¢²¼ÓÚ 2014-09-15
  3039  次浏览      29
 

ÓëiOSÏà±È£¬Android×î±»ÈËÚ¸²¡µÄÊÇÆäÁ÷³©ÐԺͰ²È«ÐÔ¡£È»¶ø£¬´Ó4.0¿ªÊ¼£¬Android²»ÒÅÓàÁ¦µØ¸ÄÉÆÆäÁ÷³©ÐÔ¡£ÌرðÊÇÔÚ¼´½«·¢²¼µÄL°æ±¾ÖУ¬ÓÃARTÌæ»»ÁËDalvik£¬ÏàÐÅ»áÔ½À´Ô½Á÷³©¡£ÖÁÓÚ°²È«ÐÔ£¬AndroidҲûÓÐÒÅÍü¡£´Ó4.3¿ªÊ¼£¬AndroidÒýÈëÁËÒ»Ì×»ùÓÚSELinuxµÄ°²È«»úÖÆ£¬³ÆÎªSEAndroid£¬À´¼Óǿϵͳ°²È«ÐÔ¡£½ÓÏÂÀ´ÎÒÃǾͶÔSEAndroid½øÐмòÒª½éÉܺÍÖÆ¶¨Ñ§Ï°¼Æ»®¡£

ÔÚ½éÉÜSEAndroid°²È«»úÖÆÖ®Ç°£¬ÎÒÃÇÒªÏÈÁ˽âÒ»ÏÂAndroidµ±Ç°Ëù²ÉÓõݲȫ»úÖÆÊÇʲô¡£Êµ¼ÊÉÏ£¬ÔÚÇ°Ãæ´ÓNDKÔÚ·ÇRootÊÖ»úÉϵĵ÷ÊÔÔ­Àí̽ÌÖAndroidµÄ°²È«»úÖÆÒ»ÎÄÖУ¬ÎÒÃÇÒѾ­½éÉܹýAndroidϵͳµÄ°²È«»úÖÆÁË¡£Òò´Ë£¬ÕâÀïÖ÷ÒªÊǽøÐÐÒ»ÏÂ×ܽᡣ

ÔÚÒý½øSEAndroid°²È«»úÖÆÖ®Ç°£¬AndroidϵͳµÄ°²È«»úÖÆ·ÖΪӦÓóÌÐòºÍÄÚºËÁ½¸ö¼¶±ð¡£Ó¦ÓóÌÐò¼¶±ðµÄ°²È«»úÖÆ¾ÍÊÇÎÒÃÇͨ³£ËµµÄPermission»úÖÆ¡£Ò»¸öÓ¦ÓÃÈç¹ûÐèÒª·ÃÎÊһЩϵͳÃô¸Ð»òÕßÌØÈ¨×ÊÔ´£¬ÄÇô¾Í±ØÐëÒªÔÚAndroidManifest.xmlÅäÖÃÎļþÖнøÐÐÉêÇ룬²¢ÇÒÔÚ°²×°µÄʱºòÓÉÓû§¾ö¶¨ÊÇ·ñ¸³ÓèÏàÓ¦µÄȨÏÞ¡£Ó¦Óð²×°¹ýºó£¬Ò»°ãÊÇͨ¹ýϵͳ·þÎñÀ´¼ä½ÓʹÓÃϵͳÃô¸Ð»òÕßÌØÈ¨×ÊÔ´µÄ¡£ÕâÑùϵͳ·þÎñÔÚ´ú±íÓ¦ÓÃʹÓÃÕâЩ×ÊԴ֮ǰ£¬¾Í»áÏȼì²éÓ¦ÓÃ֮ǰÊÇ·ñÒѾ­ÉêÇë¹ýÏàÓ¦µÄȨÏÞ¡£Èç¹ûÒѾ­ÉêÇë¹ý£¬ÄÇô¾ÍÖ±½Ó·ÅÐУ¬·ñÔòµÄ»°£¬¾Í¾Ü¾øÖ´ÐС£

Äں˼¶±ðµÄ°²È«»úÖÆ¾ÍÊÇ´«Í³µÄLinux UID/GID»úÖÆ¡£ÔÚLinuxÖУ¬Ã¿Ò»¸öÓû§¶¼ÓµÓÐÒ»¸öÓû§ID£¬²¢ÇÒÒ²ÓÐÒ»¸öÓû§×éID£¬·Ö±ð¼ò³ÆÎªUIDºÍGID¡£´ËÍ⣬LinuxϵͳµÄ½ø³ÌºÍÎļþÒ²ÓÐUIDºÍGIDµÄ¸ÅÄî¡£Linux¾ÍÊÇͨ¹ýÓû§¡¢½ø³Ì¡¢ÎļþµÄUID/GIDÊôÐÔÀ´½øÐÐȨÏÞ¹ÜÀíµÄ¡£

ÎÒÃÇÖªµÀ£¬µ±LinuxÄÚºËÆô¶¯Íê³ÉÖ®ºó£¬Æô¶¯µÄµÚÒ»¸ö½ø³Ì³ÆÎªinit½ø³Ì¡£Init½ø³Ì½Ó×Å»áÆô¶¯Ò»¸ölogin½ø³Ì£¬µÈ´ýÓû§ÊäÈëÓû§ÃûºÍÃÜÂëµÇ¼¡£Ò»µ©µÇ¼³É¹¦£¬¾Í»áÆô¶¯Ò»¸öshell½ø³Ì¡£Ö®ºóÕâ¸öshell½ø³Ì¾Í¸ºÔðÖ´ÐÐÓû§µÄÃüÁî¡£×¢Ò⣬ÔÚÉÏÊöÆô¶¯¹ý³ÌÖУ¬init½ø³ÌÊÇÒÔrootÓû§Éí·ÝÆô¶¯µÄ£¬Ò²¾ÍÊÇinit½ø³ÌµÄUIDÊÇ0£¬¼´root¡£ÔÚĬÈÏÇé¿öÏ£¬ÓÉinit½ø³ÌÆô¶¯µÄËùÓнø³Ì£¬Ò²¾ÍÊÇfork³öÀ´µÄËùÓÐ×Ó½ø³Ì£¬Ò²Í¬ÑùÊÇÒÔrootÉí·ÝÔËÐеġ£Òò´Ë¡£¸ºÔðµÇ¼µÄlogin½ø³ÌµÄUIDÒ²ÊÇ0¡£µ«ÊÇ£¬µ±Óû§ÊäÈëÓû§ÃûºÍÃÜÂ룬²¢ÇҵǼ³É¹¦ºó£¬ËùÆô¶¯µÄshell½ø³Ì¾Í²»ÔÙÊÇrootÁË£¬¶øÊdzɹ¦µÇÈëϵͳµÄÓû§¡£ÕâÊÇÈçºÎ×öµ½µÄÄØ£¿Ô­À´£¬¾ßÓÐrootȨÏ޵Ľø³Ì¿ÉÒÔͨ¹ýϵͳ½Ó¿ÚsetuidÀ´¸Ä±ä×Ô¼ºÉí·Ý¡£Ò²¾ÍÊÇ˵£¬ÓÉlogin½ø³ÌÆô¶¯µÄÓû§shell½ø³ÌÔÚ¿ªÊ¼µÄʱºòµÄÉí·ÝÆäʵҲÊÇrootµÄ£¬²»¹ýÔÚËü¿ÉÒÔÖ´ÐÐÓû§µÄÃüÁî֮ǰ£¬ËüÒѾ­Í¨¹ýsetuid½«×Ô¼ºµÄUIDÐÞ¸ÄΪµÇ¼Óû§¶ÔÓ¦µÄUIDÁË¡£ÕâÑù¾Í¿ÉÒÔÏÞÖÆÃ¿Ò»¸ö³É¹¦µÇÈëϵͳµÄÓû§µÄȨÏÞ¡£

Óû§Ö®ºóÔÚshell½ø³ÌÖÐÖ´Ðеĸ÷ÖÖÃüÁҪôÊÇÔÚ±¾½ø³ÌÖÐÖ´ÐУ¬ÒªÃ´ÔÚÆô¶¯µÄ×Ó½ø³ÌÖÐÖ´ÐС£×¢Ò⣬¸ù¾ÝÎÒÃÇÉÏÃæµÄ·ÖÎö£¬ÓÉÓû§shell½ø³ÌÆô¶¯µÄ×Ó½ø³ÌͬÑùÊÇÒԵǼÓû§µÄÉí·ÝÔËÐе쬲¢ÇÒÕâЩ½ø³ÌÔÚÔËÐеĹý³ÌÖÐËù´´½¨µÄÎļþµÄĬÈÏUIDºÍGIDÒ²ÊǺ͵ǼÓû§µÄUIDºÍGIDÒ»Öµģ¬²¢ÇÒÕâЩÎļþÖ»¿ÉÒÔ±»Óû§×Ô¼º·ÃÎÊ¡£Èç¹ûÒ»¸öÓû§Ï뽫һЩ×Ô¼º´´½¨µÄÎļþ½»¸øÁíÍâÒ»¸öÓû§·ÃÎÊ£¬ÄÇôӦ¸ÃÔõô°ìÄØ£¿Linux½«ÎļþµÄȨÏÞ»®·ÖΪ¶Á¡¢Ð´ºÍÖ´ÐÐÈýÖÖ£¬·Ö±ðÓÃ×Öĸr¡¢wºÍx±íʾ¡£Ã¿Ò»¸öÎļþÓÐÈý×é¶Á¡¢Ð´ºÍÖ´ÐÐȨÏÞ£¬·Ö±ðÊÇÕë¶ÔÎļþµÄËùÓÐÕß¡¢ÎļþËùÓÐÕßËùÊôµÄ×éÒÔ¼°³ýÁËËùÓÐÕßÒÔ¼°ÔÚËùÓÐÕßËùÊô×éµÄÓû§Ö®ÍâËùÓÐÆäËüÓû§¡£ÕâÑù£¬Èç¹ûÒ»¸öÓû§ÏëÒª½«Ò»¸ö×Ô¼º´´½¨µÄÎļþ½»¸øÁíÍâÒ»¸öÓû§·ÃÎÊ£¬ÄÇôֻÐèÒªÏàÓ¦µØÉèÖÃÒ»ÏÂÕâ¸öÎļþµÄÆäËüÓû§È¨ÏÞλ¾Í¿ÉÒÔÁË¡£

ÎÒÃÇÖªµÀ£¬AndroidÊÇÒ»¸ö»ùÓÚLinuxÄں˵Äϵͳ£¬µ«ÊÇËü²»Ïñ´«Í³µÄLinuxϵͳ£¬ÐèÒªÓû§µÇ¼֮ºó²ÅÄÜʹÓá£È»¶ø£¬AndroidϵͳÓÖÏñ´«Í³µÄLinuxϵͳһÑùÓÐÓû§µÄ¸ÅÄî¡£Ö»²»¹ýÕâЩÓû§²»ÐèÒªµÇ¼£¬Ò²¿ÉÒÔʹÓÃAndroidϵͳ¡£¾ßÌåÀ´Ëµ£¬¾ÍÊÇAndroidϵͳ½«Ã¿Ò»¸ö°²×°ÔÚϵͳµÄAPK¶¼Ó³ÉäΪһ¸ö²»Í¬µÄLinuxÓû§¡£Ò²¾ÍÊÇ˵£¬Ã¿Ò»¸öAPK¶¼ÓÐÒ»¸ö¶ÔÓ¦µÄUIDºÍGID¡£ÕâЩUIDºÍGIDÊÇÔÚAPK°²×°µÄʱºòÓÉϵͳ°²×°·þÎñPackageManagerService·ÖÅäµÄ¡£

ÎÒÃÇÖªµÀ£¬APKËùÔËÐÐÔڵĽø³ÌÊÇÓÉÁíÍâÒ»¸öϵͳ·þÎñActivityManagerService¸ºÔðÆô¶¯µÄ¡£ActivityManagerServiceÔÚÆô¶¯APK½ø³Ì֮ǰ£¬»áÏÈÏòPackageManagerService²éѯAPK°²×°Ê±·ÖÅäµ½µÄUIDºÍGID¡£ÓÐÁËAPKµÄUIDºÍGIDºó£¬ActivityManagerService¾ÍÏòÁíÍâÒ»¸öÒÔrootÉí·ÝÔËÐеÄzygote½ø³Ì·¢³ö´´½¨APK½ø³ÌµÄÇëÇó¡£Zygote½ø³ÌÊÕµ½ÇëÇóÖ®ºó£¬¾Í»áfork³öÒ»¸ö×Ó½ø³ÌÀ´×÷ΪÇëÇó´´½¨µÄAPK½ø³Ì¡£APK½ø³ÌµÄ´´½¨¹ý³ÌµÄÏêϸ·ÖÎö¿ÉÒԲο¼AndroidÓ¦ÓóÌÐò½ø³ÌÆô¶¯¹ý³ÌµÄÔ´´úÂë·ÖÎöÒ»ÎÄ¡£

×¢Ò⣬ÎÒÃÇÉÏÃæÌáµ½£¬zygote½ø³ÌÊÇÒÔrootÉí·ÝÔËÐеġ£Òò´Ë£¬Ëüfork³öÀ´µÄ×Ó½ø³Ì£¬Ò²¾ÍÊÇAPK½ø³Ì£¬ÔÚÒ»¿ªÊ¼µÄʱºòÒ²ÊÇÒÔrootÉí·ÝÔËÐеġ£²»¹ý£¬APK½ø³ÌÔÚ¿ÉÒÔÖ´ÐÐAPK´úÂë֮ǰ£¬»áͨ¹ýϵͳ½Ó¿Úsetuid½«×Ô¼ºµÄUIDÉèÖÃΪAPK°²×°Ê±·ÖÅäµ½µÄUID¡£Õâ¸ö¹ý³ÌÓ봫ͳµÄLinuxϵͳͨ¹ýlogin½ø³ÌÆô¶¯Óû§shell½ø³ÌµÄ¹ý³Ì·Ç³£ÀàËÆ¡£Í¨¹ýÕâÖÖ·½Ê½£¬¾Í¿ÉÒÔ±£Ö¤Ã¿Ò»¸öAPK½ø³Ì¶¼ÒÔ²»Í¬µÄÉí·ÝÀ´ÔËÐУ¬´Ó¶ø±£Ö¤ÁËÏ໥֮¼ä²»»áÊܵ½¸ÉÈÅ¡£Õâ¾ÍÊÇËùνµÄɳÏäÁË£¬ÕâÍêÈ«Êǽ¨Á¢ÔÚLinuxµÄUIDºÍGID»ù´¡Éϵġ£

ÒÔÉÏ·ÖÎöµÄUID/GID»úÖÆ¿ÉÒÔͨ¹ýͼ1À´ÃèÊö£º

ͼ1 Androidϵͳ»ùÓÚUID/GIDµÄ°²È«»úÖÆ

ÕâÖÖ»ùÓÚLinux UID/GIDµÄ°²È«»úÖÆ´æÔÚʲôÑùµÄÎÊÌâÄØ£¿×¢ÒâÎÒÃÇÇ°ÃæÌáµ½µÄ£¬µ±Ò»¸öÓû§Ï뽫ÊÚÓèÁíÍâÒ»¸öÓû§·ÃÎÊ×Ô¼º´´½¨µÄÎļþµÄʱºò£¬ËüÖ»ÐèÒªÐÞ¸ÄһϸÃÎļþµÄ·ÃÎÊȨÏÞλ¾ÍÐÐÁË¡£Ò²¾ÍÊÇ˵£¬ÔÚLinuxϵͳÖУ¬ÎļþµÄȨÏÞ¿ØÖÆÔÚËùÓÐÕßµÄÊÖÖС£Òò´Ë£¬ÕâÖÖȨÏÞ¿ØÖÆ·½Ê½¾Í³ÆÎª×ÔÖ÷ʽµÄ£¬ÕýʽµÄÓ¢ÎÄÃû³ÆÎªDiscretionary Access Control£¬¼ò³ÆÎªDAC¡£

ÔÚÀíÏëÇé¿öÏ£¬DAC»úÖÆÊÇûÓÐÎÊÌâµÄ¡£È»¶ø£¬ÔÚÏÖʵÖУ¬»á²úÉúÑÏÖØµÄ°²È«ÎÊÌâ¡£ÀýÈ磬һ¸öÓû§¿ÉÄܻ᲻СÐĽ«×Ô¼º´´½¨µÄÎļþµÄȨÏÞλ´íÎóµØÐÞ¸ÄΪÔÊÐíÆäËüÓû§·ÃÎÊ¡£Èç¹ûÕâ¸öÓû§ÊÇÒ»¸öÌØÈ¨Óû§£¬²¢ÇÒËü´íÎó²Ù×÷µÄÎļþÊÇÒ»¸öÃô¸ÐµÄÎļþ£¬ÄÇô¾Í»á²úÉúÑÏÖØµÄ°²È«ÎÊÌâ¡£ÕâÖÖÎó²Ù×÷µÄ²úÉú·½Ê½ÓÐÈýÖÖ£º

1. Óû§Ö´ÐÐÁË´íÎóµÄÃüÁî

2. ¸ºÔðÖ´ÐÐÓû§ÃüÁîµÄ³ÌÐòÓÐBUG

3. ¸ºÔðÖ´ÐÐÓû§ÃüÁîµÄ³ÌÐòÊܵ½¹¥»÷

Óɴ˿ɼû£¬DAC»úÖÆÖ»ÄÜÔÚÀíÏëÇé¿öÏÂûÓÐÎÊÌ⣬µ«ÊÇÔÚÏÖʵÖÐÊÇ·À²»Ê¤·À£¡ÀýÈ磬GingerBreak©¶´¾ÍÊÇͨ¹ý¹¥»÷ÒÔrootÉí·ÝÔËÐÐAndroid´ÅÅ̹ÜÀíÊØ»¤½ø³ÌvoldÀ´»ñµÃrootȨÏÞ£¬´Ó¶øÊµÏÖ¶ÔÉ豸½øÐÐrootµÄ¡£

×¢Ò⣬ÉÏÃæÎÒÃÇ˵µÄDACÎÊÌâËäÈ»ÊÇÕë¶ÔÄں˼¶±ðµÄLinux UID/GID»úÖÆ£¬È»¶øÍ¬ÑùÊÊÓÃÓÚÓ¦Óü¶±ðµÄPermission»úÖÆ¡£Õâ¸öÎÊÌâͨ¹ýMasterKey©¶´±íÏÖµÃÁÜÀ쾡Ö¡£ÎÒÃÇÖªµÀ£¬MasterKey©¶´¿ÉÒÔÔÚ²»¸Ä±äÇ©ÃûµÄÇé¿ö϶ÔAPK½øÐд۸ġ£Õâ»áµ¼ÖÂʲôºó¹ûÄØ£¿¼ÙÈç±»´Û¸ÄµÄAPKÉêÇëÓÐÌØÊâµÄPermission£¬ÄÇô¾ÍÒâζ×ÅǶÈëµÄ¶ñÒâ´úÂë¿ÉÒÔÈÎÒâµØÊ¹ÓÃÕâÐ©ÌØÊâµÄPermission¡£

¸üΪÑÏÖØµÄÊDZ»´Û¸ÄµÄAPKÊÇÒ»¸öϵͳAPK¡£AndroidϵͳµÄPermission·ÖΪÁ½ÖÖ£¬Ò»ÖÖÊÇËùÓÐAPK¶¼¿ÉÒÔÉêÇëµÄ£¬ÁíÒ»ÖÖÊÇϵͳAPK²Å¿ÉÒÔÉêÇëµÄ¡£Ö»ÓÐϵͳAPK²Å¿ÉÒÔÉêÇëµÄPermission¸üΪÃô¸Ð£¬ÀýÈçÓÃÀ´°²×°APKµÄPermission--android.permission.INSTALL_PACKAGES¡£ÕâÒâζ×ÅÒ»¸ö¾ßÓÐandroid.permission.INSTALL_PACKAGESµÄϵͳAPK±»´Û¸Äºó£¬¶ñÒâ´úÂë¾Í¿ÉÒÔÔÚÉ豸Éϰ²×°ÈÎÒâµÄ¶ñÒâAPKÁË¡£

ÊÂʵÉÏ£¬Ó¦Óü¶±ðµÄPermission»úÖÆÒ²Êǽ¨Á¢ÔÚLinux UID/GID»ù´¡Éϵġ£µ±ÎÒÃÇÔÚAPKµÄAndroidManfest.xmlÅäÖÃÎļþÖÐÉêÇëijһ¸öPermissionµÄʱºò£¬AndroidϵͳµÄ°²×°·þÎñPackageManagerService³ýÁË»á¼Ç¼ËüÉêÇëÓÐÏàÓ¦µÄPermissionÖ®Í⣨ÒÔ±ãAPKµ÷ÓÃÐèҪȨÏÞµÄAPI½Ó¿Úʱ½øÐÐÑéÖ¤£©£¬»¹»á½«APK¼ÓÈëµ½ÏàÓ¦µÄij¸öLinuxÓû§×éÈ¥¡£ÕâÊÇÒòΪÔÚAndroidϵͳÖУ¬²¢²»ÊÇËùÓеÄÌØÈ¨²Ù×÷¶¼ÊǼä½ÓµØÍ¨¹ýϵͳ·þÎñÀ´Ö´Ðеģ¬ÀýÈçÍøÂç·ÃÎÊ¡£Ò»µ©Ò»¸öAPKÉêÇëÍøÂç·ÃÎʵÄPermission£¬ÄÇôËü¾Í»á¼ÓÈëµ½LinuxµÄÍøÂçÓû§×éÈ¥£¬ÕâʱºòAPK¾Í¿ÉÒÔͨ¹ý´´½¨socketÀ´·ÃÎÊÍøÂçÁË¡£

ÕâÑù£¬ÔÚAndroidϵͳÖУ¬ÎÞÂÛÊÇÓ¦Óü¶±ðµÄPermission»úÖÆ£¬»¹ÊÇÄں˼¶±ðµÄLinux UID/GID»úÖÆ£¬¶¼Í¬Ñù»áÊܵ½DACÎÊÌâµÄÀ§ÈÅ¡£ÕâʱºòÎÒÃǾÍÐèÒªÒ»ÖÖ¸üΪǿÓÐÁ¦µÄ°²È«»úÖÆÀ´±£Ö¤ÏµÍ³µÄ°²È«¡£

ÔÚ·ÃÎÊ¿ØÖÆÄ£ÐÍÖУ¬ÓëDAC»úÖÆÏà¶ÔµÄÊÇMAC»úÖÆ¡£MACµÄÈ«³ÆÊÇMandatory Access Control£¬·­ÒëÎªÇ¿ÖÆ·ÃÎÊ¿ØÖÆ¡£ÔÚMAC»úÖÆÖУ¬Óû§¡¢½ø³Ì»òÕßÎļþµÄȨÏÞÊÇÓɹÜÀí²ßÂÔ¾ö¶¨µÄ£¬¶ø²»ÊÇÓÉËüÃÇ×ÔÖ÷¾ö¶¨µÄ¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔÉ趨ÕâÑùµÄÒ»¸ö¹ÜÀí²ßÂÔ£¬²»ÔÊÐíÓû§A½«Ëü´´½¨µÄÎļþFÊÚÓèÓû§B·ÃÎÊ¡£ÕâÑùÎÞÂÛÓû§AÈçºÎÐÞ¸ÄÎļþFµÄȨÏÞ룬Óû§B¶¼ÊÇÎÞ·¨·ÃÎÊÎļþFµÄ¡£ÕâÖÖ°²È«·ÃÎÊÄ£ÐÍ¿ÉÒÔÇ¿ÓÐÁ¦µØ±£»¤ÏµÍ³µÄ°²È«¡£ÎÒÃÇÔÚÕâ¸öϵÁеÄÎļþÖÐÒª½éÉܵÄSEAndroid¾ÍÊÇÒ»ÖÖMAC»úÖÆ¡£

ÔÚSEAndroidÖУ¬Ã¿Ò»¸ö½ø³ÌºÍÎļþ¶¼»á¹ØÁªÓÐÒ»¸ö°²È«ÉÏÏÂÎÄ¡£Õâ¸ö°²È«ÉÏÏÂÎÄÓÉÓû§¡¢½ÇÉ«¡¢ÀàÐÍ¡¢°²È«¼¶±ðËĸö²¿·Ö×é³É£¬Ã¿Ò»²¿·Öͨ¹ýÒ»¸öðºÅÀ´·Ö¸ô¡£ÀýÈ磬u:r:t:s0ÃèÊöµÄ¾ÍÊÇÒ»¸öSEAndroid°²È«ÉÏÏÂÎÄ¡£µ±Ã¿Ò»¸ö½ø³ÌºÍÎļþ¶¼¹ØÁªÉÏÒ»¸ö°²È«ÉÏÏÂÎÄÖ®ºó£¬ÏµÍ³¹ÜÀíÔ±¾Í¿ÉÒÔ»ùÓÚÕâЩ°²È«ÉÏÏÂÎÄÖÆ¶¨Ò»¸ö°²È«·ÃÎʲßÂÔ£¬ÓÃÀ´¹æ¶¨Ê²Ã´ÑùµÄ½ø³Ì¿ÉÒÔ·ÃÎÊʲôÑùµÄÎļþ¡£

ÉÏÃæÃèÊöµÄSEAndroid°²È«»úÖÆÈçͼ2Ëùʾ£º

ͼ2 SEAndroid°²È«»úÖÆ

ÔÚͼ2ÖУ¬ºìÉ«±ê×¢µÄ¼´ÎªSEAndroid°²È«ÉÏÏÂÎÄ¡£ÆäÖУ¬u:r:unstructed_app:s0ÃèÊöµÄÊÇÓû§°²×°µÄAPKËùÔËÐÐÔڵĽø³ÌµÄ°²È«ÉÏÏÂÎÄ£¬¶øu:object_r:app_data_file:s0ÃèÊöµÄÊÇÓû§°²×°µÄAPKÔÚÔËÐйý³ÌÖÐÉú³ÉµÄÊý¾ÝÎļþµÄ°²È«ÉÏÏÂÎÄ¡£

´Óͼ2»¹¿ÉÒÔ¿´µ½£¬SEAndroid°²È«»úÖÆÓ봫ͳµÄLinux UID/GID°²È«»úÖÆÊDz¢´æ¹ØÏµµÄ£¬Ò²¾ÍÊÇ˵£¬ËüÃÇͬʱÓÃÀ´Ô¼Êø½ø³ÌµÄȨÏÞ¡£µ±Ò»¸ö½ø³Ì·ÃÎÊÒ»¸öÎļþµÄʱºò£¬Ê×ÏÈҪͨ¹ý»ùÓÚUID/GIDµÄDAC°²È«¼ì²é£¬½Ó×ŲÅÓÐ×ʸñ½øÈëµ½»ùÓÚSEAndroidµÄMAC°²È«¼ì²é¡£Ö»ÒªÆäÖеÄÒ»¸ö¼ì²é²»Í¨¹ý£¬ÄÇô½ø³Ì·ÃÎÊÎļþµÄÇëÇó¾Í»á±»¾Ü¾ø¡£ÉÏÊöµÄ°²È«¼ì²é¹ý³ÌÈçͼ3Ëùʾ£º

ͼ3 »ùÓÚLinux UID/GIDºÍSEAndroidµÄ°²È«·ÃÎÊÁ÷³Ì

ÎÒÃÇͨ¹ýÒ»¸öÀý×ÓÀ´ËµÃ÷ÉÏÊöµÄ°²È«·ÃÎÊÁ÷³Ì¡£µ±ÎÒÃÇÏë´ÓÊÖ»úÉÏÏÂÔØÒ»¸öÎļþµ½µçÄÔÉÏʱ£¬ÎÒÃÇʹÓÃadb pullÃüÁîÀ´ÊµÏÖ¡£µ±ÎÒÃÇÖ´ÐÐadb pullÃüÁîµÄʱºò£¬Êµ¼ÊÉÏÊÇÓÉÊÖ»úÉϵÄÊØ»¤½ø³ÌadbdÀ´¶Á³öÖ¸¶¨µÄÎļþ£¬²¢ÇÒ½«¶Á³öÀ´µÄÄÚÈÝ·¢Ë͸øÔÚµçÄÔÉÏÔËÐеÄadb½ø³ÌµÄ¡£½ÓÏÂÀ´£¬ÎÒÃǾͰ´ÕÕÒÔϲ½Öè³¢ÊÔ´ÓÆôÓÃÁËSEAndroidµÄÈýÐÇNote IIÉÏÏÂÔØÎļþ/system/bin/gpsdµ½µçÄÔÉÏÀ´¡£

1. Ö´ÐÐls -lÃüÁî¼ì²éÊÖ»úÉÏ´æÔÚ/system/bin/gpsdÎļþ£¬ÒÔ¼°Ëü»ùÓÚ´«Í³µÄLinux UID/GIDµÄȨÏÞλ£º

$ ./adb shell ls -l /system/bin/gpsd  
-rwxr-xr-x root shell 2822268 2014-02-11 03:27 gpsd

´ÓÃüÁîµÄÊä³ö¿ÉÒÔ¿´µ½£¬Èç¹ûÖ»¿¼ÂÇ´«Í³µÄLinux UID/GID°²È«»úÖÆ£¬ÊÖ»úÉϵÄ/system/bin/gpsdÎļþÊÇËùÓÐÓû§¾ù¿ÉÒÔ¶ÁÈ¡µÄ¡£

2. Ö´ÐÐadb pullÃüÁîÏÂÔØÊÖ»úÉϵÄ/system/bin/gpsdÎļþ£º

$ ./adb pull /system/bin/gpsd ./gpsd  
failed to copy '/system/bin/gpsd' to './gpsd': Permission denied

´ÓÃüÁîµÄÊä³ö¿ÉÒÔ¿´µ½£¬ÎÒÃÇûÓа´ÕÕÔ¤ÆÚÄÇÑù½«ÊÖ»úÉϵÄ/system/bin/gpsdÎļþÏÂÔØµçÄÔÉÏÀ´£¬Ô­ÒòÊÇ¡°Permission denied¡±£¬Ò²¾ÍÊÇȨÏÞ²»¹»¡£

3. ·Ö±ðͨ¹ýls -ZºÍps -ZÃüÁî¼ì²éÎļþ/system/bin/gpsdºÍ½ø³ÌadbdµÄ°²È«ÉÏÏÂÎÄ£º

./adb shell ls -Z /system/bin/gpsd  
-rwxr-xr-x root shell u:object_r:gpsd_exec:s0 gpsd
$ ./adb shell ps -Z | grep 'adbd'
u:r:adbd:s0 shell 1978 1 /sbin/adbd

´ÓÃüÁîµÄÊä³ö¿ÉÒÔ¿´µ½£¬Îļþ/system/bin/gpsdµÄ°²È«ÉÏÏÂÎÄΪu:object_r:gpsd_exec:s0£¬¶ø½ø³ÌadbdµÄ°²È«ÉÏÏÂÎÄΪu:r;adbd:s0£¬Òò´ËÎÒÃÇ¿ÉÒԶ϶¨£¬ÔÚÈýÐÇNote IIÔËÐеÄϵͳÉÏ£¬Ò»¶¨´æÔÚÒ»¸ö·ÃÎʲßÂÔ²»ÔÊÐí°²È«ÉÏÏÂÎÄΪu:r;adbd:s0µÄ½ø³Ì·ÃÎʰ²È«ÉÏÏÂÎÄΪu:object_r:gpsd_exec:s0µÄÎļþ¡£

´ÓÉÏÃæÕâ¸öÀý×ӾͿÉÒÔ¿´³ö£¬ÔÚÆôÓÃSEAndroid֮ǰ£¬Ô­±¾¿ÉÒÔ·ÃÎʵÄÎļþ£¬µ½ÆôÓÃSEAndroidÖ®ºó£¬¾Í±äµÃ²»¿ÉÒÔ·ÃÎÊÁË£¡Èç¹ûÎÒÃÇȷʵÊÇÐèÒª·ÃÎÊÕâЩÎļþ£¬ÀýÈçÎÒÃÇÐèÒª½«ÕâЩÎļþ´ò°üÔÚÎÒÃÇ×Ô¼ºÖÆ×÷ROMÀïÃæ£¬ÄÇôÓÐûÓÐÆäËü°ì·¨·ÃÎÊÄØ£¿µ±¶ÁÍêSEAndroid°²È«»úÖÆÕâ¸öϵÁеÄÎÄÕÂÖ®ºó£¬Äã¾Í»á·¢ÏÖ´ð°¸Êǿ϶¨µÄ£¬²¢ÇÒÊÇÔÚ×ñÑ­SEAndroid°²È«²ßÂÔµÄǰÌáÏÂʵÏֵģ¡

¹ØÓÚSEAndroid°²È«»úÖÆ£¬»¹ÓÐÒ»¸ö¹Ø¼üµãÊÇÖµµÃÌá¼°µÄ¡£ÄǾÍÊÇSEAndroid°²È«»úÖÆµÄÄ¿µÄ²»ÊÇΪÁËÍêÈ«¶Å¾ø±ðÈ˹¥»÷ÎÒÃǵÄÉ豸£¬¶øÊÇΪÁ˱£Ö¤ÎÒÃǵÄÉ豸Êܵ½¹¥»÷ʱ£¬Êܵ½µÄË𺦼õÉÙµ½×îÉٵij̶ȡ£ÀýÈ磬SEAndroid°²È«»úÖÆ²¢²»ÄÜÍêÈ«×èÖ¹ÎÒÃǵÄÉ豸±»root£¬µ«ÊÇËüÄܱ£Ö¤ÎÒÃǵÄÉ豸±»rootÖ®ºó£¬Ò»Ð©Ãô¸ÐµÄÎļþÈÔÈ»ÊDz»¿É·ÃÎÊ£¬ÕâÑù¾Í¿ÉÒÔ×î´ó³Ì¶ÈµØ±£»¤ÎÒÃǵÄÉ豸¡£ÕâÊÇÒòΪֻҪ³ÌÐòÊÇÓÉÈËÀàÀ´±àдµÄ£¬¾Í»ò¶à»òÉٵشæÔÚBUG£¬»òÕß˵©¶´£¬ÌرðÊǸ´ÔӵijÌÐò£¬½ø¶ø¾Í»á±»ºÚ¿ÍÀûÓ㬲¢Çҳɹ¦µØÇÖÈëµ½ÎÒÃǵÄϵͳÖÐÀ´¡£ÕâÊÇ·À²»Ê¤·ÀµÄ¡£µ±È»£¬ÎÒÃDz¢²»ÊÇ˵SEAndroid¶Ô×èÖ¹É豸±»ÇÖÈëºÁÎÞÓô¦£¬ËüÔÚÒ»¶¨³Ì¶ÈÉÏ»¹ÊÇÄܼӴóÇÖÈëµÄ¼¼ÊõÄѶȵġ£

ÓÉÓÚSEAndroidµÄÄÚÈݺܶ࣬×㹻дһ±¾ºÜºñºÜºñµÄÊéÀ´ÃèÊö£¬µ«ÊÇÔÚ½ÓÏÂÀ´µÄÎÄÕÂÖУ¬ÀÏÂÞ²¢²»´òËãÖðÒ»ÖðÒ»µØ½éÉÜ£¬¶øÊÇÖ÷Ҫץס¹Ø¼ü²¿·Ö½øÐÐÏêϸµÄ·ÖÎö£¬Òò´ËÏ£ÍûͬѧÃÇÔÚ¼ÌÐøÑ§Ï°½ÓϵÄÎÄÕÂ֮ǰ£¬¿ÉÒÔ¶Á¶ÁÒÔϵÄÒ»±¾ÊéÒÔ¼°Ò»ÆªÂÛÎÄ£º

1. SELinux by Example - Using Security Enhanced Linux

2. Security Enhanced (SE) Android: Bringing Flexible MAC to Android

ÊÂʵÉÏ£¬½ÓÏÂÀ´½éÉÜSEAndroidµÄÎÄÕ¶¼ÊÇ»ùÓÚÉÏÃæµÄÂÛÎÄÀ´Security Enhanced (SE) Android: Bringing Flexible MAC to AndroidÕ¹¿ªµÄ£¬Ä¿µÄÊÇ´ÓAndroidϵͳԴÂë·ÖÎöµÄ½Ç¶ÈÀ´²ûÊö¸ÃÂÛÎĵÄÄÚÈÝ¡£

ºÃÁË£¬·Ï»°²»ËµÁË¡£½ÓÏÂÀ´ÎÒÃǾͰ´ÕÕÒÔϵÄÇé¾°À´ÉîÈëѧϰSEAndroid°²È«»úÖÆ£º

1. SEAndroid°²È«»úÖÆ¿ò¼Ü·ÖÎö

2. SEAndroid°²È«»úÖÆµÄÎļþ°²È«ÉÏÏÂÎÄ·ÖÎö

3. SEAndroid°²È«»úÖÆµÄ½ø³Ì°²È«ÉÏÏÂÎÄ·ÖÎö

4. SEAndroid°²È«»úÖÆµÄBinde IPC±£»¤Ö§³Ö·ÖÎö

5. SEAndroid°²È«»úÖÆµÄProperty±£»¤Ö§³Ö·ÖÎö

Ï£Íûͨ¹ýÕâÎå¸öÇé¾°µÄ·ÖÎö£¬Ê¹µÃÎÒÃǶÔAndroidϵͳµÄ°²È«»úÖÆÓÐÒ»¸öÉî¿ÌµÄÈÏʶ£¬ÒÔ°ïÖúÎÒÃǸüºÃµØ±£»¤ÊÖ»úÉϵÄÒþ˽ºÍÊý¾Ý£¬¾´Çë¹Ø×¢£¡

   
3039 ´Îä¯ÀÀ       29
 
Ïà¹ØÎÄÕÂ

ÊÖ»úÈí¼þ²âÊÔÓÃÀýÉè¼ÆÊµ¼ù
ÊÖ»ú¿Í»§¶ËUI²âÊÔ·ÖÎö
iPhoneÏûÏ¢ÍÆËÍ»úÖÆÊµÏÖÓë̽ÌÖ
AndroidÊÖ»ú¿ª·¢£¨Ò»£©
 
Ïà¹ØÎĵµ

Android_UI¹Ù·½Éè¼Æ½Ì³Ì
ÊÖ»ú¿ª·¢Æ½Ì¨½éÉÜ
androidÅÄÕÕ¼°ÉÏ´«¹¦ÄÜ
Android½²ÒåÖÇÄÜÊÖ»ú¿ª·¢
Ïà¹Ø¿Î³Ì

Android¸ß¼¶Òƶ¯Ó¦ÓóÌÐò
Androidϵͳ¿ª·¢
AndroidÓ¦Óÿª·¢
ÊÖ»úÈí¼þ²âÊÔ
×îл¼Æ»®
DeepSeekÔÚÈí¼þ²âÊÔÓ¦ÓÃʵ¼ù 4-12[ÔÚÏß]
DeepSeek´óÄ£ÐÍÓ¦Óÿª·¢Êµ¼ù 4-19[ÔÚÏß]
UAF¼Ü¹¹ÌåϵÓëʵ¼ù 4-11[±±¾©]
AIÖÇÄÜ»¯Èí¼þ²âÊÔ·½·¨Óëʵ¼ù 5-23[ÉϺ£]
»ùÓÚ UML ºÍEA½øÐзÖÎöÉè¼Æ 4-26[±±¾©]
ÒµÎñ¼Ü¹¹Éè¼ÆÓ뽨ģ 4-18[±±¾©]

androidÈË»ú½çÃæÖ¸ÄÏ
AndroidÊÖ»ú¿ª·¢£¨Ò»£©
AndroidÊÖ»ú¿ª·¢£¨¶þ£©
AndroidÊÖ»ú¿ª·¢£¨Èý£©
AndroidÊÖ»ú¿ª·¢£¨ËÄ£©
iPhoneÏûÏ¢ÍÆËÍ»úÖÆÊµÏÖ̽ÌÖ
ÊÖ»úÈí¼þ²âÊÔÓÃÀýÉè¼ÆÊµ¼ù
ÊÖ»ú¿Í»§¶ËUI²âÊÔ·ÖÎö
ÊÖ»úÈí¼þ×Ô¶¯»¯²âÊÔÑо¿±¨¸æ


Android¸ß¼¶Òƶ¯Ó¦ÓóÌÐò
AndroidÓ¦Óÿª·¢
Androidϵͳ¿ª·¢
ÊÖ»úÈí¼þ²âÊÔ
ǶÈëʽÈí¼þ²âÊÔ
AndroidÈí¡¢Ó²¡¢ÔÆÕûºÏ


ÁìÏÈIT¹«Ë¾ android¿ª·¢Æ½Ì¨×î¼Ñʵ¼ù
±±¾© Android¿ª·¢¼¼Êõ½ø½×
ijÐÂÄÜÔ´ÁìÓòÆóÒµ Android¿ª·¢¼¼Êõ
ijº½Ì칫˾ Android¡¢IOSÓ¦ÓÃÈí¼þ¿ª·¢
°¢¶û¿¨ÌØ LinuxÄÚºËÇý¶¯
°¬Ä¬Éú ǶÈëʽÈí¼þ¼Ü¹¹Éè¼Æ
Î÷ÃÅ×Ó Ç¶Èëʽ¼Ü¹¹Éè¼Æ