LLM-Based Misconfiguration Detection for AWS Serverless Computing

Jinfeng Wen, Zhenpeng Chen, Zixi Zhu, Federica Sarro, Haodi Ping, Shangguang Wang

TL;DR

Serverless computing relies heavily on complex declarative templates (like AWS SAM) that are notoriously prone to subtle configuration errors. SlsDetector is the first LLM-based static misconfiguration detector designed specifically for serverless architectures, using zero-shot Chain-of-Thought (CoT) prompting grounded in serverless-specific structural constraints. Evaluated on a new 110-template benchmark, it achieves an F1-score of 79.75%—outperforming traditional data-driven mining approaches by nearly 50 percentage points.

What Problem Does This Paper Address?

In serverless frameworks like AWS Serverless Application Model (SAM), application logic and cloud infrastructure are decoupled: YAML configuration files dictate how functions trigger, scale, and interact with over 800 cloud resource types. A single mistyped key, improper indentation, or invalid dependency can cause catastrophic security breaches or silent deployment failures.

Traditional misconfiguration detection techniques struggle in this domain:

  • White-box methods analyze source code and cannot interpret declarative, multi-resource YAML schemas.
  • Black-box/Data-driven methods (e.g., association rule mining on historical configurations) suffer from severe data sparsity. Serverless configurations feature rare, nested, and rapidly evolving resource combinations; models trained on past templates drown in false positives by misclassifying valid, unfamiliar configurations as anomalies.

Methods

Instead of training data-heavy models, the authors propose SlsDetector, an inference-time framework that leverages the pre-trained domain knowledge of Large Language Models (LLMs) via zero-shot prompting.

Its architecture centers on a Prompt Generation Component containing:

  1. Task Description & Role Play: Establishing expert context for AWS SAM configurations.
  2. Multi-Dimensional Constraints: Guiding the LLM through a structured Chain-of-Thought reasoning process across five serverless configuration dimensions:
  3. Resource Types: Validating resource names and case sensitivity against official AWS specifications.
  4. Configuration Entries: A coarse-to-fine 3-step check covering resource-level entries, event trigger configurations, and YAML hierarchy/indentation.
  5. Values of Configuration Entries: Enforcing data types, permissible enum sets, and non-null rules.
  6. Entry Dependencies: Checking required co-occurrences (e.g., mutually dependent parameters).
  7. Value Dependencies: Validating cross-resource bindings (e.g., ensuring an API event correctly references an existing AWS::Serverless::Api resource).
  8. Customized Structured Output: Demanding deterministic answers demarcated by <START> and <END> delimiters to enable regex-based post-processing.

Datasets

The authors built and released a new curated benchmark of 110 AWS SAM configuration files encompassing 4,108 correct parameters and 308 misconfigurations:

  • 26 Error-Free Files: Manually verified, successfully deployed templates mined from GitHub.
  • 58 Real-World Misconfiguration Files: Sourced from closed GitHub issues with verified ground-truth root causes.
  • 26 Injected Misconfiguration Files: Derived by applying systematic mutation rules (syntax errors, range violations, dependency breaks) to clean files. Crucially, this set guarantees that the LLM has never seen the errors during pre-training, mitigating data leakage concerns.

(For the data-driven baseline, the authors separately mined a training corpus of 701 verified AWS SAM files across 658 applications from the AWS Serverless Application Repository).

Key Insights and Ideas

  • Why Data-Driven Mining Collapses in Cloud Configs: Historical pattern mining (e.g., FP-Growth) flagged 22.54% of valid configuration parameters as errors. Cloud infrastructure has too vast a parameter space; if a baseline hasn't seen a rare service combination, it incorrectly flags it as invalid.
  • Holistic Reasoning Beats Prompt Splitting: Splitting constraints into five isolated prompt queries (checking types, values, and dependencies separately) crippled precision (48.20%). Serverless constraints are tightly coupled; evaluating them in a single, coherent CoT pass drastically reduces hallucinations and false alarms.
  • Zero-Shot Outperforms Few-Shot: Few-shot exemplars biased the LLMs toward the specific resource types included in the prompt, degrading recall on diverse AWS resources. Zero-shot prompting with explicit constraint guidelines proved far more generalizable.

Key Results

  • Vs. Data-Driven Baselines: Using ChatGPT-4o, SlsDetector achieved 72.88% precision, 88.18% recall, and a 79.75% F1-score, crushing the FP-Growth baseline (19.06% precision, 70.78% recall, 30.03% F1-score).
  • Vs. LLM Baselines: SlsDetector beat raw zero-shot ChatGPT-4o (57.55% F1) and few-shot prompting (68.43% F1).
  • Cross-Model Generalization: SlsDetector maintained strong performance across multiple state-of-the-art LLMs, including Llama 3.1 405B (74.05% F1), Gemini 1.5 Pro (72.93% F1), and DeepSeek V3 (74.10% F1). Even the lightweight Llama 3.1 8B reached an F1-score of 66.85%.
  • Robustness: Evaluating across temperatures (0, 0.2, 0.5) showed minor metric variance (~5 percentage points), demonstrating high practical stability.

Limitations and Future Work

  • Purely Static Analysis: SlsDetector only evaluates the YAML configuration file. It cannot analyze external application source code (e.g., implementation bugs inside Lambda handlers) or runtime environment dynamics.
  • LLM Knowledge Boundaries: Highly obscure, newly released, or undocumented service dependencies can still evade detection due to pre-training knowledge limits.
  • No Live Deployment: To maintain controlled experimental conditions, the tool was evaluated on static files rather than real cloud deployments.
  • Future Direction: The authors plan to investigate hybrid static-dynamic detection, enriching static prompt verification with selectively captured deployment-time runtime metadata.

Summary updated

BibTeX
@article{wen2025llm,
  author = {Jinfeng Wen and Zhenpeng Chen and Zixi Zhu and Federica Sarro and Haodi Ping and Shangguang Wang},
  title = {{LLM-Based Misconfiguration Detection for AWS Serverless Computing}},
  journal = {ACM Transactions on Software Engineering and Methodology},
  year = {2025},
  url = {https://openreview.net/forum?id=grIEkqhCuZ},
}
Figure