Toward an SDN-Based Web Application Firewall: Defending against SQL Injection Attacks
Abstract
:1. Introduction
2. Background
2.1. SQL Injection
2.2. Web Application Firewall
2.3. Deep Packet Inspection
3. Related Work
- Flow Monitoring: SDN controllers can monitor network flows, which are sequences of packets that belong to the same communication session or application transaction, in order to detect anomalies that may indicate application-level attacks [34]. Flow monitoring involves analyzing various flow attributes, such as the packet size, packet rate, inter-arrival time, and communication patterns, to detect deviations from normal behavior that may indicate attacks.
- Behavioral Analysis: SDN controllers can use behavioral analysis techniques to establish baseline behavior for applications or users and detect deviations from the baseline that may indicate attacks. For example, by monitoring application-level traffic patterns in vehicular ad hoc networks (VANETs) over time, an SDN controller can learn normal behavior and raise alerts when it detects anomalies, such as sudden spikes in traffic or unusual communication patterns [35].
- Machine Learning (ML): ML algorithms can be used in SDN environments to detect application-level attacks by learning from historical data and identifying patterns that may indicate attacks [10]. ML algorithms can analyze large volumes of network data, including packet payloads, flow attributes, and communication patterns, to detect unknown or zero-day attacks that may not have known signatures [36].
- Hybrid Approaches: SDN controllers can use a combination of the above methods in a hybrid approach to detect application-level attacks. By leveraging multiple techniques, such as DPI, flow monitoring, behavioral analysis, ML, and signature-based detection, SDN controllers can increase the accuracy and effectiveness of attack detection.
4. Motivation and Contributions
- The design, implementation, and evaluation of an SDN-based WAF prototype.
- The design and implementation of an SDN-WAF framework to counter SQL injection attacks.
- The implementation of a traditional WAF (ModSecurity) to counter SQL injection attacks and a comparison with the SDN-based WAF.
- An evaluation of the efficiency of the SDN-based WAF and the potential of using such solutions as alternatives to traditional WAFs.
5. Conceptual Design
- Reception stage: The controller receives all traffic within the network from the data plane using the OpenFlow protocol, and filters the traffic of interest. This stage analyzes the sender/receiver address in layer 3 to identify the address of the web server. After that, it verifies if the port is for the HTTP protocol for either the sender or the receiver. If these conditions are met, the packet is moved to the next stage.
- Processing stage: At this point, the packet is processed to convert it into a textual format. This stage standardizes the traffic that will be taken to the next stage for inspection and for searching for suspicious patterns.
- Inspection stage: This stage is the primary function of the WAF, as it focuses on inspecting traffic for matching suspicious patterns. In order to achieve this, all traffic is transferred to the controller for inspection.
- Containment stage: When a match occurs in the inspection stage, the process moves to the containment stage, where the suspicious packet is first dropped and then the IP address of the machine responsible for the packet is blocked. After that, the suspicious packet is recorded on the controller for future inspection and investigation by information security personnel.
6. Implementation
6.1. Implementation Stages
- Reception stage: In order to receive the full traffic, we need to modify the POX controller. The modifications include:
- -
- Using the misc.full_forwarding function in POX controller, which allows the controller to receive all traffic that does not match any existing flow entries.
- -
- Modifying the libopenflow_01.py file in the POX/OpenvSwitch folder to configure the behavior of OpenFlow messages.
Furthermore, in the reception stage, the destination IP address of the incoming packets is matched with the IP address of the web server. If there is a match, the traffic is forwarded to the next stage for further processing. - Processing stage: In this stage, the pack() function in Python is used to convert the in-wire data to strings, making it possible for the data to be inspected in the next stage. Additionally, the entire traffic is converted to lowercase to avoid simple evasion techniques. It is worth noting that while Python may not be the most efficient language for processing high-speed traffic; it was chosen for its ease of use and versatility in this implementation. The processing stage in the SDN-based WAF is not expected to be the bottleneck for performance, and any delay added by using Python for traffic handling is likely to be negligible. However, in cases where efficiency is crucial during the processing stage, alternative solutions may need to be considered, such as using other programming languages or optimizing the Python code for performance. It is important to thoroughly test and validate the implementation to ensure it meets the performance requirements of the specific use case.
- Inspection stage: The inspection stage of the WAF is responsible for inspecting the traffic for suspicious patterns, particularly SQL injection attacks. There are two main applications implemented in this stage:
- (a)
- Matching the content of the packet with predefined signatures indicating the existence of an SQL injection exploitation: In this approach, known signatures are used to detect malicious GET and POST requests. These signatures are predefined and can indicate the presence of SQL injection attacks in the traffic. This approach can detect both GET and POST requests, as all of the traffic is inspected. Table 1 shows an example of known signatures that can be used for SQL injection detection.
- (b)
- Matching with regular expressions for whitelisting or blacklisting: In this approach, regular expressions are used to match the content of the packet against a set of predefined patterns, which can be used for whitelisting or blacklisting purposes. In the implementation described, whitelisting was used for custom solutions that fit the installed vulnerable web application. This allows for designing customized solutions that suit the environment/network. As a result, when an adversary sends an anomalous HTTP GET request, the application will classify this request as malicious.
It is important to keep the signatures and regular expressions up-to-date, as attackers continuously evolve their techniques. Regular updates and monitoring of the WAF rules are necessary to ensure its effectiveness in detecting and mitigating SQL injection attacks. Additionally, it is essential to thoroughly test and validate the implementation with real-world traffic to ensure its accuracy and reliability. - Containment stage:The containment stage of the WAF is responsible for taking action against detected SQL injection attacks. When a match occurs, the following steps are taken:
- (a)
- Blocking the IP address of the party responsible for the exploitation: A new rule is added to the OpenvSwitch to prevent the suspicious party from sending any further traffic to the web server. This is typically carried out by blocking the IP address of the detected attacker. However, in cases where the attacker is behind a network address translation (NAT) device, blocking the NAT-configured IP may potentially affect legitimate users. In such cases, alternative solutions can be considered, such as blocking the MAC address or providing both the user’s IP and the NAT IP for more precise blocking.
- (b)
- Dropping the suspicious packet: The packet that triggered the SQL injection detection is dropped using the halt() function, which prevents it from reaching the web server. This effectively contains the attack and prevents further damage.
- (c)
- Logging the suspicious packet for future investigation: The dropped packet is recorded in the logs folder for further investigation and analysis. This can help in understanding the nature of the attack, identifying patterns, and improving the effectiveness of the WAF in detecting and mitigating SQL injection attacks.
It is important to note that false positives may occur, where legitimate traffic may trigger the SQL injection detection. In order to minimize the impact on legitimate users, specific ports are blocked instead of blocking all ports, as blocking an IP from using all services may have a greater negative impact. The continuous monitoring and fine-tuning of the containment measures are necessary to strike a balance between effectively mitigating attacks and minimizing false positives.
6.2. SQL Injection Detection
6.2.1. Module 1: Signature-Based
6.2.2. Module 2: Regular-Expression-Based
Algorithm 1 Signature-based algorithm |
Input: PacketIn event Output: None Function: Signature-based algorithm
|
Algorithm 2 Regular-expression-based algorithm |
Input: PacketIn event Output: None Function: Regular-expression-based algorithm
|
7. Experimental Setup
7.1. Lab Setup
7.2. Modules Implementation
7.3. Modules Validation
7.4. ModSecurity WAF Implementation
8. Performance Evaluation and Comparison
9. Conclusions
10. Future Work
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
CPU | Central Processing Unit |
CRS | Core Rule Set |
DPI | Deep Packet Inspection |
HTTP | Hypertext Transfer Protocol |
LFI | Local File Inclusion |
ML | Machine Learning |
MTD | Moving Target Defence |
NAT | Network Address Translation |
RAM | Random Access Memory |
SDN | Software-Defined Networking |
SQL | Structured Query Language |
TCP | Transmission Control Protocol |
WAF | Web Application Firewall |
XSS | Cross-Site Scripting |
References
- Armstrong, M. How Many Websites Are There? August. Available online: https://www.statista.com/chart/19058/how-many-websites-are-there/ (accessed on 25 February 2023).
- NetCraft. October 2022 Web Server Survey. October. Available online: https://news.netcraft.com/archives/category/web-server-survey/ (accessed on 25 February 2023).
- OWASP. Top Ten Web Application Security Risks. Available online: https://owasp.org/www-project-top-ten/ (accessed on 25 February 2023).
- SpiderLabs. ModSecurity. Available online: https://github.com/SpiderLabs/ModSecurity (accessed on 25 February 2023).
- FortiWeb. Web Application Firewall (WAF). Available online: https://www.fortinet.com/products/web-application-firewall/fortiweb (accessed on 25 February 2023).
- Kreutz, D.; Ramos, F.M.; Verissimo, P.E.; Rothenberg, C.E.; Azodolmolky, S.; Uhlig, S. Software-defined networking: A comprehensive survey. Proc. IEEE 2014, 103, 14–76. [Google Scholar] [CrossRef]
- Girdler, T.; Vassilakis, V.G. Implementing an intrusion detection and prevention system using Software-Defined Networking: Defending against ARP spoofing attacks and Blacklisted MAC Addresses. Comput. Electr. Eng. 2021, 90, 106990. [Google Scholar] [CrossRef]
- Lara, A.; Kolasani, A.; Ramamurthy, B. Network innovation using OpenFlow: A survey. IEEE Commun. Surv. Tutorials 2013, 16, 493–512. [Google Scholar] [CrossRef]
- McKeown, N.; Anderson, T.; Balakrishnan, H.; Parulkar, G.; Peterson, L.; Rexford, J.; Shenker, S.; Turner, J. OpenFlow: Enabling innovation in campus networks. ACM SIGCOMM Comput. Commun. Rev. 2008, 38, 69–74. [Google Scholar] [CrossRef]
- Cusack, G.; Michel, O.; Keller, E. Machine learning-based detection of ransomware using SDN. In Proceedings of the 2018 ACM International Workshop on Security in Software Defined Networks & Network Function Virtualization, Tempe, AZ, USA, 21 March 2018; pp. 1–6. [Google Scholar]
- Akbanov, M.; Vassilakis, V.G.; Logothetis, M.D. Ransomware detection and mitigation using software-defined networking: The case of WannaCry. Comput. Electr. Eng. 2019, 76, 111–121. [Google Scholar] [CrossRef]
- Chica, J.C.C.; Imbachi, J.C.; Vega, J.F.B. Security in SDN: A comprehensive survey. J. Netw. Comput. Appl. 2020, 159, 102595. [Google Scholar] [CrossRef]
- Birkinshaw, C.; Rouka, E.; Vassilakis, V.G. Implementing an intrusion detection and prevention system using software-defined networking: Defending against port-scanning and denial-of-service attacks. J. Netw. Comput. Appl. 2019, 136, 71–85. [Google Scholar] [CrossRef]
- Balarezo, J.F.; Wang, S.; Chavez, K.G.; Al-Hourani, A.; Kandeepan, S. A survey on DoS/DDoS attacks mathematical modelling for traditional, SDN and virtual networks. Eng. Sci. Technol. 2022, 31, 101065. [Google Scholar] [CrossRef]
- Bawany, N.Z.; Shamsi, J.A.; Salah, K. DDoS attack detection and mitigation using SDN: Methods, practices, and solutions. Arab. J. Sci. Eng. 2017, 42, 425–441. [Google Scholar] [CrossRef]
- Wang, H.; Wu, B. SDN-based hybrid honeypot for attack capture. In Proceedings of the 2019 IEEE 3rd Information Technology, Networking, Electronic and Automation Control Conference (ITNEC), Chengdu, China, 15–17 March 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 1602–1606. [Google Scholar]
- Kim, M.; Cho, J.H.; Lim, H.; Moore, T.J.; Nelson, F.F.; Kim, D.D. Performance and Security Evaluation of a Moving Target Defense Based on a Software-Defined Networking Environment. In Proceedings of the 2022 IEEE 27th Pacific Rim International Symposium on Dependable Computing (PRDC), Beijing, China, 28 November–1 December 2022; IEEE: Piscataway, NJ, USA, 2022; pp. 119–129. [Google Scholar]
- Nguyen, T.A.; Kim, M.; Lee, J.; Min, D.; Lee, J.W.; Kim, D. Performability evaluation of switch-over Moving Target Defence mechanisms in a Software Defined Networking using stochastic reward nets. J. Netw. Comput. Appl. 2022, 199, 103267. [Google Scholar] [CrossRef]
- Clarke, J. SQL Injection Attacks and Defense; Elsevier: Amsterdam, The Netherlands, 2009. [Google Scholar]
- Clincy, V.; Shahriar, H. Web application firewall: Network security models and configuration. In Proceedings of the 2018 IEEE 42nd Annual Computer Software and Applications Conference (COMPSAC), Tokyo, Japa, 23–27 July 2018; IEEE: Piscataway, NJ, USA, 2018; Volume 1, pp. 835–836. [Google Scholar]
- Antonello, R.; Fernandes, S.; Kamienski, C.; Sadok, D.; Kelner, J.; Godor, I.; Szabo, G.; Westholm, T. Deep packet inspection tools and techniques in commodity platforms: Challenges and trends. J. Netw. Comput. Appl. 2012, 35, 1863–1878. [Google Scholar] [CrossRef]
- Rouka, E.; Birkinshaw, C.; Vassilakis, V.G. SDN-based Malware Detection and Mitigation: The Case of ExPetr Ransomware. In Proceedings of the 2020 IEEE International Conference on Informatics, IoT, and Enabling Technologies (ICIoT), Doha, Qatar, 2–5 February 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 150–155. [Google Scholar]
- Alotaibi, F.M.; Vassilakis, V.G. SDN-Based Detection of Self-Propagating Ransomware: The Case of BadRabbit. IEEE Access 2021, 9, 28039–28058. [Google Scholar] [CrossRef]
- Shieha, A. Application Layer Firewall Using OpenFlow. Master’s Thesis, University of Colorado Boulder, Boulder, CO, USA, 2014. [Google Scholar]
- Badotra, S.; Singh, J. Creating firewall in transport layer and application layer using software defined networking. In Innovations in Computer Science and Engineering; Springer: Berlin/Heidelberg, Germany, 2019; pp. 95–103. [Google Scholar]
- Suh, M.; Park, S.H.; Lee, B.; Yang, S. Building firewall over the software-defined network controller. In Proceedings of the 16th International Conference on Advanced Communication Technology, Pyeongchang, Republic of Korea, 16–19 February 2014; IEEE: Piscataway, NJ, USA, 2014; pp. 744–748. [Google Scholar]
- Javid, T.; Riaz, T.; Rasheed, A. A layer2 firewall for software defined network. In Proceedings of the 2014 Conference on Information Assurance and Cyber Security (CIACS), Rawalpindi, Pakistan, 12–13 June 2014; IEEE: Piscataway, NJ, USA, 2014; pp. 39–42. [Google Scholar]
- Kaur, K.; Kumar, K.; Singh, J.; Ghumman, N.S. Programmable firewall using software defined networking. In Proceedings of the 2015 2nd International Conference on Computing for Sustainable Global Development (INDIACom), New Delhi, India, 11–13 March 2015; IEEE: Piscataway, NJ, USA, 2015; pp. 2125–2129. [Google Scholar]
- Othman, W.M.; Chen, H.; Al-Moalmi, A.; Hadi, A.N. Implementation and performance analysis of SDN firewall on POX controller. In Proceedings of the 2017 IEEE 9th International Conference on Communication Software and Networks (ICCSN), Guangzhou, China, 6–8 May 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 1461–1466. [Google Scholar]
- Caprolu, M.; Raponi, S.; Di Pietro, R. Fortress: An efficient and distributed firewall for stateful data plane SDN. Secur. Commun. Networks 2019, 2019, 6874592. [Google Scholar] [CrossRef]
- Kaur, K.; Singh, J. Building stateful firewall over software defined networking. In Information Systems Design and Intelligent Applications; Springer: Berlin/Heidelberg, Germany, 2016; pp. 159–168. [Google Scholar]
- Appelt, D.; Panichella, A.; Briand, L. Automatically repairing web application firewalls based on successful SQL injection attacks. In Proceedings of the 2017 IEEE 28th International Symposium on Software Reliability Engineering (ISSRE), Toulouse, France, 23–26 October 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 339–350. [Google Scholar]
- Gu, H.; Zhang, J.; Liu, T.; Hu, M.; Zhou, J.; Wei, T.; Chen, M. DIAVA: A traffic-based framework for detection of SQL injection attacks and vulnerability analysis of leaked data. IEEE Trans. Reliab. 2019, 69, 188–202. [Google Scholar] [CrossRef]
- Yang, Z.; Yeung, K.L. Flow monitoring scheme design in SDN. Comput. Networks 2020, 167, 107007. [Google Scholar] [CrossRef]
- Bhatia, J.; Dave, R.; Bhayani, H.; Tanwar, S.; Nayyar, A. SDN-based real-time urban traffic analysis in VANET environment. Comput. Commun. 2020, 149, 162–175. [Google Scholar] [CrossRef]
- Tuan, N.N.; Hung, P.H.; Nghia, N.D.; Tho, N.V.; Phan, T.V.; Thanh, N.H. A DDoS attack mitigation scheme in ISP networks using machine learning based on SDN. Electronics 2020, 9, 413. [Google Scholar] [CrossRef]
- Alotaibi, F.M. Falkarshmi/SDN-WAF. March. Available online: https://github.com/Falkarshmi/SDN-WAF (accessed on 26 February 2023).
- Badotra, S.; Tanwar, S.; Bharany, S.; Rehman, A.U.; Eldin, E.T.; Ghamry, N.A.; Shafiq, M. A DDoS Vulnerability Analysis System against Distributed SDN Controllers in a Cloud Computing Environment. Electronics 2022, 11, 3120. [Google Scholar] [CrossRef]
- Zhu, L.; Karim, M.M.; Sharif, K.; Xu, C.; Li, F.; Du, X.; Guizani, M. SDN controllers: A comprehensive analysis and performance evaluation study. ACM Comput. Surv. (CSUR) 2020, 53, 1–40. [Google Scholar] [CrossRef]
order%20by | order by | order+by | union all |
union+all | union%20all | union%20all | 1,2,3 |
union+select | union%20select | union select | version() |
Module | TCP ACK Latency | CPU Usage |
---|---|---|
(Avg) | (Avg) | |
Traditional WAF (ModSecurity) | 50.6 ms | 7.02% |
SDN-based WAF (signatures) | 43.6 ms | 14.78% |
SDN-based WAF (regular expression) | 35.5 ms | 7.046% |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Alotaibi, F.M.; Vassilakis, V.G. Toward an SDN-Based Web Application Firewall: Defending against SQL Injection Attacks. Future Internet 2023, 15, 170. https://doi.org/10.3390/fi15050170
Alotaibi FM, Vassilakis VG. Toward an SDN-Based Web Application Firewall: Defending against SQL Injection Attacks. Future Internet. 2023; 15(5):170. https://doi.org/10.3390/fi15050170
Chicago/Turabian StyleAlotaibi, Fahad M., and Vassilios G. Vassilakis. 2023. "Toward an SDN-Based Web Application Firewall: Defending against SQL Injection Attacks" Future Internet 15, no. 5: 170. https://doi.org/10.3390/fi15050170
APA StyleAlotaibi, F. M., & Vassilakis, V. G. (2023). Toward an SDN-Based Web Application Firewall: Defending against SQL Injection Attacks. Future Internet, 15(5), 170. https://doi.org/10.3390/fi15050170