Tools focused on cryptographic API misuse often detect the most basic expressions of the vulnerable use, and are unable to detect non-trivial variants. The question of whether tools should be designed to detect such variants can only be answered if we know how developers use and misuse cryptographic APIs in the wild, and in particular, what the unnatural usage of such APIs looks like. This paper presents the first large-scale study that characterizes unnatural crypto-API usage through a qualitative analysis of 5,704 representative API invocations. We develop an intuitive complexity metric to stratify 140,431 crypto-API invocations obtained from 20,508 Android applications, allowing us to sample 5,704 invocations that are representative of all strata, with each stratum consisting of invocations with similar complexity/naturalness. We qualitatively analyze the 5,704 sampled invocations using manual reverse engineering, through an in-depth investigation that involves the development of minimal examples and exploration of native code. Our study results in two detailed taxonomies of unnatural crypto-API misuse, along with 17 key findings that show the presence of highly unusual misuse, evasive code, and the inability of popular tools to reason about even mildly unconventional usage. Our findings lead to four key takeaways that inform future work focused on detecting unnatural crypto-API misuse.
翻译:专注于加密API误用的工具通常只能检测到漏洞使用的最基本表达形式,而无法检测非平凡的变体。工具是否应被设计用于检测此类变体的问题,只有在我们了解开发者如何在真实环境中使用和误用加密API,特别是此类API的非自然使用表现为何种形式时,才能得到解答。本文首次通过定性分析5,704个代表性API调用来描述非自然加密API使用特征的大规模研究。我们开发了一种直观的复杂度度量标准,对从20,508个Android应用程序中获取的140,431次加密API调用进行分层,使我们能够抽样出代表所有层级的5,704次调用,每个层级包含具有相似复杂度/自然度的调用。我们通过人工逆向工程对这5,704个抽样调用进行定性分析,该深入调查涉及最小化示例的开发和原生代码的探索。我们的研究形成了两份详细的非自然加密API误用分类法,以及17项关键发现,这些发现揭示了高度异常误用、规避性代码的存在,以及流行工具甚至无法推理轻度非常规使用的情况。我们的研究结果得出四个关键启示,为未来专注于检测非自然加密API误用的工作提供了指导。