Application patching is a promising concept for modifying the execution flow of a compiled Android application for the purpose of analyzing its implementation, mitigating flaws or adding new functionality. While traditional static application patching is computationally expensive and thus has to be carried out offline on powerful desktop machines, a dynamic approach that manipulates the data structures of the ART runtime can operate on the device directly and opens the technology to many more usage scenarios.
In this research project, we investigated the feasibility and practicality of this approach. Several existing open-source implementations were identified and analyzed with regards to their strengths and weaknesses. Based on the most reliable core components and an understanding of the implementation details of the ART runtime, we designed a custom solution for dynamically intercepting method calls in arbitrary third-party applications. The resulting software library was integrated into a full on-device application patching pipeline and successfully tested against several of the most popular applications from the Google Play Store.