INTRINSIC SAFETY IN IOT: A COMPARISON OF RUST AND C++ IN MEMORY LEAK PREVENTION

Authors

DOI:

https://doi.org/10.47820/recima21.v6i7.6523

Keywords:

Rust, C++, Intrinsic safety, IoT, Memory vulnerabilities

Abstract

This article investigates the memory safety mechanisms provided by the Rust programming language in comparison to C++ in Internet of Things (IoT) applications. Memory safety is a critical aspect in embedded systems, where failures such as buffer overflow, double-free, and use-after-free may compromise the integrity and availability of applications. Prototype routines simulating these flaws were developed and tested in both languages to observe how Rust addresses them at compile time, whereas C++ allows their execution even under AddressSanitizer analysis. The ownership, borrowing, and lifetime control mechanisms proved effective in preventing failures, forming the basis of Rust’s intrinsic safety model. Despite promising results, some limitations are acknowledged, such as the use of a controlled environment and the absence of tests involving FFI and concurrency. It is concluded that Rust presents significant advantages in memory safety, emerging as a promising alternative for developing more resilient IoT systems.

Downloads

Download data is not yet available.

Author Biographies

  • João Victor Souza

    Graduando em Análise e Desenvolvimento de Sistemas pela Faculdade de Tecnologia de Praia Grande.

  • Wellington Marques da Silva

    Graduando em Análise e Desenvolvimento de Sistemas pela Faculdade de Tecnologia de Praia Grande.

     

  • Jônatas Cerqueira Dias

    Doutorado em Engenharia de Controle e Automação Mecânica pela Escola Politécnica - Aplicação da Resiliência em Sistema de Controle Mecatrônico em Dispositivo de Assistência Ventricular. Mestrado em Engenharia de Software USP / IPT. Pós-graduação Lato Sensu em Análise de Sistemas. Pós-graduação Lato Sensu em Docência do Ensino Superior. Graduação em Licenciatura em Matemática. Graduação em Processamento de Dados. Faculdade de Tecnologia de Praia Grande.

References

AKTER, Mst S. et al. Feature engineering-based detection of buffer overflow vulnerability in source code using neural networks. In: 2023 IEEE 47th Annual Computers, Software, and Applications Conference (COMPSAC). IEEE, 2023. p. 765-776. Disponível em: https://ieeexplore.ieee.org/abstract/document/10196986. Acesso em: 21 set. 2024. DOI: https://doi.org/10.1109/COMPSAC57700.2023.00106

ALENEZI, M. N. et al. Evolution of Malware Threats and Techniques: a Review. International Journal of Communication Networks and Information Security (IJCNIS), [S. l.], v. 12, n. 3, 2022. doi: 10.17762/ijcnis.v12i3.4723. Disponível em: https://www.ijcnis.org/index.php/ijcnis/article/view/4723. Acesso em: 20 out. 2024. DOI: https://doi.org/10.17762/ijcnis.v12i3.4723

