Deep Learning-Based Detection of Prompt Injection Attacks in Turkish Inputs


SALMAN YILMAZ S., Bilgin A. F., Ozcam B., AYDIN M. A.

2026 11th International Conference on Computer Science and Engineering, UBMK 2026, İstanbul, Türkiye, 16 - 18 Eylül 2026, ss.60-65, (Tam Metin Bildiri)

  • Yayın Türü: Bildiri / Tam Metin Bildiri
  • Doi Numarası: 10.1109/ubmk71847.2026.11745232
  • Basıldığı Şehir: İstanbul
  • Basıldığı Ülke: Türkiye
  • Sayfa Sayıları: ss.60-65
  • Anahtar Kelimeler: cybersecurity, large language model, natural language processing, prompt injection
  • İstanbul Üniversitesi-Cerrahpaşa Adresli: Evet

Özet

Large Language Models (LLMs) are increasingly deployed across critical domains such as software development, education, healthcare, finance, and cybersecurity. However, their rapid adoption has introduced novel security risks, particularly prompt injection attacks, in which adversarial inputs are used to manipulate system instructions and bypass safety mechanisms. While existing detection studies have predominantly focused on English- language datasets, Turkish-language cybersecurity resources remain scarce, and direct translation methods often compromise the semantic integrity of technical terminology in morphologically rich languages such as Turkish. To address these gaps, this study proposes a data-driven detection methodology that evaluates seven model configurations. These configurations combine TF-IDF and BERT-based vectorization strategies with classical classifiers (Logistic Regression, XGBoost, CatBoost) as well as a fine-tuned Transformer model for detecting prompt injection attacks in Turkish natural language inputs. A hybrid Turkish dataset consisting of 3,096 samples, comprising 1,570 malicious and 1,526 benign prompts, was constructed by combining open-source datasets, platform-based web scraping from Reddit and Discord, and synthetic generation methods. To mitigate semantic degradation during translation, a novel technical term masking algorithm was developed, which identifies cybersecurity-specific terms and preserves them through controlled substitution prior to multilingual translation. The fine-tuned BERTurk (dbmdz/bert-base-turkish-cased) model achieved a mean accuracy of 95.57% and a mean F1-score of 95.59% under 5-fold cross-validation, consistent with the 95.37% F1- score obtained on the held-out test set. Among classical configurations, BERT Embedding combined with Logistic Regression attained the highest F1-score of 92.11% under 5-fold cross-validation. Five of the seven evaluated configurations surpassed the existing Turkish baseline of 87% F1-score reported in the literature, demonstrating that high- quality, language-aware datasets combined with targeted preprocessing strategies can substantially advance cybersecurity-oriented NLP for morphologically complex languages.