OSDN Git Service

Fix security hole in GateKeeperResponse.
authorCharles He <qiurui@google.com>
Fri, 14 Jul 2017 13:41:06 +0000 (14:41 +0100)
committerCharles He <qiurui@google.com>
Fri, 14 Jul 2017 14:36:11 +0000 (14:36 +0000)
GateKeeperResponse has inconsistent writeToParcel() and
createFromParcel() methods, making it possible for a malicious app to
create a Bundle that changes contents after reserialization. Such
Bundles can be used to execute Intents with system privileges.

This CL changes writeToParcel() to make serialization and
deserialization consistent, thus fixing the issue.

Bug: 62998805
Test: use the debug app (see bug)
Change-Id: Ie1c64172c454c3a4b7a0919eb3454f0e38efcd09

core/java/android/service/gatekeeper/GateKeeperResponse.java

index a512957..6ca6d8a 100644 (file)
@@ -85,6 +85,8 @@ public final class GateKeeperResponse implements Parcelable {
             if (mPayload != null) {
                 dest.writeInt(mPayload.length);
                 dest.writeByteArray(mPayload);
+            } else {
+                dest.writeInt(0);
             }
         }
     }