SafePyScript: A Web-Based Solution for Machine Learning-Driven Vulnerability Detection in Python Conference: ; ;
Talaya Farasat, Atiqullah Ahmadzai, Aleena Elsa George, Sayed Alisina Qaderi, Dusan Dordevic, Joachim Posegga · 2024
Read SafePyScript: A Web-Based Solution for Machine Learning-Driven Vulnerability Detection in Python Conference: ; ; by Talaya Farasat, Atiqullah Ahmadzai, Aleena Elsa George, Sayed Alisina Qaderi, Dusan Dordevic, Joachim Posegga (2024) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2411-00636.txt.
Description
Abstract . Software vulnerabilities are a fundamental cause of cyber attacks. Effectively identifying these vulnerabilities is essential for robust cybersecurity, yet it remains a complex and challenging task. In this paper, we present SafePyScript, a machine learning-based web application designed specifically to identify vulnerabilities in Python source code.
Catalog record
| CREATOR | Talaya Farasat, Atiqullah Ahmadzai, Aleena Elsa George, Sayed Alisina Qaderi, Dusan Dordevic, Joachim Posegga |
|---|---|
| YEAR | 2024 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 14 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2411-00636
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
SafePyScript: A Web-Based Solution for Machine Learning-Driven Vulnerability Detection in Python Conference: ; ; Talaya Farasat, Atiqullah Ahmadzai, Aleena Elsa George, Sayed Alisina Qaderi, Dusan Dordevic, Joachim Posegga Abstract . Software vulnerabilities are a fundamental cause of cyber attacks. Effectively identifying these vulnerabilities is essential for robust cybersecurity, yet it remains a complex and challenging task. In this paper, we present SafePyScript, a machine learning-based web application designed specifically to identify vulnerabilities in Python source code. Despite Python’s significance as a major programming language, there is currently no convenient and easy-to-use machine learning-based web application for detecting vulnerabilities in its source code. SafePyScript addresses this gap by providing an accessible solution for Python programmers to ensure the security of their applications. SafePyScript link: https://safepyscript.com/ 1. Introduction Finding software vulnerabilities is commonly referred to as “searching for a needle in a haystack” ( b11 ) . Identifying security vulnerabilities in software code is highly difficult since they are rare compared to other types of software defects. For example, the infamous Heartbleed vulnerability in OpenSSL exposed in 2014 has affected billions of Internet users; the cause were only two missing lines of code ( b43 ) . Static code analyses is carried out by rule-based systems, that rely on the definition of the features of vulnerable code; unfortunately, they tend to produce a significant number of false positives ( b12 ; b13 ) . Manual methods of defining such features are very time-consuming and primarily depend on human experience and depth of domain knowledge. Moreover, dynamic analysis tools, particularly software penetration testing, depend on a variety of test cases generated by human experts. Consequently, they also rely heavily on the domain knowledge and expertise of security professionals to pinpoint vulnerable areas within a software system ( b8 ) . Recognizing the constraints of these traditional methods, and with the growing accessibility of open-source software repositories, it has been recommended to adopt a data-driven approach for software vulnerability detection. Therefore, various machine learning (ML) techniques have been applied to learn vulnerable features of source code, and to automate the process of software vulnerability identification, with varying success ( b1 ; b2 ; b3 ; b4 ; b5 ; b6 ; b7 ; b14 ; b16 ; b17 ; b20 ; b22 ) . Many researchers have dedicated considerable attention to source code vulnerability detection written in different programming languages like Java, C, and C++ ( b1 ; b2 ; b3 ; b5 ; b8 ; b9 ; b10 ; b17 ; b21 ; b22 ) . In 2024, Python continues to maintain its prominent position as one of the top programming languages ( b39 ; b40 ; b41 ) , and also a majorly used language on GitHub ( b39 ) . Despite its popularity, Python has received comparably little attention by research on source code vulnerability detection. Although the studies mentioned here ( b6 ; b14 ; b18 ; b19 ; b20 ; b24 ) focus on the Python programming language, there is still no convenient, easy-to-use machine learning web-based application for detecting vulnerabilities in Python source code. We aim to fill this gap by developing a web-based application called SafePyScript (SafePyScript Website Link: https://safepyscript.com/), where users can easily identify vulnerabilities in Python source code. SafePyScript detects vulnerabilities using a machine learning module called BiLSTM, which is discussed in detail in our previous work ( b55 ) . Additionally, SafePyScript integrates the ChatGPT API (Turbo 3.5), enabling it to utilize the powerful capabilities of the ChatGPT model for analyzing Python source code and identifying potential software vulnerabilities. Moreover, secure Python code can also be obtained with the help of the ChatGPT model. SafePyScript provides users with comprehensive capabilities such as creating and managing user accounts, detecting vulnerabilities, achieving secure code, and downloading their reports. Additionally, users can provide feedback for future improvements. The remaining sections of this paper are organized as follows: Section 2 highlights related work. Section 3 discusses SafePyScript in detail. Finally, we conclude this paper with conclusion and future directions in Section 4. 2. Related Work Research on source code vulnerability detection is receiving increased attention due to the escalating threat of cybercrimes. The focus of research is currently shifting from traditional static and dynamic-based models ( b12 ; b13 ; b15 ) towards the adoption of machine learning and deep learning algorithms ( b1 ; b2 ; b3 ; b4 ; b5 ; b6 ; b7 ; b14 ) . Recently Sharma et al. ( b16 ) presented a detailed review of the studies that use machine learning techniques for source code analysis. Similarly, Semasaba et al. ( b17 ) highlighted a systematic literature review (between 2014 and 2020) of software vulnerability analysis on source code using deep learning models. Many researchers have dedicated considerable attention to source code vulnerability detection written in different programming languages like Java, C, and C++ ( b5 ; b8 ; b9 ; b10 ; b17 ) . According to the survey of Stack Overflow in 2023, Python is the third most commonly used language, and most of the student developers use Python ( b43 ) . Surprisingly, Python is seldomly subject to source code analysis. Alfadel et al. ( b19 ) empirically analyze the security vulnerabilities in Python packages. Harzevili et al. ( b20 ) investigate the security vulnerabilities specifically in Python machine learning libraries. Ehrenberg et al. ( b24 ) apply named entity recognition techniques (with the help of pre-trained, BERT-based transformer model) for recognizing the Python source code vulnerabilities. Wartschinski et al. ( b6 ) applied LSTM (with word2vec embeddings) for Python source code vulnerability detection. Bagheri and Hegedűs ( b18 ) presented a comparison of different text representation methods (word2vec, fastText, and BERT) with LSTM for vulnerability prediction in Python source code. Their results show that BERT embeddings with the LSTM model achieve the best overall accuracy in predicting Python source code vulnerabilities. They do not focus on creating a state-of-the-art prediction model. Rather, they investigate the capabilities of various text embedding techniques (word2vec, fastText, and BERT) as source code representations in the context of identifying vulnerabilities in Python code. Similarly, Wang et al. ( b14 ) presented the empirical study of different deep learning models for Python source code vulnerability detection. They show that LSTM and gated recurrent unit (GRU) can indeed be the best choice. Moreover, they also highlight that bi-directional LSTM and GRU with attention (using word2vec) are two optimal models for Python source code vulnerability detection. Following their research, in our previous work we apply BiLSTM for Python source code vulnerability detection. By leveraging the optimal settings of our BiLSTM model, we achieve a remarkable performance (average Accuracy = 98.6%, average F-Score = 94.7%, average Precision = 96.2%, average Recall = 93.3%, average ROC = 99.3%), thereby, establishing a new benchmark for vulnerability detection in Python source code. In this work, we present SafePyScript a web tool based on BiLSTM model for vulnerability detection in Python source code. Additionally, SafePyScript integrates the ChatGPT API, enabling it to utilize the powerful capabilities of the ChatGPT model for analyzing Python code, identifying potential software vulnerabilities, and get the secure code as well. 3. SafePyScript In this section,