arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2010.11242cs.CRcs.SE
收藏

揭开隐藏的危险:在野外寻找不安全的Go代码

Uncovering the Hidden Dangers: Finding Unsafe Go Code in the Wild

Johannes Lauinger, Lars Baumgärtner, Anna-Katharina Wickert, Mira Mezini

摘要:

Go程序设计语言旨在通过诸如自动存储管理、垃圾回收和严格类型系统等措施来提供内存和线程安全。然而,它也提供了一种通过使用不安全的包来绕过这个安全网的方法。虽然存在不安全的合法用例,但开发人员必须谨慎行事,以避免引入缓冲区溢出或内存损坏等漏洞。使用go-geiger,我们对GitHub上前500个最受欢迎的开源Go项目中的unsafe使用情况进行了研究,包括手动分析1,400个代码样本如何使用unsafe。在使用Go模块系统的项目中,38%直接包含至少一个不安全用法,91%在项目本身或其传递依赖项中包含至少一个不安全用法。根据发现的使用模式,我们提出了可能的利用向量在不同的情况下。最后,我们提出去安全,一种新的静态分析工具,以确定危险和常见的使用模式,以前未检测到现有的工具。

英文摘要:

The Go programming language aims to provide memory and thread safety through measures such as automated memory management with garbage collection and a strict type system. However, it also offers a way of circumventing this safety net through the use of the unsafe package. While there are legitimate use cases for unsafe, developers must exercise caution to avoid introducing vulnerabilities like buffer overflows or memory corruption in general. Using go-geiger, we conducted a study on the usage of unsafe in the top 500 most popular open-source Go projects on GitHub, including a manual analysis of 1,400 code samples on how unsafe is used. From the projects using Go's module system, 38% directly contain at least one unsafe usage, and 91% contain at least one unsafe usage in the project itself or one of its transitive dependencies. Based on the usage patterns found, we present possible exploit vectors in different scenarios. Finally, we present go-safer, a novel static analysis tool to identify dangerous and common usage patterns that were previously undetected with existing tools.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