Skip to main content

\(\mathbb {K}\)-Smali: An Executable Semantics for Program Verification of Reversed Android Applications

  • Conference paper
  • First Online:
Foundations and Practice of Security (FPS 2021)

Abstract

One of the main weaknesses threatening smartphone security is the abysmal lack of tools and environments that allow formal verification of application actions, thus early detection of any malicious behavior, before irreversible damage is done. In this regard, formal methods appear to be the most natural and secure way for rigorous and unambiguous specification as well as for the verification of such applications. In previous work, we proposed a formal approach to build the operational semantics of a given Android application by reverse engineering its assembly code, which we called \(Smali^+\). In this paper, we rely on the same idea and we enhance it by using a language definitional framework. We choose \(\mathbb {K}\) framework to define Smali semantics. We briefly introduce the \(\mathbb {K}\) framework. Then, we present a formal \(\mathbb {K}\) semantics of Smali code, called \(\mathbb {K}\)-Smali. Semantics includes multi-threading, threads scheduling and synchronization. The proposed semantics supports linear temporal logic model-checking that provides a suitable and comprehensive formal environment for checking a wide range of Android security-related properties.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 49.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 64.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Mcafee mobile threat report (2020). https://www.mcafee.com/content/dam/consumer/en-us/docs/2020-Mobile-Threat-Report.pdf

  2. Stefanescu, A., Park, D., Yuwen, S., Li, Y., Rosu, G.: Semantics-based program verifiers for all languages. In: Visser, E., Smaragdakis, Y., (eds.), Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2016, part of SPLASH 2016, Amsterdam, The Netherlands, 30 October–4 November 2016, pp. 74–91. ACM (2016)

    Google Scholar 

  3. Rosu, G., Serbanuta, T.-F.: An overview of the K semantic framework. J. Log. Algebraic Methods Program. 79(6), 397–434 (2010)

    Article  MathSciNet  Google Scholar 

  4. Ziadia, M., Fattahi, J., Mejri, M., Pricop, E.: Smali+: an operational semantics for low-level code generated from reverse engineering android applications. Information 11(3), 130 (2020)

    Article  Google Scholar 

  5. Bae, K., Meseguer, J.: Model checking linear temporal logic of rewriting formulas under localized fairness. Sci. Comput. Program. 99, 193–234 (2015)

    Article  Google Scholar 

  6. Goranko, V., Rumberg, A.: Temporal logic. In: Zalta, E.N. (ed.), The Stanford Encyclopedia of Philosophy. Metaphysics Research Lab, Stanford University, Summer 2020 edn. (2020)

    Google Scholar 

  7. Bogdanas, D., Rosu, G.: K-Java: a complete semantics of Java. In: Rajamani, S.K., Walker, D., (eds.), Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, Mumbai, India, 15–17 January 2015, pp. 445–456. ACM (2015)

    Google Scholar 

  8. Filaretti, D., Maffeis, S.: An executable formal semantics of PHP. In: Jones, R. (ed.) ECOOP 2014. LNCS, vol. 8586, pp. 567–592. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-662-44202-9_23

    Chapter  Google Scholar 

  9. Hathhorn, C., Ellison, C., Rosu, G.: Defining the undefinedness of C. In: Grove, D., Blackburn, S., (eds.) Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, Portland, OR, USA, 15–17 June 2015, pp. 336–345. ACM (2015)

    Google Scholar 

  10. Rosu, G.: \(\mathbb{K}\): a semantic framework for programming languages and formal analysis tools. In: Pretschner, A., Peled, D., Hutzelmann, T., (eds.), Dependable Software Systems Engineering, vol. 50, NATO Science for Peace and Security Series-D: Information and Communication Security, pp. 186–206. IOS Press (2017)

    Google Scholar 

  11. Rosu, G., Chen, X.: Matching logic: the foundation of the K framework (invited talk). In: Blanchette, J., Hritcu, C., (eds.) Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2020, New Orleans, LA, USA, 20–21 January 2020, p. 1. ACM (2020)

    Google Scholar 

  12. Clavel, M., et al.: All About Maude - A High-Performance Logical Framework. LNCS, vol. 4350. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-71999-1

    Book  MATH  Google Scholar 

  13. Şerbănuţă, T.F., Roşu, G.: K-Maude: a rewriting based tool for semantics of programming languages. In: Ölveczky, P.C. (ed.) WRLA 2010. LNCS, vol. 6381, pp. 104–122. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-16310-4_8

    Chapter  MATH  Google Scholar 

  14. Chen, K.Z., et al.: Contextual policy enforcement in android applications with permission event graphs. In: 20th Annual Network and Distributed System Security Symposium, NDSS 2013, San Diego, California, USA, 24–27 February 2013 (2013)

    Google Scholar 

  15. Alhanahnah, M., et al.: Detecting vulnerable android inter-app communication in dynamically loaded code. In: IEEE INFOCOM 2019 - IEEE Conference on Computer Communications, pp. 550–558, April 2019

    Google Scholar 

  16. Jerbi, M., Dagdia, Z.C., Bechikh, S., Said, L.B.: On the use of artificial malicious patterns for android malware detection. Comput. Secur. 92, 101743 (2020)

    Google Scholar 

  17. Gao, H., Cheng, S., Zhang, W.: Gdroid: android malware detection and classification with graph convolutional network. Comput. Secur. 106, 102264 (2021)

    Article  Google Scholar 

  18. Bai, G., et al.: Towards model checking android applications. IEEE Trans. Softw. Eng. 44(6), 595–612 (2018)

    Google Scholar 

  19. Mills, E.: Dog wars app for android is trojanized. https://www.cnet.com/news/dog-wars-app-for-android-is-trojanized/

  20. Manna, Z., Pnueli, A.: The Temporal Logic of Reactive and Concurrent Systems - Specification. Springer, Cham (1992). https://doi.org/10.1007/978-1-4612-0931-7

    Book  MATH  Google Scholar 

  21. Felt, A.P., Chin, E., Hanna, S., Song, D., Wagner, D.A.: Android permissions demystified, pp. 627–638 (2011)

    Google Scholar 

  22. Chin, E., Felt, A.P., Greenwood, K., Wagner, D.: Analyzing inter-application communication in android. In: Proceedings of the 9th International Conference on Mobile Systems, Applications, and Services, MobiSys 2011, pp. 239–252, New York (2011)

    Google Scholar 

  23. Arzt, S., et al.: Flowdroid: precise context, flow, field, object-sensitive and lifecycle-aware taint analysis for android apps. SIGPLAN Not. 49(6), 259–269 (2014)

    Article  Google Scholar 

  24. Feng, R., Chen, S., Xie, X., Meng, G., Lin, S.-W., Liu, Y.: A performance-sensitive malware detection system using deep learning on mobile devices. IEEE Trans. Inf. Forensics Secur. 16, 1563–1578 (2021)

    Article  Google Scholar 

  25. Kumar, R., et al.: IoTmalware: android IoT malware detection based on deep neural network and blockchain technology. CoRR, abs/2102.13376 (2021)

    Google Scholar 

  26. Khan, W., Kamran, M., Ahmad, A., Khan, F.A., Derhab, A.: Formal analysis of language-based android security using theorem proving approach. IEEE Access 7, 16550–16560 (2019)

    Article  Google Scholar 

  27. Betarte, G., Campo, J.D., Luna, C., Romano, A.: Formal analysis of android’s permission-based security model. Sci. Ann. Comput. Sci. 26(1), 27–68 (2016)

    MathSciNet  MATH  Google Scholar 

  28. Betarte, G., Campo, J., Cristiá, M., Gorostiaga, F., Luna, C., Sanz, C.: Towards formal model-based analysis and testing of android’s security mechanisms. In: 2017 XLIII Latin American Computer Conference (CLEI), pp. 1–10 (2017)

    Google Scholar 

  29. Payet, E., Spoto, F.: An operational semantics for android activities, pp. 121–132 (2014)

    Google Scholar 

  30. Wognsen, E., Karlsen, H., Olesen, M.C., Hansen, R.: Formalisation and analysis of Dalvik bytecode. Sci. Comput. Program. 92, 25–55 (2014)

    Article  Google Scholar 

  31. Jeon, J., Micinski, K.K.: Symdroid: Symbolic Execution for Dalvik (2012)

    Google Scholar 

  32. Casolare, R., Martinelli, F., Mercaldo, F., Santone, A.: Android collusion: detecting malicious applications inter-communication through sharedpreferences. Information 11(6), 304 (2020)

    Article  Google Scholar 

  33. Casolare, R., Martinelli, F., Mercaldo, F., Nardone, V., Santone, A.: Colluding android apps detection via model checking. In: Barolli, L., Amato, F., Moscato, F., Enokido, T., Takizawa, M. (eds.) WAINA 2020. AISC, vol. 1150, pp. 776–786. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-44038-1_71

    Chapter  Google Scholar 

  34. Asăvoae, I.M., Blasco, J., Chen, T.M., Kalutarage, H.K., Muttik, I., Nguyen, H.N., Roggenbach, M., Shaikh, S.A.: Detecting malicious collusion between mobile software applications: the androidTM case. In: Palomares Carrascosa, I., Kalutarage, H.K., Huang, Y. (eds.) Data Analytics and Decision Support for Cybersecurity. DA, pp. 55–97. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-59439-2_3

    Chapter  Google Scholar 

  35. Ziadia, M., Mejri, M., Fattahi, J.: Formal and automatic security policy enforcement on android applications by rewriting. In: Fujita, H., Pérez-Meana, H., (eds.), New Trends in Intelligent Software Methodologies, Tools and Techniques - Proceedings of the 20th International Conference on New Trends in Intelligent Software Methodologies, Tools and Techniques, SoMeT 202, Cancun, Mexico, 21–23 September 2021, vol. 337, Frontiers in Artificial Intelligence and Applications, pp. 85–98. IOS Press (2021)

    Google Scholar 

  36. Ziadia, M., Mejri, M., Fattahi, J.: K semantics for security policy enforcement on android applications with practical cases. In: EAI CICom 2021, editor, 2nd EAI International Conference on Computational Intelligence and Communications, 18–19 November 2021 Versailles, France, EAI CICom 2021 (2021)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jaouhar Fattahi .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Ziadia, M., Mejri, M., Fattahi, J. (2022). \(\mathbb {K}\)-Smali: An Executable Semantics for Program Verification of Reversed Android Applications. In: Aïmeur, E., Laurent, M., Yaich, R., Dupont, B., Garcia-Alfaro, J. (eds) Foundations and Practice of Security. FPS 2021. Lecture Notes in Computer Science, vol 13291. Springer, Cham. https://doi.org/10.1007/978-3-031-08147-7_22

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-08147-7_22

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-08146-0

  • Online ISBN: 978-3-031-08147-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics