TL;DR
This paper introduces a novel approach for Web Application Firewalls (WAFs) that combines human expertise with automated feature extraction (n-grams) to improve both the accuracy and efficiency of detecting web attacks. By leveraging feature selection techniques like GeFS, they significantly reduce the complexity of the data while maintaining high detection rates, offering a more robust and adaptable solution for modern web security.
What Problem Does This Paper Address?
Web applications are increasingly targeted by attackers, and traditional network firewalls are insufficient to detect application-layer threats. Web Application Firewalls (WAFs) are designed to address this, but they face a critical trade-off: effectiveness (accurately detecting attacks without false positives) versus efficiency (low resource consumption and computational complexity, crucial for real-time operation).
Existing WAFs often rely on either:
- Expert Knowledge: Manually defining features based on domain expertise. This yields high accuracy but is time-consuming, difficult to update, and not adaptable to evolving threats.
- Automatic Feature Extraction (e.g., n-grams): Methods like n-grams automatically generate features from data. While adaptable, they can produce unreliable results and lead to a "curse of dimensionality" due to the exponential growth of features, making them computationally expensive and inefficient.
This paper aims to bridge this gap by combining the strengths of both approaches and mitigating their weaknesses.
Methods
The proposed methodology involves three main stages:
- Feature Construction: This is the core innovation. Instead of relying solely on expert-defined features or purely automatic n-grams, the authors propose to combine them.
- Expert Knowledge: They define 30 features based on their understanding of web attacks, including character types, lengths of request components, and keyword occurrences.
- N-grams: They use 1-grams (individual characters) as the simplest form of n-gram extraction, considering the entire HTTP request.
- Combination Strategies: Three ways to combine these features are explored:
- Combine-select: Merge all expert and n-gram features, then apply feature selection.
- Select-combine: Select features from expert knowledge and n-grams separately, then merge the selected sets.
- Select-n-gram-combine: Select features from n-grams and merge them with all expert knowledge features.
- Feature Selection: To combat the high dimensionality introduced by n-grams, they employ feature selection. They specifically focus on the Generic Feature Selection (GeFS) measure, which has shown promise in intrusion detection. GeFS aims to find the smallest subset of features that maximizes classification performance. They analyze the statistical properties of the data (linear vs. non-linear relationships) to choose the appropriate GeFS instance (GeFSCFS for linear, GeFSMRMR for non-linear).
- Classification: Several decision tree algorithms (C4.5, CART, Random Forest, Random Tree) are used as classifiers to evaluate the performance of the different feature subsets. Decision trees are chosen due to their popularity and proven success in intrusion detection.
Datasets
The experiments were conducted on the ECML/PKDD 2007 dataset. This dataset is highlighted as being publicly available, labeled, and containing only HTTP traffic, making it ideal for WAF testing. It was divided into training and testing sets, with the training set comprising 50,000 samples (20% attacks, 80% normal requests). The attacks included in the dataset are XSS, SQL Injection, LDAP Injection, XPATH Injection, Path Traversal, Command Execution, and Server-Side Include attacks.
Key Insights and Ideas
- Synergy of Expertise and Automation: The core idea is that combining human domain knowledge with the adaptability of automated feature extraction (n-grams) creates a more powerful and robust detection system than either approach alone.
- Feature Selection as a Crucial Enabler: The "curse of dimensionality" from n-grams is a major hurdle. Feature selection, particularly using GeFS, is shown to be essential for making n-gram-based approaches practical and efficient for WAFs.
- Importance of Choosing the Right Feature Selection Measure: The paper emphasizes that selecting the correct GeFS instance (CFS vs. mRMR) based on the data's statistical properties is critical for optimal performance. A wrong choice can negatively impact accuracy.
- Trade-offs in Combination Strategies: Different combination strategies (Combine-select, Select-combine, Select-n-gram-combine) offer varying balances between feature count and detection accuracy, suggesting that the "best" approach depends on specific deployment needs.
Key Results
- Improved Performance: The combination approaches consistently outperformed the individual expert knowledge and n-gram feature sets.
- Feature Reduction: The GeFS measure significantly reduced the number of features. For example, in the expert knowledge case, features were reduced from 30 to 2, and in the n-gram case, from 96 to 15 (using GeFSCFS).
- Accuracy Gains: The select-n-gram-combine alternative achieved the highest detection accuracy (around 97.18% on average), while the combine-select alternative used the fewest features (11 in its optimized form).
- Efficiency Enhancement: By reducing features, the WAFs become more efficient, consuming fewer resources and operating faster.
- Confirmation of Hypothesis: The results strongly supported the hypothesis that combining expert knowledge with n-grams, coupled with feature selection, leads to more effective and efficient WAFs.
Limitations and Future Work
- Higher-Order N-grams: The current study focused on 1-grams due to computational complexity. The authors suggest exploring higher-order n-grams (n > 1) in future work, potentially with more advanced feature selection or dimensionality reduction techniques.
- Dataset Specificity: While the ECML/PKDD 2007 dataset is valuable, real-world WAF deployments might encounter different traffic patterns and attack vectors. Further validation on diverse datasets would be beneficial.
- Choice of Classifiers: While decision trees are effective, exploring other machine learning algorithms could potentially yield further improvements.
- Adaptability: The manual aspect of expert knowledge feature definition, though combined with automation, still presents a potential bottleneck for rapid adaptation to entirely novel attack types not foreseen by experts.
Summary updated