mlsanityData to 14 Oct 2026

Can LLMs Handle WebShell Detection? Overcoming Detection Challenges with Behavioral Function-Aware Framework

arXiv 2504.13811 ↗First posted 14 Apr 2025cs.CR cs.LGcited by 6

Not on the map. Why?

Abstract (arXiv)

WebShell attacks - where adversaries implant malicious scripts on web servers - remain a persistent threat. Prior machine-learning and deep-learning detectors typically depend on task-specific supervision and can be brittle under data scarcity, rapid concept drift, and out-of-distribution (OOD) deployment. Large language models (LLMs) have recently shown strong code understanding capabilities, but their reliability for WebShell detection remains unclear. We address this gap by (i) systematically evaluating seven LLMs (including GPT-4, LLaMA-3.1-70B, and Qwen-2.5 variants) against representative sequence- and graph-based baselines on 26.59K PHP scripts, and (ii) proposing Behavioral Function-Aware Detection (BFAD), a behavior-centric framework that adapts LLM inference to WebShell-specific execution patterns. BFAD anchors analysis on security-sensitive PHP functions via a Critical Function Filter, constructs compact LLM inputs with Context-Aware Code Extraction, and selects in-context demonstrations using Weighted Behavioral Function Profiling, which ranks examples by a behavior-weighted, function-level similarity. Empirically, we observe a consistent precision-recall asymmetry: larger LLMs often achieve high precision but miss attacks (lower recall), while smaller models exhibit the opposite tendency; moreover, off-the-shelf LLM prompting underperforms established detectors. BFAD substantially improves all evaluated LLMs, boosting F1 by 13.82% on average; notably, GPT-4, LLaMA-3.1-70B, and Qwen-2.5-Coder-14B exceed prior SOTA benchmarks, while Qwen-2.5-Coder-3B becomes competitive with traditional methods. Overall, our results clarify when LLMs succeed or fail on WebShell detection, provide a practical recipe, and highlight future directions for making LLM-based detection more reliable.

Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 23 of its 45 references that are in the map. First posted on arXiv 14 Apr 2025.

Builds on

23 of 45 references.

References · 23

  1. 2023GPT-4 Technical Reportcited by 18,396
  2. 2024The Llama 3 Herd of Modelscited by 14,715
  3. 2024Qwen2.5 Technical Reportcited by 4,942
  4. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
  5. 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 740
  6. 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completioncited by 112
  7. 2023Mitigating Label Biases for In-context Learningcited by 89
  8. 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoningcited by 59
  9. 2023Large Language Models for Code Analysis: Do LLMs Really Do Their Job?cited by 45
  10. 2024Chain-of-Thought Prompting of Large Language Models for Discovering and Fixing Software Vulnerabilitiescited by 31
  11. 2023On the Reliability and Explainability of Language Models for Program Generationcited by 17
  12. 2024SparseCoder: Identifier-Aware Sparse Transformer for File-Level Code Summarizationcited by 11
11 more
  1. 2025Read Before You Think: Mitigating LLM Comprehension Failures with Step-by-Step Readingcited by 10
  2. 2023Towards Informative Few-Shot Prompt with Maximum Information Gain for In-Context Learningcited by 9
  3. 2024Focused Large Language Models are Stable Many-Shot Learnerscited by 8
  4. 2023STACC: Code Comment Classification using SentenceTransformerscited by 5
  5. 2024Can LLM Prompting Serve as a Proxy for Static Analysis in Vulnerability Detectioncited by 4
  6. 2025Enhancing Input-Label Mapping in In-Context Learning with Contrastive Decodingcited by 4
  7. 2023A ML-LLM pairing for better code comment classificationcited by 2
  8. 2024Large Language Models are Few-shot Generators: Proposing Hybrid Prompt Algorithm To Generate Webshell Escape Samplescited by 2
  9. 2024Text Classification: Neural Networks VS Machine Learning Models VS Pre-trained Modelscited by 2
  10. 2025Poster: Long PHP webshell files detection based on sliding window attentioncited by 2
  11. 2023LLM-augmented Preference Learning from Natural Languagecited by 1

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 4; 2026: 2.

6 papers.