Skip to content
Open access

Robust Detection of XSS and SQL Injection in JSON-API Traffic via JSON-Aware Canonicalization and Few-Shot Adversarial Fine-Tuning

Jul 2026 · Journal of Applied Science and Technology Trends · 0 citations · 25 references

TL;DR

A deployment-minded pipeline that integrates JSON-aware  canonicalization that standardizes benign representational variance while preserving attack-relevant semantics, with the largest reductions on JSON wrapping and on multi-step chains such as homoglyph ?

Abstract

Deep-learning detectors for web attacks perform strongly on clean data yet remain brittle to semantics-preserving obfuscations, especially  in JSON centric API traffic where identical malicious intent can appear under varied encodings, Unicode confusables,  whitespace/comment patterns, or JSON carrier forms. We present a deployment-minded pipeline that integrates: (i) JSON-aware  canonicalization that standardizes benign representational variance while preserving attack-relevant semantics; (ii) multi-seed training  of BiLSTM-Attention and CharCNN detectors; (iii) black-box robustness evaluation using a bounded reinforcement-learning (RL)  adversary and per-mutator Attack Evasion Rate (AER); (iv) few-shot adversarial fine-tuning (FSAT) on curated hard cases; and (v)  temperature scaling with per-class thresholds, together with cloud-style latency profiling. On a three-class corpus stratified into  Train/Validation/Test = 173,872 / 37,258 / 37,259 and augmented with JSON-native payloads, an RL set (6,821 train / 2,882 holdout), and  a few-shot set (n = 1,499; 48.3% JSON), the BiLSTM-Attention model with canonicalization achieves clean-test macro-F1 = 0.9879 ±  0.0007, precision = 0.9889 ± 0.0007, recall = 0.9871 ± 0.0007, and accuracy = 0.9875 ± 0.0007 across three seeds. For the selected robust  configuration, per-class threshold calibration (0.4 / 0.6 / 0.6) yields validation macro-F1 = 0.9881. Canonicalization reduces AER across  common mutator families, with the largest reductions on JSON wrapping and on multi-step chains such as homoglyph ? URL-encode ? whitespace. After FSAT, the calibrated canon_on model attains clean-test precision = 0.9891, recall = 0.9870, macro-F1 = 0.9880, and  accuracy = 0.9877, while reaching RL-holdout precision = 1.0000, recall = 1.0000, F1 = 1.0000, and accuracy = 1.0000 against the evaluated  bounded black-box RL attacker. Median latency at 8 KB is 79.6 ms (P95 95.8 ms), indicating practical feasibility for API-gateway  deployment. 

Read PDF

Similar papers

Open access Aug 2026

Real-Time Detection and Mitigation of Prompt Injection Attacks in LLM-Integrated Enterprise Systems

Large language models (LLMs) embedded in enterprise workflows cannot structurally distinguish legitimate instructions from adversarial ones in the same token stream, making prompt injection OWASP's top LLM risk for two consecutive editions a persistent threat across direct and indirect vectors. This paper presents Prom...

Fatimah Alhamzawi · 0 citations
2026

HotPatchCaps: A Capsule Network With Runtime Hot Patching for Zero-Day API Attack Detections

Modern services are awash in Application Programming Interfaces (APIs), yet most security pipelines end at pre-deployment testing using fuzzers and scanners. This leaves a run-time gap where payload obfuscation and other evolving request-visible misuse patterns outpace static rules and slow retraining cycles. We presen...

Tong Li, Shicheng Wei, Wencheng Yang et al. · 0 citations
Jul 2026

EXE-Bench: Ranking the Tradeoffs of AI-based Windows Malware Detectors for Real-World Usability

ExE-Bench assesses performance, temporal and adversarial robustness, and computational overhead, aggregating them into a single score for direct and fair model comparison, and highlights how evaluations conducted only after deployment are suboptimal and unable to provide a complete picture of their performance.

Andrea Ponte, Daniel Gibert, M. Kozák et al. · 0 citations
Conference Open access 2026

NaturalSloth: Revisiting Denial-of-Service Attacks on Large Language Models

This work introduces NaturalSloth, an adversarial dataset of natural, instruction-based DoS prompts, and designs a multi-agent synthesis framework to scale the dataset while preserving malicious intent and increasing semantic diversity.

Yiming Chen, Zexin Li, Xianghu Yue et al. · 0 citations
Conference Open access Sep 2026

GRASP: Hard-Label Black-Box Malware Evasion with Higher Success, Fewer Queries, and Smaller Perturbations

Gradient-seeded Reinforcement Learning And Stealthy Pruning (GRASP), a three-stage framework that tackles challenges of adversarial attacks on machine learning-based malware detectors, and out-performs baselines, achieving higher attack success with fewer queries and smaller file-size inflation.

Yu-Tong Liu, Jian-Ting Ning, Qi Feng et al. · 1 citation

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.