MCGMark: An Encodable and Robust Online Watermark for Tracing LLM-Generated Malicious Code

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Ning, Kaiwen, Chen, Jiachi, Zhong, Qingyuan, Zhang, Tao, Wang, Yanlin, Li, Wei, Zhang, Jingwen, Yu, Jianxing, Feng, Yuming, Zhang, Weizhe, Zheng, Zibin
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908327390216192
author Ning, Kaiwen
Chen, Jiachi
Zhong, Qingyuan
Zhang, Tao
Wang, Yanlin
Li, Wei
Zhang, Jingwen
Yu, Jianxing
Feng, Yuming
Zhang, Weizhe
Zheng, Zibin
author_facet Ning, Kaiwen
Chen, Jiachi
Zhong, Qingyuan
Zhang, Tao
Wang, Yanlin
Li, Wei
Zhang, Jingwen
Yu, Jianxing
Feng, Yuming
Zhang, Weizhe
Zheng, Zibin
contents With the advent of large language models (LLMs), numerous software service providers (SSPs) are dedicated to developing LLMs customized for code generation tasks, such as CodeLlama and Copilot. However, these LLMs can be leveraged by attackers to create malicious software, which may pose potential threats to the software ecosystem. For example, they can automate the creation of advanced phishing malware. To address this issue, we first conduct an empirical study and design a prompt dataset, MCGTest, which involves approximately 400 person-hours of work and consists of 406 malicious code generation tasks. Utilizing this dataset, we propose MCGMark, the first robust, code structure-aware, and encodable watermarking approach to trace LLM-generated code. We embed encodable information by controlling the token selection and ensuring the output quality based on probabilistic outliers. Additionally, we enhance the robustness of the watermark by considering the structural features of malicious code, preventing the embedding of the watermark in easily modified positions, such as comments. We validate the effectiveness and robustness of MCGMark on the DeepSeek-Coder. MCGMark achieves an embedding success rate of 88.9% within a maximum output limit of 400 tokens. Furthermore, it also demonstrates strong robustness and has minimal impact on the quality of the output code. Our approach assists SSPs in tracing and holding responsible parties accountable for malicious code generated by LLMs.
format Preprint
id arxiv_https___arxiv_org_abs_2408_01354
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle MCGMark: An Encodable and Robust Online Watermark for Tracing LLM-Generated Malicious Code
Ning, Kaiwen
Chen, Jiachi
Zhong, Qingyuan
Zhang, Tao
Wang, Yanlin
Li, Wei
Zhang, Jingwen
Yu, Jianxing
Feng, Yuming
Zhang, Weizhe
Zheng, Zibin
Cryptography and Security
Software Engineering
With the advent of large language models (LLMs), numerous software service providers (SSPs) are dedicated to developing LLMs customized for code generation tasks, such as CodeLlama and Copilot. However, these LLMs can be leveraged by attackers to create malicious software, which may pose potential threats to the software ecosystem. For example, they can automate the creation of advanced phishing malware. To address this issue, we first conduct an empirical study and design a prompt dataset, MCGTest, which involves approximately 400 person-hours of work and consists of 406 malicious code generation tasks. Utilizing this dataset, we propose MCGMark, the first robust, code structure-aware, and encodable watermarking approach to trace LLM-generated code. We embed encodable information by controlling the token selection and ensuring the output quality based on probabilistic outliers. Additionally, we enhance the robustness of the watermark by considering the structural features of malicious code, preventing the embedding of the watermark in easily modified positions, such as comments. We validate the effectiveness and robustness of MCGMark on the DeepSeek-Coder. MCGMark achieves an embedding success rate of 88.9% within a maximum output limit of 400 tokens. Furthermore, it also demonstrates strong robustness and has minimal impact on the quality of the output code. Our approach assists SSPs in tracing and holding responsible parties accountable for malicious code generated by LLMs.
title MCGMark: An Encodable and Robust Online Watermark for Tracing LLM-Generated Malicious Code
topic Cryptography and Security
Software Engineering
url https://arxiv.org/abs/2408.01354