Detection of uses of disposed resources in C\# source code using static analysis
https://doi.org/10.15514/ISPRAS-2022-34(6)-3
Abstract
The paper is devoted to the scalable approach for the detection of uses of disposed resources in C# source code, that is based on static symbolic execution. The resulting detector is implemented as a part of an industrial SharpChecker, that performs a scalable inter-procedural path-, and context-sensitive analysis. The evaluation of the developed detector shows 70% true positive ratio allowing it to include to the standard set of detectors and provide functionality to users. The paper describes a detection algorithm that takes into account the limitations imposed by the existing infrastructure of SharpChecker, its evaluation on the set of open-source programs containing 6 mln LOC and some examples of found errors in real projects.
About the Authors
Uljana Vladimirovna TSIAZHKOROBRussian Federation
Bachelor's Student at the Department of Radio Engineering and Computer Technologies of the Moscow Institute of Physics and Technology, an employee of the ISP RAS
Valery Nikolayevich IGNATYEV
Russian Federation
PhD in Computer Sciences, Senior Researcher at Ivannikov Institute for System Programming RAS and Associate Professor at system programming division of CMC faculty of Lomonosov Moscow State University
Andrey Andreevich BELEVANTSEV
Russian Federation
Dr.Sc., Leading Researcher at ISP RAS, Professor at MSU
References
1. Baldoni R., Coppa E. et al. A survey of symbolic execution techniques. ACM Computing Surveys (CSUR), vol. 51, issue 3, 2018, pp. 1-39.
2. Кошелев В.К., Игнатьев В.Н., Борзилов А.И. Инфраструктура статического анализа программ на языке C#. Труды ИСП РАН, том 28, вып. 1, 2016 г., стр. 21-40. DOI: 10.15514/ISPRAS-2016-28(1)-2 / Koshelev V.K., Ignatiev V.N. et al. SharpChecker: Static analysis tool for C# programs. Programming and Computer Software, vol. 43, issue 4, 2017, pp. 268—276.
3. Аветисян А., Белеванцев А. и др. Использование статического анализа для поиска уязвимостей и критических ошибок в исходном коде программ. Труды ИСП РАН, том 21, 2011 г., стр. 23-38 / Avetisyan A., Belevantsev A. et al. Using static analysis for finding security vulnerabilities and critical errors in source code. Trudy ISP RAN/Proc. ISP RAS, vol. 21, 2011, pp. 23-38 (in Russian).
4. Tiobe index for ranking the popularity of programming languages, 2022. URL: https://www.tiobe.com/tiobe-index.
5. Иванников В.П., Белеванцев А.А. и др. Статический анализатор Svace для поиска дефектов в исходном коде программ. Труды ИСП РАН, том 26, вып. 1, 2014 г., стр. 231-250. DOI: 10.15514/ISPRAS-2014-26(1)-7 / Ivannikov V.P., Belevantsev A.A. et al. Static analyzer Svace for finding defects in a source program code. Programming and Computer Software, vol. 40, issue 5, 2014, pp. 265-275.
6. Аветисян А., Бородин А. Механизмы расширения системы статического анализа svace детекторами новых видов уязвимостей и критических ошибок. Труды ИСП РАН, том 21, 2011 г., стр. 39-54 / Avetisyan A., Borodin A. Mechanisms for extending the system of static analysis Svace by new types of detectors of vulnerabilities and critical errors. Trudy ISP RAN/Proc. ISP RAS, vol. 21, 2011, pp. 39-54 (in Russian).
7. Henry J., Monniaux D., Moy M. Pagai: a path sensitive static analyser. Electronic Notes in Theoretical Computer Science, vol. 289, 2012, pp. 15-25.
8. Несов В. Автоматическое обнаружение дефектов при помощи межпроцедурного статического анализа исходного кода. Материалы XI Международной конференции РусКрипто, 2009.
9. Bai J.-J., Lawall J. et al. Effective static analysis of concurrency {use-after-free} bugs in linux device drivers. In Proc. of the USENIX Annual Technical Conference (USENIX ATC 19), 2019, pp. 255-268.
10. van der Kouwe E., Nigade V., Giuffrida C. DangSan: scalable use-after-free detection. In Proc. of the Twelfth European Conference on Computer Systems, 2017, pp. 405-419.
11. Ye J., Zhang C., Han X. UAFChecker: scalable static detection of use-after-free vulnerabilities. In Proc. of the 2014 ACM SIGSAC Conference on Computer and Communications Security, 2014, pp. 1529-1531.
12. Shimchik N., Ignatyev V., Belevantsev A. Improving accuracy and completeness of source code static taint analysis. In Proc. of the 2021 Ivannikov ISPRAS Open Conference (ISPRAS), 2021, pp. 61-68.
13. Кошелев В.К., Игнатьев В.Н., Борзилов А.И. Инфраструктура статического анализа программ на языке C#. Труды ИСП РАН, том 28, вып. 1, 2016 г., стр. 21-40. DOI: 10.15514/ISPRAS-2016-28(1)-2 / Koshelev V.K., Ignatiev V.N. et al. SharpChecker: Static analysis tool for C# programs. Programming and Computer Software, vol. 43, issue 4, 2017, pp. 268—276.
14. dotnet/roslyn: The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs. Available at: https://github.com/dotnet/roslyn, accessed 23.10.2021.
Review
For citations:
TSIAZHKOROB U.V., IGNATYEV V.N., BELEVANTSEV A.A. Detection of uses of disposed resources in C\# source code using static analysis. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2022;34(6):41-50. (In Russ.) https://doi.org/10.15514/ISPRAS-2022-34(6)-3