Defense Mechanism to Generate IPS Rules from Honeypot Logs and Its Application to Log4Shell Attack and Its Variants
Abstract
:1. Introduction
- After clarifying that none of the methods proposed so far enable autonomous defense systems or use black-box methods and that no variant-aware pattern generation method exists, we proposed a defense system that satisfies all of them.
- The Suricata ET ruleset was compared with the proposed method for attack detection using the conventional method, and the results show that the proposed method has approximately 90% higher discrimination performance than the conventional method for known attacks and approximately 50% higher discrimination performance than the conventional method for variant attacks, indicating that the proposed method has better discrimination performance than the conventional method for both known and variant attacks.
- The results of the comparison of the patterns generated by the proposed method with the Snort Community ruleset as the conventional method against attacks that exploit Log4Shell showed that the proposed method is superior to the conventional method in terms of the discrimination performance and the understandability of the patterns by 40%, indicating that the proposed method is superior to the conventional method in terms of the discrimination performance and the understandability.
2. Related Works
2.1. Autonomous Defense System
2.2. Pattern Generation Methods for Application to IPS and IDS
2.3. Log4Shell
3. Defense System Combining Honeypots and IPS
3.1. Overview
3.2. Data Collection Environment Using Honeypots
- The operating system to be used is Alpine Linux [28], which is known as a lightweight Linux operating system.
- In addition to port 8080, which WOWHoneypot initially accepts access to, it also supports access to port 80, which is used as the HTTP port.
- The WOWHoneypot settings are not changed, and the observation is performed with the default settings.
- The OS we use is Ubuntu Server 22.04 LTS.
- Apache2, MySQL, and PHP are used to run WordPress.
- All PHP extensions and packages required to run all WordPress functionality are installed [29].
- To prevent the effects of vulnerabilities in WordPress, it is always updated to the latest version.
- Accepts access via HTTP and HTTPS.
3.3. Machine Learning Using RapidMiner
- Loading of the learning data
- Preprocessing of the learning data
- Learning the model (machine learning)
- Loading of the test data
- Preprocessing of the test data
- Validate the model (performance evaluation)
- before removing:
- /sqlite/SQLiteManager-1.2.4/main.php
- after removing:
- /sqlite SQLiteManager-1.2.4 main.php
- This is a URL string that has been known as an attack to exploit the vulnerability.
- This is not a vulnerability, but it is a URL string that could be exploited as an attack.
- URL strings that attempt to access directories that are not supposed to be public directories (e.g., .env, .git, etc. (including strings beginning with “.” (dot)).
- URL strings that contain OS commands such as /bin/sh and have a high possibility of OS command injection.
3.3.1. Loading of the Training Data
3.3.2. Preprocessing of the Training Data
3.3.3. Machine Learning of the Model
- Naive Bayes
- Generalized Linear Model
- Logistic Regression
- Fast Large Margin
- Deep Learning
- Decision Tree
- Random Forest
- Gradient Boosted Trees
- Support Vector Machine
3.3.4. Loading of the Test Data
3.3.5. Preprocessing of the Test Data
3.3.6. Evaluation of the Model Using the Test Data
3.4. Generation of Rules Applicable to IPS and IDS
Algorithm 1 Generate rules to be applied to IPS. |
|
- read (Read the file containing the string to be processed)
- prepare (Remove the first character (sequence) and the last character (sequence) that must appear from the string to be processed)
- convert (Generate finite automaton from regex patterns)
- match (Perform matching using finite automaton)
- generate (Generate regex patterns and finite automaton based on matching results)
- check (Verify that the generated regex actually matches correctly)
3.4.1. Reading Files to Process
3.4.2. Generating Finite Automaton from Regex Patterns
3.4.3. Matching Using Finite Automaton
Algorithm 2 Matching using finite automaton. |
|
3.4.4. Generate Regex Patterns and Rules Based on Matching Results
Algorithm 3 Generate regex patterns and rules based on matching results. |
|
- alert tcp $EXTERNAL_NET any -> $HOME_NET $HTTP_PORTS (msg:‘‘Log4Shell’’; flow:to_server,established; content:‘‘${’’; fast_pattern:only; http_uri; pcre:‘‘<regex>’’; metadata:policy balanced-ips drop, policy connectivity-ips drop, policy max-detect-ips drop, policy security-ips drop, ruleset community, service http; classtype:attempted-user; sid:58724; rev:6;)
- $\{upper:([a-z0-9]|:|:|\. |/)\} is used as one of the obfuscation methods.
- $\{lower:([a-z0-9]|:|:|\. |/)\} is used as one of the obfuscation methods.
- $\{([a-z0-9]|:)+:\-([a-z0-9])+\} is used as one of the obfuscation methods.
- If multiple obfuscation methods are used in combination, their order of appearance is not considered.
- ${${lower:j}n${lower:d}i${lower::}l${lower:d}${upper:a}${lower:p}s${lower::}${lower:/}${lower:/}${upper:1}${upper:2}${upper:7}${lower:.}${upper:0}${upper:.}${lower:0}${lower:.}${upper:1}${lower::}${upper:1}${lower:3}${upper:8}${lower:9}${upper:/}t${lower:e}s${upper:t}}
- ($\{lower:([a-z0-9]|:|\.|/)\}|$\{upper:([a-z0-9]|:|\.|/)\}|[a-z])+
4. Confirmation of the Effectiveness of Defense System
4.1. Experimental Flow and Evaluation Metrics
- Experiment 1.
- Extract variants from test data for validation.
- Experiment 2.
- Use Suricata with the ET ruleset applied to examine the effectiveness of conventional methods against known attacks and variants.
- Experiment 3.
- Use RapidMiner to examine the effectiveness of the proposed method against known attacks and variants.
- Experiment 4.
- Use a turn generation program to generate rules for attacks that exploit Log4Shell and compare the generated rules with those contained in the Snort Community ruleset.
- True Positive Rate (TPR)The probability of correctly identifying a URL string labeled “attack” as “attack”.
- True Negative Rate (TNR)The probability of correctly identifying a URL string labeled “clean” as “clean”.
- $\{upper:([a-zA-Z0-9]|:|:|\. |/)\} is used as one of the obfuscation methods. Therefore, this obfuscation is called upper obfuscation.
- $\{lower:([a-zA-Z0-9]|:|\. |/)\} is used as one of the obfuscation methods. Therefore, this obfuscation is called lower obfuscation.
- $\{([a-zA-Z0-9]|:)+:\-([a-zA-Z0-9])+\} is used as one of the obfuscation methods. Therefore, this obfuscation is called obfuscation of random strings.
- If multiple obfuscation methods are used in combination, their order of appearance is not considered.
4.2. Experimental Results
- ($\{([a-zA-Z0-9]|:)+:\-([a-zA-Z0-9]|:)+\}|[a-zA-Z]|[0-9]|$|\{|:|\-|/|\.|\})+
- alert tcp $EXTERNAL_NET any -> $HOME_NET $HTTP_PORTS (msg:‘‘Log4Shell’’; flow:to_server,established; pcre:‘‘/(\$\{([a-zA-Z0-9]|:)+:\-([a-zA-Z0-9]|:)+\}|[a-zA-Z]|[0-9]|\$|\{|:|\-|/|\.|\})+/U’’; metadata:policy balanced-ips drop, policy connectivity-ips drop, policy max-detect-ips drop, policy security-ips drop, ruleset community, service http; classtype:attempted-user; sid:58724; rev:6;)
5. Discussion of Experimental Results
5.1. Discrimination of Attacks
5.2. Rules Generation
- ($\{([a-zA-Z0-9]|:)+:\-([a-zA-Z0-9]|:)+\}|[a-zA-Z]|[0-9]|$|\{|:|\-|/|\.|\})+
- ${${VWegfRIPvF:-jndi:ldap://127.0.0.1:1389/tes}${iTZDZZM:gS:-t}}
- [a-zA-Z]|[0-9]|$|\{|:|\-|/|\.|\}
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
IDS | Intrusion Detection System |
IPS | Intrusion Prevention System |
PoC(s) | Proof of Concept(s) |
CVE | Common Vulnerabilities and Exposures |
SVM | Support Vector Machine |
TV | Text Vectorization |
References
- Sophos. Log4Shell Hell: Anatomy of an Exploit Outbreak—Sophos News. Available online: https://news.sophos.com/en-us/2021/12/12/log4shell-hell-anatomy-of-an-exploit-outbreak/ (accessed on 12 December 2022).
- Mitre. CVE-CVE-2021-44228. Available online: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228 (accessed on 10 June 2023).
- Cisco. Vulnerabilities in Apache Log4j Library Affecting Cisco Products: December 2021. Available online: https://sec.cloudapps.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-apache-log4j-qRuKNEbd (accessed on 10 June 2023).
- Palo Alto Networks. Apache log4j Vulnerability CVE-2021-44228: Analysis and Mitigations. Available online: https://unit42.paloaltonetworks.com/apache-log4j-vulnerability-cve-2021-44228/ (accessed on 10 June 2023).
- Emerging Threats. Proofpoint Emerging Threats Rules. Available online: https://rules.emergingthreatspro.com/open/ (accessed on 8 July 2022).
- Emerging Threats. ET OPEN Ruleset Download Instructions. Available online: https://rules.emergingthreatspro.com/OPEN_download_instructions.html (accessed on 8 July 2022).
- Snort. Snort Rules and IDS Software Download. Available online: https://www.snort.org/downloads/#rule-downloads (accessed on 8 July 2023).
- Snort. What Are Community Rules? Available online: https://www.snort.org/faq/what-are-community-rules (accessed on 8 July 2022).
- Yamamoto, Y.; Yamaguchi, S. A Method to Prevent Known Attacks and Their Variants by Combining Honeypots and IPS. In Proceedings of the 2022 IEEE 11th Global Conference on Consumer Electronics (GCCE), Osaka, Japan, 18–21 October 2022; pp. 302–305. [Google Scholar]
- Umer, M.; Sadiq, S.; Karamti, H.; Alhebshi, R.M.; Alnowaiser, K.; Eshmawi, A.A.; Song, H.; Ashraf, I. Deep Learning-Based Intrusion Detection Methods in Cyber-Physical Systems: Challenges and Future Trends. Electronics 2022, 11, 3326. [Google Scholar] [CrossRef]
- Pa, Y.M.P.; Suzuki, S.; Yoshioka, K.; Matsumoto, T.; Kasama, T.; Rossow, C. IoTPOT: A novel honeypot for revealing current IoT threats. J. Inf. Process. 2016, 24, 522–533. [Google Scholar] [CrossRef] [Green Version]
- Awajan, A. A novel deep learning-based intrusion detection system for IOT networks. Computers 2023, 12, 34. [Google Scholar]
- Jiang, K.; Zheng, H. Design and Implementation of A Machine Learning Enhanced Web Honeypot System. In Proceedings of the 2020 13th International Congress on Image and Signal Processing, BioMedical Engineering and Informatics (CISP-BMEI), Chengdu, China, 17–19 October 2020; pp. 957–961. [Google Scholar]
- Ghourabi, A.; Abbes, T.; Bouhoula, A. Design and implementation of Web service honeypot. In Proceedings of the SoftCOM 2011, 19th International Conference on Software, Telecommunications and Computer Networks, Split, Croatia, 15–17 September 2011; pp. 1–5. [Google Scholar]
- Wang, Y.; Bashar, M.A.; Chandramohan, M.; Nayak, R. Exploring Topic Models to Discern Cyber Threats on Twitter: A Case Study on Log4shell. SSRN 4404537. Available online: http://dx.doi.org/10.2139/ssrn.4404537 (accessed on 17 July 2023).
- Laryea, E.N.A. Snort Rule Generation for Malware Detection using the GPT2 Transformer. Ph.D. Thesis, Université d’Ottawa/University of Ottawa, Ottawa, ON, Canada, 2022. [Google Scholar]
- Jaw, E.; Wang, X. A novel hybrid-based approach of snort automatic rule generator and security event correlation (SARG-SEC). PeerJ Comput. Sci. 2022, 8, e900. [Google Scholar] [CrossRef] [PubMed]
- Everson, D.; Cheng, L.; Zhang, Z. Log4shell: Redefining the web attack surface. In Proceedings of the Workshop on Measurements, Attacks, and Defenses for the Web (MADWeb) 2022, Virtual, 28 April 2022. [Google Scholar]
- Trend Micro. Patch Now Apache Log4j Vulnerability Called Log4Shell Actively Exploited. Available online: https://www.trendmicro.com/en_us/research/21/l/patch-now-apache-log4j-vulnerability-called-log4shell-being-acti.html (accessed on 10 June 2023).
- Tangxiaofeng7. GitHub-Tangxiaofeng7/CVE-2021-44228-Apache-Log4j-Rce. Available online: https://github.com/tangxiaofeng7/CVE-2021-44228-Apache-Log4j-Rce (accessed on 5 July 2023).
- Hiesgen, R.; Nawrocki, M.; Schmidt, T.C.; Wählisch, M. The race to the vulnerable: Measuring the log4j shell incident. arXiv 2022, arXiv:2205.02544. [Google Scholar]
- Thomaspatzke. GitHub-Thomaspatzke/Log4Pot: A Honeypot for the Log4Shell Vulnerability (CVE-2021-44228). Available online: https://github.com/thomaspatzke/Log4Pot (accessed on 5 July 2023).
- BinaryDefense. GitHub-BinaryDefense/log4j-Honeypot-Flask: Internal Network Honeypot for Detecting if an Attacker or Insider Threat Scans your Network for Log4j CVE-2021-44228. Available online: https://github.com/BinaryDefense/Log4j-honeypot-flask (accessed on 5 July 2023).
- Kaushik, K.; Dass, A.; Dhankhar, A. An approach for exploiting and mitigating Log4J using Log4Shell vulnerability. In Proceedings of the 2022 3rd International Conference on Computation, Automation and Knowledge Management (ICCAKM), Dubai, United Arab Emirates, 15–17 November 2022; pp. 1–6. [Google Scholar]
- Xiao, J.; Chang, C.; Wu, P.; Ma, Y.; Lu, Z. A Secure Data Flow Forwarding Method Based on Service Ordering Management. Electronics 2022, 11, 4107. [Google Scholar] [CrossRef]
- Morihisa. GitHub-Morihisa/WOWHoneypot. Available online: https://github.com/morihisa/WOWHoneypot (accessed on 19 December 2022).
- WordPress. Blog Tool, Publishing Platform, and CM–WordPress.org. Available online: https://wordpress.org/ (accessed on 5 January 2023).
- Alpine Linux. Index|Alpine Linux. Available online: https://www.alpinelinux.org/ (accessed on 5 January 2023).
- WordPress. Server Environment—Make WordPress Hosting. Available online: https://make.wordpress.org/hosting/handbook/server-environment/ (accessed on 5 January 2023).
- DigitalOcean. Droplets | DigitalOcean’s Scalable Virtual Machines. Available online: https://www.digitalocean.com/products/droplets (accessed on 15 January 2023).
- RapidMiner. RapidMiner | Best Data Science & Machine Learning Platform. Available online: https://rapidminer.com/ (accessed on 28 January 2023).
- Møller, A. dk.brics.automaton—Finite-State Automata and Regular Expressions for Java. 2021. Available online: http://www.brics.dk/automaton/ (accessed on 1 June 2023).
- Woodpecker. GitHub-Woodpecker-Appstore/log4j-Payload-Generator: Log4j Jndi Injects the Payload Generator. Available online: https://github.com/woodpecker-appstore/log4j-payload-generator (accessed on 8 November 2022).
- Fastly. Digging Deeper into Log4Shell-0Day RCE Exploit Found in Log4j|Fastly. Available online: https://www.fastly.com/blog/digging-deeper-into-log4shell-0day-rce-exploit-found-in-log4j (accessed on 10 June 2023).
- yuudai-g. GitHub-yuudai-g/Log4ShellAttackPatternsGenerator. Available online: https://github.com/yuudai-g/Log4ShellAttackPatternsGenerator (accessed on 30 January 2022).
Method | Pa et al. [11] | Jiang et al. [13] | Ghourabi et al. [14] | Awajan [12] | Our Proposed Method |
---|---|---|---|---|---|
Automated system | ✓ | ✓ | ✓ | ||
Using machine learning | ✓ | ✓ | ✓ | ✓ | |
Detecting attacks | ✓ | ✓ | ✓ | ✓ | |
Defending against attacks | ✓ | ✓ | ✓ | ||
Targeting Web applications | ✓ | ✓ | ✓ | ||
Consideration of variants | ✓ |
Variations | Number of Each Variation |
---|---|
No obfuscation | 3 |
upper or lower | 4 |
random strings | 3 |
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
Yamamoto, Y.; Yamaguchi, S. Defense Mechanism to Generate IPS Rules from Honeypot Logs and Its Application to Log4Shell Attack and Its Variants. Electronics 2023, 12, 3177. https://doi.org/10.3390/electronics12143177
Yamamoto Y, Yamaguchi S. Defense Mechanism to Generate IPS Rules from Honeypot Logs and Its Application to Log4Shell Attack and Its Variants. Electronics. 2023; 12(14):3177. https://doi.org/10.3390/electronics12143177
Chicago/Turabian StyleYamamoto, Yudai, and Shingo Yamaguchi. 2023. "Defense Mechanism to Generate IPS Rules from Honeypot Logs and Its Application to Log4Shell Attack and Its Variants" Electronics 12, no. 14: 3177. https://doi.org/10.3390/electronics12143177
APA StyleYamamoto, Y., & Yamaguchi, S. (2023). Defense Mechanism to Generate IPS Rules from Honeypot Logs and Its Application to Log4Shell Attack and Its Variants. Electronics, 12(14), 3177. https://doi.org/10.3390/electronics12143177