量子安全代码审计:基于LLM的静态分析与量子感知风险评分用于后量子密码学迁移
Quantum-Safe Code Auditing: LLM-Assisted Static Analysis and Quantum-Aware Risk Scoring for Post-Quantum Cryptography Migration
AI总结:
本文提出量子安全代码审计工具,结合正则表达式检测量子脆弱算法、LLM辅助上下文丰富及VQE模型风险评分,评估五个开源库发现5775项问题,实现高精度和召回率。
摘要:
随着具有密码学意义的量子计算机的临近,现代软件的安全基础受到威胁:Shor算法可破解RSA、ECDSA、ECDH和Diffie-Hellman,而Grover算法降低对称和哈希方案的有效安全性。尽管NIST于2024年标准化后量子密码学(PQC)(FIPS 203 ML-KEM,FIPS 204 ML-DSA,FIPS 205 SLH-DSA),但大多数代码库缺乏自动化工具来盘点经典密码学使用并基于量子风险优先迁移。我们提出了Quantum-Safe Code Auditor,一种量子感知的静态分析框架,结合(i)基于正则表达式的15类量子脆弱原语检测,(ii)LLM辅助上下文丰富以分类使用和严重性,以及(iii)通过Qiskit 2.x实现的变分量子本征求解器(VQE)模型进行风险评分,纳入量子位成本估计以优先考虑发现。我们在五个开源库上评估该系统——python-rsa、python-ecdsa、python-jose、node-jsonwebtoken和Bouncy Castle Java,共发现5,775项问题。在602个标记实例的分层样本上,我们实现了71.98%的精度、100%的召回率和83.71%的F1分数。所有代码、数据和复现脚本均作为开源发布。
英文摘要:
The impending arrival of cryptographically relevant quantum computers (CRQCs) threatens the security foundations of modern software: Shor's algorithm breaks RSA, ECDSA, ECDH, and Diffie-Hellman, while Grover's algorithm reduces the effective security of symmetric and hash-based schemes. Despite NIST standardising post-quantum cryptography (PQC) in 2024 (FIPS 203 ML-KEM, FIPS 204 ML-DSA, FIPS 205 SLH-DSA), most codebases lack automated tooling to inventory classical cryptographic usage and prioritise migration based on quantum risk. We present Quantum-Safe Code Auditor, a quantum-aware static analysis framework that combines (i) regex-based detection of 15 classes of quantum-vulnerable primitives, (ii) LLM-assisted contextual enrichment to classify usage and severity, and (iii) risk scoring via a Variational Quantum Eigensolver (VQE) model implemented in Qiskit 2.x, incorporating qubit-cost estimates to prioritise findings. We evaluate the system across five open-source libraries -- python-rsa, python-ecdsa, python-jose, node-jsonwebtoken, and Bouncy Castle Java -- covering 5,775 findings. On a stratified sample of 602 labelled instances, we achieve 71.98% precision, 100% recall, and an F1 score of 83.71%. All code, data, and reproduction scripts are released as open-source.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。