SymSan: Mitigating Malware Embedding in Large Language Models via Parameter Space Symmetry
Abstract
Despite the considerable advantages of open-source large language models (LLMs) in terms of interpretability and customizability, the full-access sharing paradigm inevitably exposes them to a severe security threat, i.e., malware embedding attacks (MEAs), where adversaries embed malware binaries (i.e., payloads) into model parameters for subsequent execution. While existing sanitization defenses have been explored to eliminate payloads within parameters, they exhibit limited generalization against emerging MEAs and lack theoretical guarantees for model utility preservation. In this paper, we propose SymSan, an effective LLM sanitization method grounded in parameter space symmetry theory. SymSan leverages rigorously designed permutation and scaling symmetries, systematically transforming parameter matrices across complementary component pairs, thereby eliminating embedded payloads while ensuring mathematical functional equivalence. Experiments across diverse LLMs against a wide spectrum of MEAs demonstrate that SymSan achieves at least 0.47 BER against all evaluated existing MEAs while maintaining equivalent model performance on both foundational and downstream tasks, significantly outperforming all baselines.