一句话:提出 Transcode,基于值流分析与控制依赖检测大规模系统中的状态码映射错误。
状态码映射描述程序状态转移,但由于编程疏忽或缺乏系统全局知识,开发者可能写出错误映射,部分甚至成为严重漏洞。现有方法只关注单个状态码值,忽略状态码之间的映射关系。本文提出 Transcode:先通过值流分析高效精确地收集由条件比较检查的候选状态码整数值;再根据是否经同一变量传播来聚合相关状态码;最后基于控制依赖提取映射,当同一状态码被映射到两个同类状态码时报告错误。作者在 5 个百万行级真实项目上评估,发现 59 个新错误,其中 13 个已被社区修复;并在微信工业场景中部署,成功发现真实映射错误,表明该方法兼顾精度与效率。
Status code mappings reveal state shifts of a program, mapping one status code to another. Due to careless programming or the lack of the system-wide knowledge of a whole program, developers can make incorrect mappings. Such errors are widely spread across modern software, some of which have even become critical vulnerabilities. Unfortunately, existing solutions merely focus on single status code values, while never considering the relationships, that is, mappings, among them. Therefore, it is imperative to propose an effective method to detect status code mapping errors.In this paper, we propose Transcode to detect potential status code mapping errors. It firstly conducts value flow analysis to efficiently and precisely collect candidate status code values, that is, the integer values, which are checked by following conditional comparisons. Then, it aggregates the correlated status codes according to whether they are propagated with the same variable. Finally, Transcode extracts mappings based on control dependencies and reports the mapping error if one status code is mapped to two others of the same kind. We have implemented Transcode as a prototype system, and evaluated it with 5 real-world software projects, each of which possesses in the order of a million lines of code. The experimental results show that Transcode is capable of handling large-scale systems in both a precise and efficient manner. Furthermore, it has discovered 59 new errors in the tested projects, among which 13 have been fixed by the community. We also deploy Transcode in WeChat, a widely-used instant messaging service, and have succeeded in finding real mapping errors in the industrial settings.
DOI 原文 ·
@inproceedings{paperbot6568,
title = {Transcode: Detecting Status Code Mapping Errors in Large-Scale Systems},
author = {Wensheng Tang and Yikun Hu and Gang Fan and Peisen Yao and Rongxin Wu and Guangyuan Bai and Pengcheng Wang and Charles Zhang},
booktitle = {ASE},
year = {2021},
doi = {10.1109/ase51524.2021.9678823}
}