Melola Discovery

← Melola Discovery

Open access Jurnal SINTA 1

Adaptive Multi‑Layer Framework for Detecting and Mitigating Prompt Injection Attacks in Large Language Models

Journal of Information Systems Engineering and Business Intelligence · Vol. 11 No. 3 (2025) · pp. 473–487

DOI
10.20473/jisebi.11.3.473-487
ISSN
2443-2555, 2598-6333
Published
2025-10-28
Publisher
Universitas Airlangga
Language
eng
License
creativecommons.org/licenses/by/4.0

Abstract

Background: Prompt injection attacks are methods that exploit the instruction‐following nature of fine‐tuned large language models (LLMs), leading to the execution of unintended or malicious commands. This vulnerability shows the limitation of traditional defenses, including static filters, keyword blocks, and multi‐LLMs cross‐checks, which lack semantic understanding or incur high latency and operational overhead. Objective: This study aimed to develop and evaluate a lightweight adaptive framework capable of detecting and neutralizing prompt injection attacks in real-time. Methods: Prompt-Shield Framework (PSF) was developed around a locally hosted Llama 3.2 API. This PSF integrated three modules, namely Context-Aware Parsing (CAP), Output Validation (OV), and Self-Feedback Loop (SFL), to pre-filter inputs, validate outputs, and iteratively refine detection rules. Subsequently, five scenarios were tested, comprising baseline (without any defenses), CAP only, OV only, CAP+OV, and CAP+OV+SFL. The evaluation was performed over a near-balanced dataset of 1,405 adversarial and 1,500 benign prompt, measuring classification performance through confusion matrices, precision, recall, and accuracy. Results: The results showed that baseline achieved 63.06% accuracy (precision = 0.678; recall = 0.450), while OV only improved performance to 79.28% (precision = 0.796; recall = 0.768). CAP reached 84.68% accuracy (precision = 0.891; recall = 0.779), while CAP+OV yielded 95.25% accuracy (precision = 0.938; recall = 0.966). Finally, integrating SFL over 10 epochs further improved performance to 97.83% accuracy (precision = 0.980; recall = 0.975) and reduced the false-negative count from 48 (CAP+OV) to 35 (CAP+OV+SFL). Conclusion: The results show the significance of using multiple defenses, such as contextual understanding, OV, and adaptive learning fusion, which are needed for efficient prompt injection mitigation. This shows that PSF framework is an effective solution to protect LLMs against advancing threats. Moreover, further studies should aim to refine the adaptive thresholds in CAP and OV, particularly in multilingual or highly specialized environments, and examine other forms of SFL solutions for better efficiency. Keywords: Prompt Injection, LLMs Security, Jailbreak, Natural Language Processing

Collaboration network of the authors

8 authors · 10 co-authorship links · 2 across different organisations

Hover or tap a name to highlight its co-authors. Double-click to open the author's page.

  • Politeknik Siber dan Sandi Negara
  • Sunan Kalijaga State Islamic University Yogyakarta
  • Affiliation unknown
  • Different organisations
  • Same organisation
  • Affiliation unknown
  • Thicker line = more joint articles · bigger circle = more articles
Show as table
Co-authorOrganisationJoint articles
Apriza Noer RamadhanPoliteknik Siber dan Sandi Negara1
David HerdiantoPoliteknik Siber dan Sandi Negara1
Muhammad Faqih RohmaniAffiliation unknown1
Erni MunastiwiSunan Kalijaga State Islamic University Yogyakarta1
Tiarani MirelaSunan Kalijaga State Islamic University Yogyakarta1

Affiliations come from OpenAlex; journal OAI-PMH metadata carries none. Authors without an OpenAlex ID are matched by name, which can merge or split people.

