arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2306.00694cs.SEcs.CR
收藏

UNGOML:Go 中 unsafe 用法的自动化分类

UNGOML: Automated Classification of unsafe Usages in Go

Anna-Katharina Wickert, Clemens Damke, Lars Baumgärtner, Eyke Hüllermeier, Mira Mezini

AI总结:

提出 UNGOML,基于增强控制流图和深度学习自动分类 Go 的 unsafe 用法,在 WHAT/WHY 维度取得高准确率,可支持重构与安全审计。

摘要:

Go 编程语言为内存破坏提供了强有力的防护。作为这些防护机制的一个逃生舱,它提供了 unsafe 包。以往研究发现,该 unsafe 包在真实代码中经常被用于多种目的,例如序列化或类型转换。由于这些原因多种多样,或许可以通过重构特定用法来避免潜在漏洞。然而,对 unsafe 用法进行分类颇具挑战,并且需要调用上下文以及程序结构信息。本文提出首个面向 Go 中 unsafe 用法的自动化分类器 UNGOML,用于识别使用 unsafe 包做了什么以及为何使用它。对于 UNGOML,我们构建了四个定制深度学习分类器,并在一个人工标注数据集上进行训练。我们将 Go 代码表示为增强型控制流图(CFG),并使用一个单顶点分类器和三个上下文感知分类器来解决标签预测任务。三个上下文感知分类器在 WHAT 和 WHY 两个维度上均取得超过 86% 的 top-1 准确率。此外,在集合值共形预测设置下,我们在两个维度上均取得超过 93% 的准确率,且平均标签集大小为 2。因此,UNGOML 可用于高效筛选 unsafe 用法,以服务于重构或安全审计等用例。UNGOML:https://github.com/stg-tud/ungoml;工件:https://dx.doi.org/10.6084/m9.figshare.22293052

英文摘要:

The Go programming language offers strong protection from memory corruption. As an escape hatch of these protections, it provides the unsafe package. Previous studies identified that this unsafe package is frequently used in real-world code for several purposes, e.g., serialization or casting types. Due to the variety of these reasons, it may be possible to refactor specific usages to avoid potential vulnerabilities. However, the classification of unsafe usages is challenging and requires the context of the call and the program's structure. In this paper, we present the first automated classifier for unsafe usages in Go, UNGOML, to identify what is done with the unsafe package and why it is used. For UNGOML, we built four custom deep learning classifiers trained on a manually labeled data set. We represent Go code as enriched control-flow graphs (CFGs) and solve the label prediction task with one single-vertex and three context-aware classifiers. All three context-aware classifiers achieve a top-1 accuracy of more than 86% for both dimensions, WHAT and WHY. Furthermore, in a set-valued conformal prediction setting, we achieve accuracies of more than 93% with mean label set sizes of 2 for both dimensions. Thus, UNGOML can be used to efficiently filter unsafe usages for use cases such as refactoring or a security audit. UNGOML: https://github.com/stg-tud/ungoml Artifact: https://dx.doi.org/10.6084/m9.figshare.22293052

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

↑