一句话:提出 PassFinder,利用深度神经网络检测 GitHub 代码中的文本密码泄露,并完成首次大规模纵向分析。
公共 GitHub 仓库中可能意外包含文本密码和 API 密钥等认证秘密,造成泄露;已有方法主要检测具有固定格式的密钥,难以覆盖几乎可为任意字符串的文本密码,正则表达式方案效果不佳。本文提出 PassFinder,利用深度神经网络学习文本密码的内在特征,并理解源码中使用密码进行认证的代码片段语义(即密码上下文),从而大规模自动检测密码泄露。作者对 GitHub 上新上传的公共代码文件进行了 75 天连续检查,首次开展大规模纵向分析,发现密码泄露普遍存在,影响超过六万个仓库,有助于理解并提升开源生态安全。
The prosperity of the GitHub community has raised new concerns about data security in public repositories. Practitioners who manage authentication secrets such as textual passwords and API keys in the source code may accidentally leave these texts in the public repositories, resulting in secret leakage. If such leakage in the source code can be automatically detected in time, potential damage would be avoided. With existing approaches focusing on detecting secrets with distinctive formats (e.g., API keys, cryptographic keys in PEM format), textual passwords, which are ubiquitously used for authentication, fall through the crack. Given that textual passwords could be virtually any strings, a naive detection scheme based on regular expression performs poorly. This paper presents PassFinder, an automated approach to effectively detecting password leakage from public repositories that involve various programming languages on a large scale. PassFinder utilizes deep neural networks to unveil the intrinsic characteristics of textual passwords and understand the semantics of the code snippets that use textual passwords for authentication, i.e., the contextual information of the passwords in the source code. Using this new technique, we performed the first large-scale and longitudinal analysis of password leakage on GitHub. We inspected newly uploaded public code files on GitHub for 75 days and found that password leakage is pervasive, affecting over sixty thousand repositories. Our work contributes to a better understanding of password leakage on GitHub, and we believe our technique could promote the security of the open-source ecosystem.