mlsanityData to 14 Oct 2026

Activating Latent Security Knowledge through LLM-Guided Risk Analysis for Secure Code Generation

arXiv 2606.16244 ↗First posted 15 Jun 2026cs.CR cs.AIcited by 0

Not on the map. Why?

Abstract (arXiv)

Large language models are pretrained on extensive software and security corpora, yet they frequently generate functionally correct code containing well-known vulnerabilities. Existing defenses commonly treat this behavior as a knowledge deficit, addressing it through model-specific fine-tuning or retrieval from large collections of vulnerability code examples. We argue that insecure generation can arise from a failure to activate task-relevant security knowledge, rather than from knowledge absence alone. We present BRACE, an inference-time, training-free security harness for risk-conditioned activation of security knowledge in black-box code generation. Given only a coding task, BRACE first utilizes an LLM (as a security expert) to identify task-relevant security risks. The predicted risk identifiers are validated against a lightweight canonical catalog and converted into concise, task-specific risk cues. BRACE then supplies these cues to the target code model, prompting it to apply its own secure-coding knowledge while satisfying the original functional requirements. The framework requires no target-model fine-tuning, parameter access, hidden states, mutable logits, learned retriever, or coding-example knowledge base. We evaluate BRACE on six open-weight models and six frontier commercial models with four benchmarks (CyberNative, HumanEval, CWEval, BaxBench), measuring functional correctness, security, joint functionality-security, and project-level generation. BRACE raises the average Safe Code Rate from 33.9% under Secure Prompt to 91.2% on CyberNative. It also improves CWEval Func-Sec performance from 49.7% to 69.6%. Mechanism-oriented ablations further show that the gains depend on selecting task-relevant risks.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 22 of its 33 references that are in the map. First posted on arXiv 15 Jun 2026.

Builds on

22 of 33 references.

References · 22

  1. 2025Qwen3 Technical Reportcited by 8,820
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  3. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  4. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
  5. 2026DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligencecited by 1,040
  6. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  7. 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 197
  8. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
  9. 2024LoRA vs Full Fine-tuning: An Illusion of Equivalencecited by 109
  10. 2023How Secure is Code Generated by ChatGPT?cited by 81
  11. 2024Instruction Tuning for Secure Code Generationcited by 68
  12. 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 62
10 more
  1. 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 59
  2. 2024CYBERSECEVAL 3: Advancing the Evaluation of Cybersecurity Risks and Capabilities in Large Language Modelscited by 58
  3. 2025BaxBench: Can LLMs Generate Correct and Secure Backends?cited by 41
  4. 2024PromSec: Prompt Optimization for Secure Generation of Functional Source Code with Large Language Models (LLMs)cited by 19
  5. 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injectioncited by 16
  6. 2026Reducing False Positives in Static Bug Detection with LLMs: An Empirical Study in Industrycited by 5
  7. 2026Persistent Human Feedback, LLMs, and Static Analyzers for Secure Code Generation and Vulnerability Detectioncited by 5
  8. 2026GoodVibe: Security-by-Vibe for LLM-Based Code Generationcited by 4
  9. 2025Towards Effective Complementary Security Analysis using Large Language Modelscited by 1
  10. 2026Autoregressive, Yet Revisable: In Decoding Revision for Secure Code Generationcited by 1

Built on by

Not cited yet.