西安电子科技大学学报(自然科学版)2026,Vol.53Issue(3):103-119,17.DOI:10.19665/j.issn1001-2400.20260101
基于类词元自注意力的SM4算法端到端建模攻击
End-to-end profiled attack on SM4 leveraging self-attention with a class token
摘要
Abstract
The security of cryptographic devices is vital,and power analysis is a key method for evaluating the security of hardware.However,the existing power analytical study of devices implementing the SM4 cipher has not adequately addressed protected cryptographic devices,which makes direct applications to the analysis of raw power trace in real-world scenarios challenging.Additionally,current end-to-end profiling attack frameworks on raw traces face limitations on information aggregation efficiency.To overcome these challenges,we propose an end-to-end profiling attack framework based on the self-attention mechanism and evaluate the side-channel resistance of SM4 encryption devices with protection measures.First,trainable class-token representations are introduced and processed in parallel with preprocessed trace tokens through a multi-layer self-attention encoder.Second,to enhance the information aggregation efficiency of the network,only the output that corresponds to the class-token representations is used for classification.Finally,by utiliz-ing the proposed framework,we conduct end-to-end profiling attacks on SM4 encryption devices with masking and random delay countermeasures.To protect the encryption devices,a lightweight second-order masking scheme is applied,which is based on the signal-to-noise ratios of the intermediate variables in the SM4 cipher,obscuring the power consumption characteristics of leakage variables.In addition,random delay noise is added into the power traces,creating four datasets with different protection configurations for SM4 encryption devices.In the profiling stage,the proposed framework achieves a higher accuracy than existing end-to-end profiling frameworks in all four experiments with a lower training time complexity in three of them.In the attack stage,2,19,23,and 71 power traces are required to recover key bytes under no delay and 1×,2×,and 4×clock-cycle random delay protections,respectively.To evaluate the model's performance in more stringent scenarios,we implement cryptographic devices with third-order masking and random delay cross-protection,apply the proposed network structure for profiling attacks,and conduct key recovery experiments in a single-core CPU environment to assess the time cost of key recovery in resource-constrained scenarios.Thus,the proposed network architecture significantly improves the information aggregation efficiency in end-to-end profiling attack frameworks and successfully performs a power analysis of raw power traces leaked from SM4 encryption devices.关键词
SM4算法/侧信道攻击/端到端建模攻击/类词元/自注意力模型Key words
SM4 algorithm/side-channel attack/end-to-end profied attack/class token/self-attention分类
信息技术与安全科学引用本文复制引用
张雨,王子龙,柴进晋,任思语,张柳..基于类词元自注意力的SM4算法端到端建模攻击[J].西安电子科技大学学报(自然科学版),2026,53(3):103-119,17.基金项目
国家密码科学基金(2025NCSF02016) (2025NCSF02016)
国家自然科学基金(62572369) (62572369)
陕西省自然科学基金(2024JC-YBQN-0677) (2024JC-YBQN-0677)