arrow
Return

Methods and Benchmark for Detecting Cryptographic API Misuses in Python

delete2024-05-01
delete1
PRE
AI
M
Miles Frantz *
Y
Ya Xiao
T
Tanmoy Sarkar Pias
N
Na Meng
D
Danfeng Yao
DOI:10.1109/TSE.2024.3377182delete
deleteOriginal
deleteShare
deleteSave
Abstract

Abstract

En 中文
Extensive research has been conducted to explore cryptographic API misuse in Java. However, despite the tremendous popularity of the Python language, uncovering similar issues has not been fully explored. The current static code analysis tools for Python are unable to scan the increasing complexity of the source code. This limitation decreases the analysis depth, resulting in more undetected cryptographic misuses. In this research, we propose Cryptolation, a Static Code Analysis (SCA) tool that provides security guarantees for complex Python cryptographic code. Most existing analysis tools for Python solely focus on specific Frameworks such as Django or Flask. However, using a SCA approach, Cryptolation focuses on the language and not any framework. Cryptolation performs an inter-procedural data-flow analysis to handle many Python language features through variable inference (statically predicting what the variable value is) and SCA. Cryptolation covers 59 Python cryptographic modules and can identify 18 potential cryptographic misuses that involve complex language features. In this paper, we also provide a comprehensive analysis and a state-of-the-art benchmark for understanding the Python cryptographic Application Program Interface (API) misuses and their detection. Our state-of-the-art benchmark PyCryptoBench includes 1,836 Python cryptographic test cases that covers both 18 cryptographic rules and five language features. PyCryptoBench also provides a framework for evaluating and comparing different cryptographic scanners for Python. To evaluate the performance of our proposed cryptographic Python scanner, we evaluated Cryptolation against three other state-of-the-art tools: Bandit, Semgrep, and Dlint. We evaluated these four tools using our benchmark PyCryptoBench and manual evaluation of (four Top-Ranked and 939 Un-Ranked) real-world projects. Our results reveal that, overall, Cryptolation achieved the highest precision throughout our testing; and the highest accuracy on our benchmark. Cryptolation had 100% precision on PyCryptoBench, and the highest precision on the real-world projects.
Keywords:
Cryptography
Python
Benchmark testing
Codes
Ciphers
Libraries
Encryption
Static code analysis
cryptographic API misuses
benchmark
Automatic Detection of Java Cryptographic API Misuses: Are We There Yet?
err2023-01-01
err8
PREAI
errZhang, Ying; Kabir, Md Mahir Asef; Xiao, Ya; Yao, Danfeng; Meng, Na
errShare
errSave
Evaluation of Static Vulnerability Detection Tools With Java Cryptographic API Benchmarks
err2023-02-01
err16
errOAAI
errAfrose, Sharmin; Xiao, Ya; Rahaman, Sazzadur; Miller, Barton P. P.; Yao, Danfeng
errShare
errSave
A Systematic Evaluation of Static API-Misuse Detectors
err2019-12-01
err73
errOAAI
errAmann, Sven; Hoan Anh Nguyen; Nadi, Sarah; Nguyen, Tien N.; Mezini, Mira
errShare
errSave
Revisiting, Benchmarking and Exploring API Recommendation: How Far Are We?
err2023-04-01
err17
errOAAI
errPeng, Yun; Li, Shuqing; Gu, Wenwei; Li, Yichen; Wang, Wenxuan; Gao, Cuiyun; Lyu, Michael R.
errShare
errSave
CrySL: An Extensible Approach to Validating the Correct Usage of Cryptographic APIs
err2021-11-01
err21
errOAAI
errKrueger, Stefan; Spath, Johannes; Ali, Karim; Bodden, Eric; Mezini, Mira
errShare
errSave
Evaluating Automatic Program Repair Capabilities to Repair API Misuses
err2022-07-01
err18
errOAAI
errKechagia, Maria; Mechtaev, Sergey; Sarro, Federica; Harman, Mark
errShare
errSave
Identifying and Mitigating API Misuse in Large Language Models
err2026-03-01
err0
PREAI
errZhuo, Terry Yue; He, Junda; Sun, Jiamou; Xing, Zhenchang; Lo, David; Grundy, John; Du, Xiaoning
errShare
errSave
Detecting and Explaining Python Name Errors
err2025-02-01
err0
PREAI
errWang, Jiawei; Li, Li; Liu, Kui; Du, Xiaoning
errShare
errSave

Journal

IEEE Transactions on Software Engineering cover
IEEE Transactions on Software Engineering
IF:
5.6
Papers:
3.0K
Citations:
1.3W

Organization

No organization information available
Cited Papers

Cited Papers

Effect of Disuse and Restoration of Function on Vesical Capacity
err1969-05-01
err0
PREAI
errJohn F. Schmaelzle; Alexander S. Cass; Frank Hinman
errShare
errSave
Evaluation of Static Vulnerability Detection Tools With Java Cryptographic API Benchmarks
err2023-02-01
err16
errOAAI
errAfrose, Sharmin; Xiao, Ya; Rahaman, Sazzadur; Miller, Barton P. P.; Yao, Danfeng
errShare
errSave
Blindspots in Python and Java APIs Result in Vulnerable Code
err2023-04-26
err4
errOAAI
errBrun, Yuriy; Lin, Tian; Somerville, Jessie Elise; Myers, Elisha M.; Ebner, Natalie
errShare
errSave
Complexes of Early Transition Metal Alkoxides: Molecular Structure of Ti(OiPr)4[OPb4(tBuN)3]
err2006-01-25
err0
PREAI
errRenée Papiernik; Liliane G. Hubert‐Pfalzgrl; Michael Veith; Volker Huch
errShare
errSave
Prevalence and Prognosis of Updated Phenotypes of Chronic Lung Allograft Dysfunction
err2020-04-01
err0
PREAI
errM.P. Combs; D.S. Wheeler; E.A. Belloli; S. Jia; D.M. Lyu; K.M. Chan; V.N. Lama
errShare
errSave
Numerical Study of Nonadiabatic Wall Effects on Aerodynamic Characteristics of CHN-T1 Standard Model
err2023-04-14
err0
errOAAI
errXiaobing Wang; Junqiang Wu; Jianzhong Chen; Yuping Li; Zhongliang Zhao; Guangyuan Liu; Yang Tao; Neng Xiong
errShare
errSave
researcher View more