D2ANN-RL: Defense-in-Depth ANN-Reinforcement Learning Framework for LLM Chatbot Code Injection Mitigation

Read full text
Authors: Victor Omoboye Oluwasegun, Oluwatosin Samuel Falebita, Nabeela Temitayo Adebola, Victor A. Adekunle, Divine Chukwuemeka Uzodinma, Toluhi Michael Lanre, David Oyewumi Taiwo Oyekunle, Chima-Duru Goodness Goziechukwu, Ugochukwu Okwudili Matthew
Cited by: 1

Abstract

The growing cybersecurity vulnerabilities in artificial intelligence (AI) service models, particularly Large Language Models (LLMs), highlight code injection as a critical threat to chatbot reliability and safe deployment. On the account that LLMs process inputs as undifferentiated token sequences, they cannot reliably distinguish trusted system prompts from untrusted user inputs. This architectural limitation enables attackers to exploit direct and indirect prompt injection channels, resulting in insecure code generation, altered execution flows, and potential data exfiltration or remote code execution. In mission critical environments such as cloud platforms, IoT ecosystems, and defense systems, these risks escalate into unauthorized access and operational compromise. To address this challenge, the present study introduced a D2ANN-RL framework that integrates input/output sanitization, context isolation, sandboxing, and secure prompt engineering, supported by hybridization of Artificial Neural Network (ANN)–Reinforcement Learning (RL) detection model. The ANN component ensures robust feature extraction, while RL dynamically adapts defense strategies to evolving adversarial vectors. Computational evaluation demonstrates the framework’s effectiveness, achieving 96.95% detection accuracy, precision of 96.9%, recall of 97%, and F-Score of 96.95%. The Defense Performance Index (DPI) reached 84.9%, validating model resilience, scalability, and balanced classification integrity. These findings highlight the broader implications of deploying transparent, adaptive, and generalizable safeguards for LLM based chatbot systems, advancing secure AI integration and mitigating systemic vulnerabilities in mission critical operations.

Fields of Study & Subjects

Adversarial Robustness in Machine Learning Advanced Malware Detection Techniques Security and Verification in Computing

Publication details

Journal / source
Scientific Journal of Computer Science
Publisher
PT. Teknologi Futuristik Indonesia
Volume
2
Issue
2
Pages
312–329
Publication date
2 August 2026