MalRefiner: Recovering Malware Semantics via Reinforcement Learning-Based Semantic NOP Removal
Adversarial evasion against learning-based malware detectors has shifted from feature-space perturbations to semantic-preserving, problem-space manipulations. In this paradigm, attackers inject semantic NOPs—functionally NOP instructions that shift the static feature distribution—into assembly code to suppress detection confidence. Existing defenses primarily recalibrate classifier decision boundaries, leaving the adversarially modified malware intact and thereby hindering downstream tasks including but not limited to malicious API localization and capability attribution. We introduce MalRefiner, a reinforcement-learning agent that automatically identifies and removes adversarially inserted semantic NOPs to restore the original malicious representation. The recovery process is formulated as a Markov Decision Process, where a policy network sequentially decides whether to retain or remove each opcode. The agent is trained with a composite reward function that balances detection confidence recovery with semantic preservation, guided by a lightweight 1D causal convolutional environment providing compact state representations and delayed rewards. Extensive evaluation on the PEMML and RawMal-TF datasets against four state-of-the-art detectors (1D CNN, MalConv, TCN, and MALIGN) demonstrates that MalRefiner restores F1 to within 3.18 ± 0.94% of the clean baseline and achieves a recovery rate exceeding 90% across all models and datasets, without requiring retraining or architectural modification of the target classifier.
Authors
- Jiankun Sun (ORCID: https://orcid.org/0000-0002-4842-6399)
- Chengxi Xu (ORCID: https://orcid.org/0000-0001-7405-7710)
- Miao Hu (ORCID: https://orcid.org/0009-0005-9691-4011)
- Cheng Huang (ORCID: https://orcid.org/0000-0002-5871-946X)
- Fan Shi (ORCID: https://orcid.org/0000-0002-8033-4670)
- Min Zhang (ORCID: https://orcid.org/0000-0003-4082-7486)
- Pengfei Xue (ORCID: https://orcid.org/0009-0001-8102-5239)
Institutions
- National University of Defense Technology (CN)
- Sichuan University (CN)
Publication Details
- Journal
- Applied Sciences
- Published
- 2025-11-12
- DOI
- https://doi.org/10.3390/app152212015
- Primary Topic
- Adversarial Robustness in Machine Learning
- Type
- article
- Field-Weighted Citation Impact
- 0.00