Metadata source: OAI-PMH (metadata jurnal) https://e-journal.unair.ac.id/JISEBI/oai, first harvested 29 Okt 2026, last seen 1 Nov 2026.
Original metadata (oai_dc)
<oai_dc:dc xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/  http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
	<dc:title xml:lang="en-US">Adaptive Multi‑Layer Framework for Detecting and Mitigating Prompt Injection Attacks in Large Language Models</dc:title>
	<dc:creator>Hadiprakoso, Raden Budiarto</dc:creator>
	<dc:creator>Wilujengning , Wiyar</dc:creator>
	<dc:creator>Amiruddin, Amiruddin</dc:creator>
	<dc:description xml:lang="en-US">Background: Prompt injection attacks are methods that exploit the instruction‐following nature of fine‐tuned large language models (LLMs), leading to the execution of unintended or malicious commands. This vulnerability shows the limitation of traditional defenses, including static filters, keyword blocks, and multi‐LLMs cross‐checks, which lack semantic understanding or incur high latency and operational overhead.
Objective: This study aimed to develop and evaluate a lightweight adaptive framework capable of detecting and neutralizing prompt injection attacks in real-time.
Methods: Prompt-Shield Framework (PSF) was developed around a locally hosted Llama 3.2 API. This PSF integrated three modules, namely Context-Aware Parsing (CAP), Output Validation (OV), and Self-Feedback Loop (SFL), to pre-filter inputs, validate outputs, and iteratively refine detection rules. Subsequently, five scenarios were tested, comprising baseline (without any defenses), CAP only, OV only, CAP+OV, and CAP+OV+SFL. The evaluation was performed over a near-balanced dataset of 1,405 adversarial and 1,500 benign prompt, measuring classification performance through confusion matrices, precision, recall, and accuracy.
Results: The results showed that baseline achieved 63.06% accuracy (precision = 0.678; recall = 0.450), while OV only improved performance to 79.28% (precision = 0.796; recall = 0.768). CAP reached 84.68% accuracy (precision = 0.891; recall = 0.779), while CAP+OV yielded 95.25% accuracy (precision = 0.938; recall = 0.966). Finally, integrating SFL over 10 epochs further improved performance to 97.83% accuracy (precision = 0.980; recall = 0.975) and reduced the false-negative count from 48 (CAP+OV) to 35 (CAP+OV+SFL).
Conclusion: The results show the significance of using multiple defenses, such as contextual understanding, OV, and adaptive learning fusion, which are needed for efficient prompt injection mitigation. This shows that PSF framework is an effective solution to protect LLMs against advancing threats. Moreover, further studies should aim to refine the adaptive thresholds in CAP and OV, particularly in multilingual or highly specialized environments, and examine other forms of SFL solutions for better efficiency.
 Keywords: Prompt Injection, LLMs Security, Jailbreak, Natural Language Processing</dc:description>
	<dc:publisher xml:lang="en-US">Universitas Airlangga</dc:publisher>
	<dc:date>2025-10-28</dc:date>
	<dc:type>info:eu-repo/semantics/article</dc:type>
	<dc:type>info:eu-repo/semantics/publishedVersion</dc:type>
	<dc:format>application/pdf</dc:format>
	<dc:format>text/xml</dc:format>
	<dc:identifier>https://e-journal.unair.ac.id/JISEBI/article/view/69403</dc:identifier>
	<dc:identifier>10.20473/jisebi.11.3.473-487</dc:identifier>
	<dc:source xml:lang="en-US">Journal of Information Systems Engineering and Business Intelligence; Vol. 11 No. 3 (2025): October; 473-487</dc:source>
	<dc:source>2443-2555</dc:source>
	<dc:source>2598-6333</dc:source>
	<dc:language>eng</dc:language>
	<dc:relation>https://e-journal.unair.ac.id/JISEBI/article/view/69403/34433</dc:relation>
	<dc:relation>https://e-journal.unair.ac.id/JISEBI/article/view/69403/35465</dc:relation>
	<dc:rights xml:lang="en-US">Copyright (c) 2025 The Authors. Published by Universitas Airlangga.</dc:rights>
	<dc:rights xml:lang="en-US">http://creativecommons.org/licenses/by/4.0</dc:rights>
</oai_dc:dc>