With the development of Pre-trained Language Models (PLMs), a wide variety of Chinese NLP tasks benefit from the BERT structure. Unfortunately, Chinese BERT-based PLMs are vulnerable to adversarial attacks and expose robustness issues. It inspired numerous defense works devoted to improving the model robustness. However, existing pre-training methods incur substantial time costs, while fine-tuning methods need more evidence to demonstrate how well the target model has been defended. This work aims to bridge this gap. We propose RoFuBERT, a robust fine-tuning framework using fuzz testing for Chinese BERT-based PLMs. We extract Chinese pinyin, glyph, and synonym features of downstream NLP tasks during fine-tuning. We integrate them into fuzz testing and evaluate the testing completeness of the model under adversarial attacks. Finally, we retrain the model for robust fine-tuning. Our evaluation shows that RoFuBERT improves adversarial robustness efficiently. Compared with the two baselines, RoFuBERT takes only 0.13 times more time. The reduction of adversarial attack success rate is improved by 41.26 %, and the modification rate of the adversarial samples is improved by 16.19 %, on average.
Context: Proof-of-Concept (PoC) reports are indispensable for evaluating the exploitability of vulnerabilities. Various PoC data sources are responsible for collecting and sharing these reports. We have identified inconsistencies in the information pertaining to affected software versions across these data sources. These inconsistencies serve as red flags, alerting security experts to exercise caution during exploitability assessments and ensuring the effective allocation of resources. Objective: This paper analyzes software version inconsistencies in PoC reports and proposes "POSVIA" (PoC Oriented Software Version Inconsistency Analyzer), a deep learning tool designed to automatically detect and evaluate these inconsistencies across multiple PoC data sources, overcoming the impracticality of manual detection. Methods: A Named Entity Recognition (NER) model was developed with high performance: precision (93.76%) and recall (93.48%) for extracting CVE IDs, affected software names, and version data from PoC reports. Additionally, a Relation Extraction (RE) model was designed with metrics of 95.04% precision and 96.40% recall, to identify relationships between software and versions. These models analyzed 173,239 PoC reports from four data sources and assessed version inconsistencies using "POSVIA". Results: Analysis revealed that Openwall had the lowest strict match rate (32.75%) for affected software versions, compared to other sources. The strict match rate for verified software versions ranged from 60.00% to 78.16%, indicating substantial inconsistencies. Over time, the match rate fluctuated, improving when using ExploitDB, Packet Storm Security, and CXSecurity as benchmarks. Openwall's rate remained low, suggesting it should be considered alongside other sources for vulnerability exploitability assessments. Conclusion: This study introduces an automated tool named "POSVIA", which is designed to address the challenge of detecting inconsistencies in software versions within PoC reports. By automating inconsistency detection across multiple data sources, POSVIA overcomes the limitations of manual methods and enhances the accuracy of exploitability assessments. This approach provides critical support for improving software security and resource allocation.
With the deployment of Deep Neural Network (DNN) systems in security-critical fields, more and more researchers are concerned about DNN robustness. Unfortunately, DNNs are vulnerable to adversarial attacks and produce completely wrong outputs. This inspired numerous testing works devoted to improving the adversarial robustness of DNNs. Coverage and uncertainty criteria were proposed to guide sample selections for DNN retraining. However, they are greatly limited to evaluating DNN abnormal behaviors rather than locating the root cause of adversarial vulnerability. This work aims to bridge this gap. We propose an adversarial testing framework, DeepFeature, using robust features. DeepFeature generates robust features related to the model decision-making. It locates the weak features within these features that fail to be transformed by the DNN. They are the main culprits of vulnerability. DeepFeature selects diverse samples containing weak features for adversarial retraining. Our evaluation shows that DeepFeature significantly improves overall robustness, average improved by 77.83%, and individual robustness, average improved by 42.81‰, of the models in adversarial testing. Compared with coverage and uncertainty criteria, these two performances are improved by 3.93% and 15.00% in DeepFeature, respectively. The positive correlation coefficient between DeepFeature and improved robustness can achieve 0.858, and the p-value is 0.001.
Image segmentation software (SegSoftware) is a kind of DNN-based image analysis software that aims to recognize the shapes and categories of instances according to their implicit semantic information. SegSoftware frequently uses in safety-critical fields. Therefore, we should provide adequate testing to SegSoftware. Due to the high cost of manually acquiring the testing oracle for SegSoftware, we employ metamorphic testing to detect its erroneous behaviour. This paper proposes SegTest, a metamorphic testing method that primarily addresses two major challenges in applying metamorphic testing to SegSoftware: (1) devising a method for generating derived test cases, which is the data augmentation approach, and (2) finding effective metamorphic relations for automatically generating the testing oracle. Regarding the former, SegTest utilizes an instance-level data augmentation method. It generates new test data by inserting annotated instances into the existing images. For ease of exposing erroneousness, we statistically analysed thousands of SegSoftware erroneous behaviours and formulated the guidance strategy of instance selecting and insertion positioning. As for the latter, this paper proposes a metamorphic relation to insert an instance at a position in an original image, where SegSoftware should accurately segment the inserted instance's contour and assign it the appropriate category while preserving the segmentation results of other regions unchanged. Our empirical study shows that SegTest can effectively detect thousands of erroneous behaviours of SegSoftware, and the formulated augmentation strategy achieves a 12.1%-14.1% improvement in SegSoftware erroneousness detection. SegTest also detects 7135 erroneous behaviours on the commercial IBM Segmenter, which verifies the effectiveness of erroneousness detection in practice.
Using few-shot demonstrations in prompts significantly enhances the generation quality of large language models (LLMs), including code generation. However, adversarial examples injected by malicious service providers via few-shot prompting pose a risk of backdoor attacks in large language models. There is no research on backdoor attacks on large language models in the few-shot prompting setting for code generation tasks. In this paper, we propose BadCodePrompt, the first backdoor attack for code generation tasks targeting LLMS in the few-shot prompting scenario, without requiring access to training data or model parameters and with lower computational overhead. BadCodePrompt exploits the insertion of triggers and poisonous code patterns into examples, causing the output of poisonous source code when there is a backdoor trigger in the end user’s query prompt. We demonstrate the effectiveness of BadCodePrompt in conducting backdoor attacks on three LLMS (GPT-4, Claude-3.5-Sonnet, and Gemini Pro-1.5) in code generation tasks without affecting the functionality of the generated code. LLMs with stronger reasoning capabilities are also more vulnerable to BadCodePrompt, with an average attack success rate of up to 98.53% for GPT-4 in two benchmark tasks. Finally, we employ state-of-the-art defenses against backdoor attacks in Prompt Engineering and show their overall ineffectiveness against BadCodePrompt. Therefore, BadCodePrompt remains a serious threat to LLMS, underscoring the urgency of developing effective defense mechanisms.
Context: Autonomous driving technology advances into daily life, with expectations for autonomous driving systems(ADSs) to make optimal, human-like decisions. However, ADSs often exhibit “unintelligent” behaviors like inefficient path choices, significantly impacting travel efficiency and potentially causing delays. Therefore, testing the decision optimality of ADSs is critically urgent. However, the testing process faces a significant “testing oracle” problem, and current methods overlook behavior interactions, which do not reflect real-world traffic scenarios. Objective: To assess the performance and reliability of ADSs in optimal decision-making, mitigate test oracle problems, and detect non-optimal decisions without calculating the optimal path. Method: This paper proposes a metamorphic testing method for optimal decision-making in autonomous driving under interactive scenarios, MT-Nod. Our method introduces a novel metamorphic relation to evaluate the optimality of path directions, along with a follow-up scenario generation method. The scenario generation method includes mutation points selection based on key behaviors, scenario mutation based on behavioral interactions, and road accessibility assessment, to generate scenarios with dynamic interactions. Additionally, a scenario scheduling strategy is designed to prioritize and schedule scenarios based on the priority of mutation points. Results: We evaluate MT-Nod extensively on the advanced Apollo ADS. Across four source scenarios, it generates 69.3 non-optimal decision scenarios (NoDSs), classified into eight types. Compared to baselines, MT-Nod efficiently produces and detects a greater variety and quantity of NoDSs. Conclusion: The proposed method for optimal decision testing under interactive scenarios, MT-Nod, effectively detects non-optimal decisions of ADSs. These “unintelligent” behaviors are crucial for enhancing the performance and reliability of ADSs.
Commenting code is a crucial activity in software development, as it aids in facilitating future maintenance and updates. To enhance the efficiency of writing comments and reduce developers' workload, researchers has proposed various automated code summarization (ACS) techniques to automatically generate comments/summaries for given code units. However, these ACS techniques primarily focus on generating summaries for code units at the method level. There is a significant lack of research on summarizing higher-level code units, such as file-level and module-level code units, despite the fact that summaries of these higher-level code units are highly useful for quickly gaining a macro-level understanding of software components and architecture. To fill this gap, in this paper, we conduct a systematic study on how to use LLMs for commenting higher-level code units, including file level and module level. These higher-level units are significantly larger than method-level ones, which poses challenges in handling long code inputs within LLM constraints and maintaining efficiency. To address these issues, we explore various summarization strategies for ACS of higher-level code units, which can be divided into three types: full code summarization, reduced code summarization, and hierarchical code summarization. The experimental results suggest that for summarizing file-level code units, using the full code is the most effective approach, with reduced code serving as a cost-efficient alternative. However, for summarizing module-level code units, hierarchical code summarization becomes the most promising strategy. In addition, inspired by the research on method-level ACS, we also investigate using the LLM as an evaluator to evaluate the quality of summaries of higher-level code units. The experimental results demonstrate that the LLM's evaluation results strongly correlate with human evaluations.
Mutation testing is a practical approach for evaluating the quality of deep learning (DL) testing datasets. However, the enormous mutants during testing lead to significant testing overhead. Feature clustering is a conventional method that reduces the number of mutants while preserving the mutants’ distribution diversity. This distribution diversity is considered crucial for maintaining the effectiveness of testing assessment ability. DL model relies on convolutional kernels to extract data features and construct logic. Thus, using kernels to measure the differences among DL mutants is a feasible approach. This paper proposes DeepKernel, a convolutional kernel features clustering based reduction method. Specifically, it considers 2D-Kernel sparsity and 2D-Kernel entropy as kernel features. The features are clustered to construct a subset with equivalent testing assessment capability to the original set. Empirical studies on four classical DL models demonstrate that: (1) there is a significant correlation between the distribution diversity of the mutants and their testing assessment ability, as indicated by a Spearman Correlation Coefficient of 0.9689. (2) the reduced set maintains a similar distribution diversity and testing effectiveness as the original set. (3) when preserving the effectiveness of the mutation testing, our method reduces 63.47% of mutants and outperforms random selection.Editor’s note: Open Science material was validated by the Journal of Systems and Software Open Science Board.
Abstract Recent studies have shown that code models are susceptible to backdoor attacks. When injected with a backdoor, the victim code model can function normally on benign samples but may produce predetermined malicious outputs when triggers are activated. However, previous backdoor attacks on code models have used explicit triggers, and we aim to investigate the vulnerability of code models to stealthy backdoor attacks in this study. To this end, we propose a backdoor attack approach using Abstract Syntax Tree-based Triggers (ASTT) to obtain stealthiness. We evaluate ASTT on deep learning-based code models and three downstream tasks (i.e., code translation, code repair, and defect detection). With the clustering algorithm, we generated triggers based on abstract syntax trees. We find that the average attack success rate of our ASTT can reach 92.71%. Moreover, our ASTT is stealthy and can effectively bypass state-of-the-art defense approaches. Finally, we verify that the time overhead of our proposed ASTT is small and can meet the needs in real scenarios. Our finding demonstrates security weaknesses in code models under stealthy backdoor attacks.
Backdoor attacks on deep neural networks (DNNs) using targeted universal adversarial perturbations (TUAPs) do not require training datasets and model tampering, and triggers based on TUAPs can make DNNs output any class the adversary wants. Retraining DNNs using adversarial training for security is time-consuming and does not apply to DNNs in runtime. We want to detect backdoors using a black-box testing approach. We observe that after superimposing random noise on the input of a backdoor attack, the output still tends to remain the same, so we propose Sequential Analysis method based on the Metamorphosis Testing (SAMT). We designed two metamorphic relations for test case generation. Using sequential sampling, we calculate the label stability rate (LSR) and infer whether the image to be verified contains a trigger based on the sequential probability ratio change. The experimental results show that our method has a higher backdoor detection success rate (dsr) than the state-of-the-art detection algorithms. Moreover, our method does not need to use the model structure of DNNs, which has more adaptability and generalization ability. Based on our proposed method, we can simply add a backdoor detection layer to detect backdoors as early as possible, which can eventually alleviate the harm of such backdoors.
Smart contracts manage numerous digital assets, their security requirements are particularly prominent. Testing is an effective way to ensure the reliability of smart contracts. Current test case generation methods do not consider the impact of state variables and cross-contract calls on constraint conditions, leading to low test coverage for cross-contracts. In this regard, we propose a Cross-contract Data flow Analysis based Test case Generation (CDA-TG) method for Ethereum smart contracts. First, for each function in the target contract, CDA-TG generates its invocation sequence based on the principle of prioritizing functions that define or modify state variables. Then, for each parameter, CDA-TG performs cross-contract data flow analysis on the target contract, extracting the hard-coded values to build its parameter input pool. On this basis, CDA-TG applies the function invocation sequences to generate an initial set of test cases, where the value of each parameter is selected randomly from its parameter input pool. Finally, to further improve the branch coverage, CDA-TG applies the multiobjective sorting algorithm DynaMOSA to optimize the initial test cases. Our empirical study on 66 real smart contracts verified that CDA-TG can significantly improve the branch coverage of smart contracts, with a 8.86% improvement compared to the state-of-the-art test case generation method AGSolT in cross-contract scenario.
Recent advances in artificial intelligence technology and perception components have promoted the rapid development of autonomous vehicles. However, as safety‐critical software, autonomous driving systems often make wrong judgments, seriously threatening human and property safety. LiDAR is one of the most critical sensors in autonomous vehicles, capable of accurately perceiving the three‐dimensional information of the environment. Nevertheless, the high cost of manually collecting and labeling point cloud data leads to a dearth of testing methods for LiDAR‐based perception modules. To bridge the critical gap, we introduce MetaLiDAR, a novel automated metamorphic testing methodology for LiDAR‐based autonomous driving systems. First, we propose three object‐level metamorphic relations for the domain characteristics of autonomous driving systems. Next, we design three transformation modules so that MetaLiDAR can generate natural‐looking follow‐up point clouds. Finally, we define corresponding evaluation metrics based on metamorphic relations. MetaLiDAR automatically determines whether source and follow‐up test cases meet the metamorphic relations based on the evaluation metrics. Our empirical research on five state‐of‐the‐art LiDAR‐based object detection models shows that MetaLiDAR can not only generate natural‐looking test point clouds to detect 181,547 inconsistent behaviors of different models but also significantly enhance the robustness of models by retraining with synthetic point clouds.
Context: Deep neural networks (DNN) have been widely deployed in safety -critical domains, such as autonomous cars and healthcare, where error behaviors can lead to serious accidents, testing DNN is extremely important. Neuron coverage -guided fuzz testing (NCFT) has become an effective whitebox testing approach for testing DNN, which iteratively generates new test cases with the guidance of neuron coverage to explore different logics of DNN, and has found numerous defects. However, existing NCFT approaches ignore that the role of neurons is distinct for the final output of DNN. Given an input, only a fraction of neurons determines the final output of the DNN. These neurons hold the essential logic of the DNN. Objective: To ensure the quality of DNN and improve testing efficiency, NCFT should first cover neurons containing major logic of DNN. Method: In this paper, we propose the critical neurons that hold essential logic of DNN. In order to prioritize the detection of potential defects of critical neurons, we propose a fuzz testing framework, named CriticalFuzz, which mainly contains the energy -based test case generation and the critical neuron coverage criteria. The energy -based test case generation has the capability to produce test cases that are more likely to cover critical neurons and involves energy -based seed selection, power schedule, and seed mutation. The critical neuron coverage as a mechanism for providing feedback to guide the CriticalFuzz in prioritizing the coverage of critical neurons. To evaluate the significance of critical neurons and the performance of CriticalFuzz, we conducted experiments on popular DNNs and datasets. Results: The experiment results show that (1) the critical neurons have a 100% impact on the output of models, while the non -critical neurons have a lesser effect; (2) CriticalFuzz is effective in achieving 100% coverage of critical neurons and covering 10 classes of critical neurons, outperforming both DeepHunter and TensorFuzz. (3) CriticalFuzz exhibits exceptional error detection capabilities, successfully identifying thousands of errors across 10 diverse error classes within DNN. Conclusion: The critical neurons defined in this paper hold more significant logic of DNN than non -critical neurons. CriticalFuzz can preferentially cover critical neurons, thereby improving the efficiency of the NCFT process. Additionally, CriticalFuzz is capable of identifying a greater number of errors, thus enhancing the reliability and effectiveness of the NCFT.
Blockchain effectively solves the security problem in the information sharing process of Internet of Vehicles (IoV). However, the additional information consensus process inevitably affects the information sharing performance of the Blockchain-based Internet of Vehicles (BlockIoV). In order to satisfies BlockIoV’s performance requirements such as transactions per second, latency, and block utilization, it is necessary to pay attention to the blockchain configuration. Since there exist conflicts among these performance requirements, increasing a single hand may cause other indicators to decrease. Therefore, the performance optimization problem for the information sharing process of BlockIoV can be regarded as a multiobjective optimization problem. In this regard, we propose a BlockIoV-oriented performance optimization method, namely BlockIoVOpt, which utilizes the multi-objective particle swarm optimization algorithm to find the Pareto optimal blockchain configuration. Specifically, we construct the objective functions for each of the performance indicators and design the iterative evolution rules for particle swarms. To obtain the performance results of the objective function under a given blockchain configuration, we also designed a BlockIoV-oriented information sharing process simulator, BlockIoVPref. The experimental results show that: BlockIoVOpt can effectively find the Pareto optimal configuration of the blockchain in a given test scenario and effectively optimize the transactions per second, latency of transaction, and block utilization rate of BlockIoV. This study provides an essential reference for the design of blockchain configuration schemes in information sharing of BlockIoV.
Reentrancy vulnerabilities in Ethereum smart contracts have caused huge financial losses in recent years, promoting the development of reentrancy detection tools. Evaluation of reentrancy detection tools has emerged as an essential research focus consequently. However, despite numerous reentrancy detection evaluation approaches, there is no systematically classified set of reentrancy vulnerabilities in evaluation. This oversight may result in a limited understanding of the actual effectiveness of reentrancy detection tools. This paper employs mutation testing to generate classified sets of reentrancy vulnerabilities and evaluate reentrancy detection tools. To determine the types of reentrancy that can be mutated, we use symbolic execution to identify potential reentrancy paths in smart contracts. For each reentrancy type, we design one to three mutation operators. Then, we employ pattern matching to locate statements where mutation operators can be applied, thus generating sets of reentrancy vulnerabilities of different types. We implemented and compared our mutation testing tool with other tools. Results show that we generated at least 29% more classified reentrancy mutants. Furthermore, we evaluated two state-of-the-art reentrancy detection tools based on the classified reentrancy mutants. The findings provide directions for advancing reentrancy detection tools.
以太坊智能合约管理着大量数字资产,吸引了攻击者的注意,并且由于其不可篡改等性质,安全漏洞难以恢复,一旦攻击成功,将造成不可估量的损失.为了保障以太坊智能合约的安全性,许多研究者对此开展了大量研究工作,取得了丰硕的成果.首先对以太坊智能合约的基础知识进行简单的介绍;然后梳理了 13 个常见的漏洞类型,按照漏洞发生的层级对其进行分类阐述,并列出了相应的攻击事件;进一步总结了四类测试方法及对应的测试工具,为了探究漏洞、测试方法和测试工具之间的关系,对各种测试方法下的测试工具检测的漏洞类型做了详细的梳理;最后,针对目前智能合约测试中存在的问题提出合理的展望.
With the development of artificial intelligence and other fields, the application range of automatic driving system is gradually expanding. Currently, most of the researches on automatic driving system are based on the scene of intersections, and there is a lack of researches based on the scene of high-speed sections.Because the highway is one of the special sections on the road where vehicles travel and the probability of accidents is highest, based on this, this paper proposes a test data generation method for automatic driving system in high-speed scenario. Petri net modeling is carried out on selected highway scenes, and adaptive genetic algorithm is applied to generate test data, which aims to make the test coverage of automatic driving system more comprehensive and more secure application.
模糊测试是一种通过自动化生成随机输入来检测软件漏洞的高效测试方法.目前针对深度学习的模糊测试研究主要基于各类覆盖率生成测试数据,重点关注测试的充分性而忽略了与模型鲁棒性的联系.兼顾测试充分性和模型鲁棒性,提出了一种模糊测试联合优化技术.首先,将神经元覆盖率和鲁棒性指标作为联合优化目标函数:然后,运用差分进化算法求解联合优化问题,指导变异数据的生成;最后,在保证数据质量这一约束条件下迭代完成测试数据的生成.
图像分类是人工智能技术的重要分支,被广泛应用在安全关键的领域,如自动驾驶、人脸识别、视频监控等.图像分类软件的潜在安全漏洞可能会造成严重的危害,所以保障其质量、评估其鲁棒性的工作尤为重要.考虑到图像分类软件内部逻辑不明确、难以构造预期输出的特点,采用蜕变测试解决它的测试预言问题.同时,考虑到颜色特征的变换对分类结果的影响,比如:绿色背景下穿同色系衣服的人能否被正确分类,提出了基于颜色特征的鲁棒性评估方法,通过将图像进行分割,改变背景图与主体图之间的颜色差异的方式来评估图像分类软件对颜色特征变换的鲁棒性,最后定量分析了鲁棒性指标.