All right, everyone, thank you very much for joining us. Our next talk is SDLC Nightmares, Defeating Secure Code Review, GPT Hallucination with Julo and April. Hello, my name is Julo and I just graduated from the Pennsylvania State University last year and now I'm working as a security engineer in industry. And my research interest is focused on applying deep learning in cybersecurity. And I'm April, Carnegie Mellon University graduate and currently a security engineer as well. A fun fact about me is I learned and applied my InfoSec knowledge during writing science fictions. Okay, let's get started. As most of us might have noticed, nowadays, large language models have been playing an increasingly important role in our daily work and lives. Today we'll discuss how LLMs can be applied to security code analysis and evaluate their reliability in understanding program logic. Overview of our talk today. First, we'll introduce LLMs and their strengths in SDLC, then we'll uncover their limitations through an experiment. Based on our findings, we'll further discuss the root causes and their other related issues. Finally, we'll summarize key takeaways on how to better utilize LLMs in our work. So, first of all, what is a large language model? Basically, LLM is advanced machine learning models that understand and generate human-like text by learning from fast data sets. They use deep learning, especially transformer architectures, to predict the most probable word in a sentence. For example, in this figure, it estimates a 91% probability that the word blue follows the phrase, the color of the sky is. LLMs generate coherent and contextually appropriate text, enabling tasks like answering questions, translation, and our topic today, code analysis. Now, let's talk about SDLC. A typical software development lifecycle involves various stages where LLMs can significantly assist. By understanding semantics and recognizing patterns, LLMs can comprehend natural language and analyze code, performing tasks like code generation, test case creation, and also documentation. From a security perspective, they also help with threat modeling and identifying vulnerabilities, ultimately boosting the efficiency and quality throughout the SDLC. However, LLMs can make mistakes. Here are two famous examples. When Google introduced their chatbot bot, it made a factual error during its very first demo. Another instance involved ChatGPT, which confidently asserted that 9.11 is greater than 9.9, a mistake even an elementary student would recognize. These errors stem from the tendency to state incorrect information as facts. LLMs often hallucinate, like what I do every time before sleeping or conceiving a science fiction story. They tend to make up information because they are essentially autocomplete systems based on probability rather than facts. Now, let's see their performance in code analysis. Before diving into the experiment, let's first take a closer look at the code itself. Technically, source code is a sequence of tokens consisting of three types, keywords, operators, and user-defined names. Keywords and operators are defined by the specification of each programming language, and they control the actual logic flow of the program execution. So we categorize them as logical features. Meanwhile, user-defined names, annotations, and comments, which don't influence the program's flow once it's compiled, are categorized as literal features. So our goal for the experiment is to determine what types of features in the code LLMs can actually learn and process. We'll mask the literal features by replacing the changeable names that don't affect the program flow, and then use the LLM to perform code analysis tasks on this modified code. By evaluating the performance, we'll assess whether the LLM can effectively process the logical features when literal features are absent or even misleading. To conceal the literal features, we'll adopt three kinds of anonymization. So here is an example of the bubble sort function in Java. And the first anonymization is for function name. So here we can replace the bubble sort string with our customized string. And the second one is for variable names. Two examples here is the begin and end, which we can replace with our strings. And the last one is the method invocation name. Here we have a function pret as one of the arguments for the bubble sort function, so we can replace the invocation name with our customized string. Meanwhile, to understand how literal features affect LLM comprehension, we also use two name replacement strategies. The first one is just replacing it with some randomly generated string, while the second one is shuffling the names with other meaningful names from the code, making it more misleading for users. For readers. Sorry. So, after the literal features are concealed, the LLM performs two main tasks related to code analysis. The first one is code clone detection, which identifies and measures the similarity between different code fragments to see if they generate the same result when given the same input. The second one is code search, where it tries to retrieve the code fragment from a larger code corpus that closely matches a developer's intent, which is expressed in natural language as the input. So, here are the results we got. It shows that anonymizing names significantly decreases model performance, especially when we replace all three kinds of names. In the code search task, we also notice that anonymizing master definition name causes more degradation than anonymizing master invocation name, indicating a stronger correlation between the master definition name and their purpose. As for different languages, anonymizing a single attribute affects Python more, but changing all naming attributes impacts Java the most. Probably because the verbosity and the structure in Java code that can mitigate partial anonymization are fully disrupted. Compared to the code clone detection task, the performance degradation is more pronounced in code search task, since well-defined variable and method names are crucial for relating the code snippet to its descriptive purpose. So, overall, the results clearly show that while logical features are what matters for a program to execute, what LLMs processed are mostly the literal features from the code. Now I'll hand it over to Dr. Zhilong to discuss the reasons and possible solutions. Okay. So, let's discuss some root cause for the misleading names and comments in the code. Basically, we just observed three types of the root cause for these misleading names and comments. And they are malicious code committers and outdated comments and bad coding practice. Malicious code contributors can contribute some malicious code to the open source projects, and to avoid being detected by the code reviewers. And they usually can change the naming to some misleading names to avoid being detected by the code reviewer. Secondly, in software development, programs often frequently update their code to fix some bugs or add some new features. Well, the comments corresponding to the code may not be updated in time. In this example, partial code was removed during a new commit, and, however, the corresponding comment was not removed accordingly. Comments that are not updated can cause inconsistency with the code, and we call them outdated comments. Outdated comments can mislead the light learning model during code analysis. Also, in bad coding practice, confusing variable names and misleading variable names could be given by even a benign programmer and developer, which can mislead the code reviewer, too. So, next, we are going to cover some other issues when using the light learning model to do the code analysis. Besides the aforementioned limitations, we also observe two limitations. The first one is lack of context, and the second one is diverse performance on different program language. We will show the detail. Most light learning models can only handle a sequence of a limited length. For example, GPT-3 can handle a sequence with 2,048 tokens at most, and GPT-4 can handle 32,000 tokens at most. However, the code for even small projects can have thousands lines of code, and each line of code contains usually more than 10 tokens. Therefore, the light learning model cannot consume all the code at once, which will lead to a lack of context issue. Let's show this figure. We have a big project here showing this figure, and let's consider the context of the light learning model through this blue box. And when we use the light learning model to analyze this whole project, we need to analyze a part of them individually. So, based on our observation, in most cases, the light learning model is used to analyze each function individually, and it cannot have a big picture of the whole project. So, we actually have written an ARX preprint to dive into this problem. We also proposed some solutions to solve this problem. And for people who are interested in the details can read this ARX preprint. Also, we observed that the light learning model has a diverse performance across different program languages. And different light learning models also have different strengths across different program languages. And we did a quick experiment to evaluate the light learning model's ability to infer the program logic on two program languages. And the result is shown in the table here. We can observe that the GPT 3.5 has shown the best results on PHP and Go. However, Gemini can show the best results on PHP and Python. Okay. So, next, we will discuss how to avoid this issue in using light learning model for code analysis. So, we start from some ad hoc solutions. And if the code is committed by the trusted developer, we should expect them to improve the quality of the name convention. And if the code is committed by some untrusted developer, and we should pay special attention in case the light learning model is fooled by the malicious code committer, which can easily be achieved based on experiments. And for example, we could deploy some naming logic in constancy detection and use it to detect the inconsistency before we perform the code review. However, to really solve this problem, we believe that we need to change the model a little bit to specifically for the code analysis. And the current popular pre-training task for the light learning model, as far as we know, is the mask token prediction. In mask token prediction task, it masks off some tokens in the sequence. Here, if I take this as example, and it masks off some of that tokens from its sequence and uses neural network to predict this token. And this is how current light learning model is trained, as far as we know. And the mask token prediction task mainly focuses on the literal feature when applied to the source code analysis. But if we apply this model to the neural language NLP, it's okay, because it does not have too much of the logic features. But for the source code, we have a lot of the logic features. So, to really solve this problem, we think that we need to add some more pre-training tasks to train a new large program language model, which we should add some logic feature prediction tasks so that it can better capture the logic feature, not the literal feature. Because, as we show, relying too much on the literal feature will result in some issues as we have demonstrated in the experiments. So, for the audience who are interested in the details of this talk, you can refer to this ARX preprint for more details. And here is our contact information. And that's all of our talk.