一句话:首次形式化 Android 互操作语义,并基于此提出类型系统检测混合应用中的跨语言缺陷。
Android 混合应用通过 JavaScript 与 Android Java 的无缝交互获得可移植性与设备特性,但其互操作语义文档不足且反直觉,易导致错误;已有工作缺乏形式基础。本文首次给出 Android 互操作的形式化规约:通过大量测试和 Android 源码审查识别语义,扩展现有多语言语义以刻画动态且不可区分的互操作,并逐步定义形式互操作语义,揭示多处反直觉和不一致行为。在此基础上,作者设计轻量类型系统以检测跨语言通信缺陷,并在真实 Android 混合应用中验证,相比最先进的 HybriDroid 能检出更多缺陷且更高效。
Hybrid applications (apps) have become one of the most attractive options for mobile app developers thanks to its support for portability and device-specific features. Android hybrid apps, for example, support portability via JavaScript, device-specific features via Android Java, and seamless interactions between them. However, their interoperation semantics is often under-documented and unintuitive, which makes hybrid apps vulnerable to errors. While recent research has addressed such vulnerabilities, none of them are based on any formal grounds. In this paper, we present the first formal specification of Android interoperability to establish a firm ground for understanding and reasoning about the interoperations. We identify its semantics via extensive testing and thorough inspection of Android source code. We extend an existing multi-language semantics to formally express the key features of hybrid mechanisms, dynamic and indistinguishable interoperability. Based on the extensions, we incrementally define a formal interoperation semantics and disclose its numerous unintuitive and inconsistent behaviors. Moreover, on top of the formal semantics, we devise a lightweight type system that can detect bugs due to the unintuitive inter-language communication. We show that it detects more bugs more efficiently than HybriDroid, the state-of-the-art analyzer of Android hybrid apps, in real-world Android hybrid apps.