Scripting languages are continuously gaining popularity due to their ease of use and the flourishing software ecosystems that surround them. These languages offer crash and memory safety by design, thus, developers do not need to understand and prevent low-level security issues like the ones plaguing the C code. However, scripting languages often allow native extensions, which are a way for custom C/C++ code to be invoked directly from the high-level language. While this feature promises several benefits such as increased performance or the reuse of legacy code, it can also break the language's guarantees, e.g., crash-safety. In this work, we first provide a comparative analysis of the security risks of native extension APIs in three popular scripting languages. Additionally, we discuss a novel methodology for studying the misuse of the native extension API. We then perform an in-depth study of npm, an ecosystem which is most exposed to threats introduced by native extensions. We show that vulnerabilities in extensions can be exploited in their embedding library by producing reads of uninitialized memory, hard crashes or memory leaks in 33 npm packages, simply by invoking their API with well-crafted inputs. Moreover, we identify six open-source web applications in which such exploits can be deployed remotely by a weak adversary. Finally, we were assigned seven security advisories for the work presented in this paper, most labeled as high severity.
翻译:文稿语言因其易于使用以及其周围的软件生态系统蓬勃发展而不断受到欢迎。这些语言通过设计提供崩溃和记忆安全,因此,开发者不需要理解和防止低级别的安全问题,例如困扰C代码的低级别安全问题。然而,文字文字语言往往允许本地扩展,这是从高语言直接引用C/C++代码的一种方式。虽然这一特征可以带来一些好处,如提高性能或重新使用遗留代码,但它也可以打破语言的保障,例如崩溃安全。在这项工作中,我们首先用三种流行文字语言对本地扩展API的安全风险进行比较分析。此外,我们讨论研究滥用本地扩展API的新方法。我们随后对npm进行深入的研究,这是一个最易受到本地扩展威胁的生态系统。我们表明,扩展中的弱点可以通过生成未初始化的记忆、硬性碰撞或记忆泄漏在33 npm 套纸,我们首先用三种流行的书写语言对本地扩展API的安全风险进行比较分析。我们讨论如何研究如何滥用本地扩展API 。我们最后将7个最薄弱的版本用于远程版本的版本的版本的版本。我们用6个版本的版本的版本的版本的版本展示了它。