BUGDEN, W.; ALAHMAR, A. Rust: the programming language for safety and performance. In: 2nd International Graduate Studies Congress (IGSCONG'22), Turkey, 2022. Disponível em: https://doi.org/10.48550/arXiv.2206.05503. Acesso em: 20 out. 2024.

CERT - COORDINATION CENTER. Microsoft Windows Print Spooler allows for RCE via AddPrinterDriverEx(). Vulnerability Note VU#383432. Carnegie Mellon University, 2021. Disponível em: https://www.kb.cert.org/vuls/id/383432. Acesso em: 20 out. 2025.

CYBERSECURITY AND INFRASTRUCTURE SECURITY AGENCY. The case for memory safe roadmaps: why both C suite executives and technical experts need to take memory safe coding seriously. Washington, D.C.: CISA, 2023. Disponível em: https://www.cisa.gov/resources-tools/resources/case-memory-safe-roadmaps. Acesso em: 12 abr. 2025.

DAMASIO, V. M. A. Buffer overflow: mecanismo e exploração. 2022. Trabalho de Conclusão de Curso (Graduação em Engenharia de Computação) – Pontifícia Universidade Católica de Goiás, Goiânia, 2022. Disponível em: https://repositorio.pucgoias.edu.br/jspui/handle/123456789/4433. Acesso em: 28 set. 2024.

DHAR, S. et al. Securing IoT devices: A novel approach using blockchain and quantum cryptography. Internet of Things, v. 25, 101960, 2024. Disponível em: https://www.sciencedirect.com/science/article/pii/S2542660523003426. Acesso em: 19 mar. 2025. DOI: https://doi.org/10.1016/j.iot.2023.101019

EL-SOFANY, H. et al. Using machine learning algorithms to enhance IoT system security. Scientific Reports, v. 14, n. 1, 2024. Disponível em: https://www.nature.com/articles/s41598-024-62861-y. Acesso em: 09 abr. 2025. DOI: https://doi.org/10.1038/s41598-024-62861-y

GODOI, M. G. de; ARAÚJO, L. S. A Internet das Coisas: evolução, impactos e benefícios. Revista Interface Tecnológica, Taquaritinga, SP, v. 16, n. 1, p. 19–30, 2019. Disponível em: https://revista.fatectq.edu.br/interfacetecnologica/article/view/538. Acesso em: 2 mar. 2025.

HUNTLEY, R. Is C/C++ memory safe? EE Times Europe. 2024. Disponível em: https://www.eetimes.eu/is c c memory safe/. Acesso em: 26 abr. 2025.

IVANOV, Nikolay. Is rust c++-fast? benchmarking system languages on everyday routines. arXiv preprint arXiv:2209.09127, 2022. Disponível em: https://arxiv.org/abs/2209.09127. Acesso em: 21 set. 2024.

KLABNIK, S.; NICHOLS, C. The Rust Programming Language. 2. ed. San Francisco: No Starch Press, 2023.

MICROSOFT. C++ Documentation. [S. l.]: Microsoft, 2023. Disponível em: https://learn.microsoft.com/pt-br/cpp/cpp/?view=msvc-170. Acesso em: 28 set. 2024.

MICROSOFT. Ponteiros inteligentes (C++ moderno). [S. l.]: Microsoft, 2023. Disponível em: https://learn.microsoft.com/pt-br/cpp/cpp/smart-pointers-modern-cpp?view=msvc-170. Acesso em: 2 mar. 2025.

MOURA, D. Y. R. Investigando as relações entre problemas de segurança de memória e desempenho em programas Kotlin. 2023. Trabalho de Conclusão de Curso (Graduação em Engenharia Elétrica – Telecomunicações) – Faculdade de Tecnologia, Universidade Federal do Amazonas, Manaus, 2023. Disponível em: http://riu.ufam.edu.br/handle/prefix/6647. Acesso em: 21 set. 2024

MULLEN, G.; MEANY, L. Assessment of buffer overflow based attacks on an IoT operating system. In: 2019 Global IoT Summit (GIoTS). IEEE, 2019. p. 1-6. doi: 10.1109/GIOTS.2019.8766434. Disponível em: https://ieeexplore.ieee.org/document/8766434. Acesso em: 11 jan. 2025 DOI: https://doi.org/10.1109/GIOTS.2019.8766434

NOSEDA, M. et al. Rust for secure iot applications: why c is getting rusty. In: Embedded World Conference, Nuremberg, Germany, 21-23 June 2022. WEKA, 2022. Disponível em: https://digitalcollection.zhaw.ch/handle/11475/25046. Acesso em: 06 maio 2025.

OLIVEIRA, L. R. M. de; MOREIRA, A. L. S. Padrões de segurança para dispositivos IoT de baixo nível: uma revisão comparativa. 2021. Trabalho de Conclusão de Curso (Graduação em Análise e Desenvolvimento de Sistemas) – Instituto Federal de Pernambuco, Recife, 2021. Disponível em: https://repositorio.ifpe.edu.br/xmlui/handle/123456789/664. Acesso em: 29 abr. 2025.

REBERT, A.; KERN, C. Secure by design: Google’s perspective on memory safety. Technical report. Google Security Engineering, 2024. Disponível em: https://research.google/pubs/secure-by-design-googles-perspective-on-memory-safety/. Acesso em: 19 jan. 2025.

REZENDE, M. V. Avaliação de segurança cibernética no desenvolvimento de software embarcado automotivo: uma abordagem ontológica. 2020. Tese (Doutorado em Sistemas de Informação e Gestão do Conhecimento) - Universidade FUMEC, Belo Horizonte, 2020. Disponível em: https://repositorio.fumec.br/handle/123456789/835. Acesso em: 22 set. 2024.

RIVIERA, E et al. Keeping safe rust safe with galeed. In: Proceedings of the 37th Annual Computer Security Applications Conference. 2021. p. 824-836. Disponível em: https://doi.org/10.1145/3485832.3485903. Acesso em: 21 set. 2024. DOI: https://doi.org/10.1145/3485832.3485903

SAFRONOV, V. et al. How memory-safe is iot? assessing the impact of memory-protection solutions for securing wireless gateways. In: Proceedings of the 14th International Conference on the Internet of Things. 2024. p. 261-266. Disponível em: https://ora.ox.ac.uk/objects/uuid:5627d10d-b7b2-46a7-895e-013a540c0973. Acesso em: 06 maio 2025. DOI: https://doi.org/10.1145/3703790.3703820

SILVA, T. D. da. CORAL: a Rust-like Borrow Checker for C. 2023. Dissertação (Mestrado em Engenharia Informática e de Computação) – Faculdade de Engenharia, Universidade do Porto, Porto, 2023. Disponível em: https://hdl.handle.net/10216/153606. Acesso em: 06 out. 2024.

SOUSA, D. F. de. AST-Based Large-Scale Vulnerability Analysis for C/C++. [S. l.: s. n.], 2022. Disponível em: https://hdl.handle.net/10216/144794. Acesso em: 20 out. 2024.

Published

04/07/2025

How to Cite

INTRINSIC SAFETY IN IOT: A COMPARISON OF RUST AND C++ IN MEMORY LEAK PREVENTION. (2025). RECIMA21 - Revista Científica Multidisciplinar - ISSN 2675-6218, 6(7), e676523. https://doi.org/10.47820/recima21.v6i7.6523