Cefuzz: An Directed Fuzzing Framework for PHP RCE Vulnerability
Abstract
:1. Introduction
- (1)
- Guided by potential RCE vulnerability information from static taint analysis, we perform instrumentation for the source code of the web application to improve the perceptual ability of program status during fuzzing.
- (2)
- We use three types of special initial seeds that easily show command execution results, and propose six seed mutation operations, combined with three vulnerability monitoring methods, which can accurately capture the signal that the vulnerabilities are successfully verified.
- (3)
- A PHP RCE vulnerability directed fuzzing prototype system (Cefuzz) is implemented. Experimental results show that Cefuzz detects 13 unknown vulnerabilities in 10 popular web CMSes, which demonstrates Cefuzz has strong power in discovering unknown vulnerabilities compared with the current popular web vulnerability detection methods.
2. Motivation
3. Overview
4. Methodology
4.1. Static Taint Analysis
4.2. Initialization
Algorithm 1: Checkpoint Found |
Input: CFG of potentially vulnerable file: , Sink point located line No.: Output: Check point located line No.: 1: target_node = node_search(, ) 2: reverse_nodes = BFS_predecessors_searcch(,target_node) // BFS 3: for node in reverse_nodes do 4: neighbors_node = CFG.out_neighbors(node) 5: for n_node in neighbors_node do 6: if n_node not in reverse_nodes then 7: check_node.append(node) 8: end if 9: end for 10: end for 11: = get_line(check_node) // Find the line No. according to the node information 12: 13: return |
Algorithm 2: Checkpoint instrumentation |
Input: Check point located line No.: , Path of potentially vulnerable file: 1: file_content = file() // Read file by line 2: check_count = count() 3: for i = 0; i < check_count; i++ do 4: line = check_line[i]-1; 5: file_content[line] = “echo(“Cefuzz check#”.(i+1).“# checkingߪ”);∖n”.file_content[line].“echo(“Cefuzz check#”.(i+1).“# bypass!!!”);∖n”; 6: end for |
4.3. Seed Mutation
4.3.1. Initial Seed
4.3.2. Seed Selection Rules
4.3.3. Seed Mutation Operation
4.3.4. Seed Mutation Strategy
4.4. Vulnerability Verification
Algorithm 3: Vulnerability verification |
Input: Response packet content: , Webapp source code path: Output: Bool , indicates that the vulnerability exists or does not exist yet 1: file_hash_array_old= file_hash_array(path) 2: ߪ // Send test request 3: file_hash_array_new= file_hash_array(path) 4: diff_array = array_diff_fast(file_hash_array_new,file_hash_array_old) 5: phpinfo_pattern = “/Zend Memory Manager/” 6: pattern = “/d9a6adadd9525a1bd3f8b274d6f22cdf/” 7: if (file_monitor($diff_array) or vul_match(content,phpinfo_pattern) or vul_match(content,pattern)) then 8: 9: return TRUE 10: else 11: 12: return FALSE 13: end if |
Algorithm 4: Checkpoint pass detection |
Input: Response packet content: , Webapp source code path: , Total number of checkpoints: Output: Number of checkpoints passed: , If the number is equal to 999, all the checkpoints have passed 1: checking_pattern = “/Cefuzz check#(.*)# checking/” 2: bypass_pattern = “/Cefuzz check#(.*)# bypass/” 3: checking_count = match_all_count(checking_pattern,content) // Checkpoint encountered 4: bypass_count = match_all_count(bypass_pattern,content) // Checkpoints that have passed 5: if (if(bypass_count < count)) then 6: 7: return bypass_count 8: else 9: 10: return 999 11: end if |
4.5. Vulnerability Verification Code Output
5. Evaluation
5.1. Evaluation Setup
- RQ1:
- Using our method to test the simple vulnerability examples in the vulnerability practice platform, can it automatically generate PoC?
- RQ2:
- Can our method achieve a good verification effect on known vulnerabilities in real programs?
- RQ3:
- Can our method detect unknown vulnerabilities in real programs?
5.2. Evaluation Benchmarks
5.3. Effectiveness Test of Vulnerability Verification and PoC Generation (RQ1)
5.4. Verification Ability Experiment for Enown Vulnerabilities (RQ2)
5.5. Evaluation Experiment of Detection Ability for Unknown Vulnerabilities (RQ3)
5.6. Discussion
6. Related Works
6.1. Static Methods
6.2. Dynamic Methods
7. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Acknowledgments
Conflicts of Interest
References
- Netcraft. August 2021 Web Server Survey. 2021 [EB/OL]. Available online: https://news.netcraft.com/archives/2021/08/25/august-2021-web-server-survey.html (accessed on 1 September 2021).
- Roy, J.; Ramanujan, A. Understanding web services. IT Prof. 2001, 3, 69–73. [Google Scholar] [CrossRef]
- CWE. Command Injection. [EB/OL]. Available online: https://cwe.mitre.org/data/definitions/78.html (accessed on 1 September 2021).
- Wikipedia. Code Execution. [EB/OL]. Available online: https://en.wikipedia.org/wiki/Arbitrary_code_execution (accessed on 1 September 2021).
- w3techs. Usage Statistics of Server-Side Programming Languages for Websites. [EB/OL]. Available online: https://nvd.nist.gov/vuln/search/statistics (accessed on 1 September 2021).
- Chess, B.; McGraw, G. Static analysis for security. IEEE Secur. Priv. 2004, 2, 76–79. [Google Scholar] [CrossRef]
- Ayewah, N.; Pugh, W.; Hovemeyer, D.; Morgenthaler, J.D.; Penix, J. Using Static Analysis to Find Bugs. IEEE Softw. 2008, 25, 22–29. [Google Scholar] [CrossRef] [Green Version]
- Kals, S.; Kirda, E.; Kruegel, C.; Jovanovic, N. Secubat: A web vulnerability scanner. In Proceedings of the 15th International Conference on World Wide Web, Edinburgh, UK, 23–26 May 2006; pp. 247–256. [Google Scholar]
- Fan, J.; Gao, P.; Shi, C.C.; Li, N.G. Research on combine White-box testing and Black-box testing of Web Applications security. In Advanced Materials Research; Trans Tech Publications Ltd.: Freinbach, Switzerland, 2014; Volume 989, pp. 4542–4546. [Google Scholar]
- Denning, D.E. A lattice model of secure information flow. Commun. ACM 1976, 19, 236–243. [Google Scholar] [CrossRef]
- Wassermann, G.; Su, Z. Static detection of cross-site scripting vulnerabilities. In Proceedings of the 2008 ACM/IEEE 30th International Conference on Software Engineering, Leipzig, Germany, 10–18 May 2008; pp. 171–180, ISSN 1558-1225. [Google Scholar] [CrossRef]
- Miller, B.P.; Fredriksen, L.; So, B. An Empirical Study of the Reliability of UNIX Utilities. Commun. ACM 1990, 33, 32–44. [Google Scholar] [CrossRef]
- Canakci, S.; Delshadtehrani, L.; Eris, F.; Taylor, M.B.; Egele, M.; Joshi, A. DirectFuzz: Automated Test Generation for RTL Designs using Directed Graybox Fuzzing. In Proceedings of the 2021 58th ACM/IEEE Design Automation Conference (DAC), San Francisco, CA, USA, 5–9 December 2021; pp. 529–534. [Google Scholar] [CrossRef]
- Alhuzali, A.; Gjomemo, R.; Eshete, B.; Venkatakrishnan, V. {NAVEX}: Precise and scalable exploit generation for dynamic web applications. In Proceedings of the 27th USENIX Security Symposium (USENIX Security 18), Baltimore, MD, USA, 15–17 August 2018; pp. 377–392. [Google Scholar]
- Zhang, G.; Zhou, X.; Luo, Y.; Wu, X.; Min, E. PTfuzz: Guided Fuzzing With Processor Trace Feedback. IEEE Access 2018, 6, 37302–37313. [Google Scholar] [CrossRef]
- Godefroid, P. Random testing for security: Blackbox vs. whitebox fuzzing. In Proceedings of the 2nd International Workshop on Random Testing: Co-Located with the 22nd IEEE/ACM International Conference on Automated Software Engineering (ASE 2007), Atlanta, Georgia, 6 November 2007; p. 1. [Google Scholar]
- Rawat, S.; Mounier, L. Offset-aware mutation based fuzzing for buffer overflow vulnerabilities: Few preliminary results. In Proceedings of the 2011 IEEE Fourth International Conference on Software Testing, Verification and Validation Workshops, IEEE, Berlin, Germany, 21–25 March 2011; pp. 531–533. [Google Scholar]
- Miller, C.; Peterson, Z.N. Analysis of Mutation and Generation-Based Fuzzing; Independent Security Evaluators, Tech. Rep; Independent Security Evaluators: Baltimore, MD, USA, 2007; Volume 4. [Google Scholar]
- Fielding, R.; Gettys, J.; Mogul, J.; Frystyk, H.; Masinter, L.; Leach, P.; Berners-Lee, T. Hypertext Transfer Protocol–HTTP/1.1. 1999. Available online: https://www.hjp.at/doc/rfc/rfc2616.html (accessed on 1 September 2021).
- Chen, P.; Liu, J.; Chen, H. Matryoshka: Fuzzing deeply nested branches. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, London, UK, 11–15 November 2019; pp. 499–513. [Google Scholar]
- Zhao, J.; Lu, Y.; Wang, X.; Zhu, K.; Yu, L. WTA: A Static Taint Analysis Framework for PHP Webshell. Appl. Sci. 2021, 11, 7763. [Google Scholar] [CrossRef]
- Digininja. DVWA. Available online: https://github.com/digininja/DVWA (accessed on 1 September 2021).
- bWAPP. Available online: http://www.itsecgames.com/index.htm (accessed on 1 September 2021).
- Zhuifengshaonianhanlu/pikachu. Available online: https://github.com/zhuifengshaonianhanlu/pikachu (accessed on 1 September 2021).
- Zzzcms. Available online: http://www.zzzcms.com/index.html (accessed on 1 September 2021).
- Pbootcms. Available online: https://www.pbootcms.com/ (accessed on 1 September 2021).
- boiteasite/cmsuno. Available online: https://github.com/boiteasite/cmsuno (accessed on 1 September 2021).
- MyuCMS. Available online: http://www.myucms.com/ (accessed on 1 September 2021).
- FineCms. Available online: http://xnxl.down.easck.com:880/code/2017/0724/finecms_v5.0.10.zip (accessed on 1 September 2021).
- Maccms. Available online: https://www.maccms.cn/down.html (accessed on 1 September 2021).
- Seacms. Available online: http://xnxl.down.easck.com:880/code/2016/0822/seacms_v6.28.zip (accessed on 1 September 2021).
- ZhongBangKeJi. CRMEB. Available online: https://gitee.com/ZhongBangKeJi/CRMEB (accessed on 1 September 2021).
- Peacexie/imcat. Available online: https://github.com/peacexie/imcat (accessed on 1 September 2021).
- WMCMS. Available online: http://www.weimengcms.com/index.html (accessed on 1 September 2021).
- Hiliqi/xiaohuanxiongcms. Available online: https://github.com/hiliqi/xiaohuanxiong (accessed on 1 September 2021).
- Maxsite Cms. Available online: https://github.com/maxsite/cms (accessed on 1 September 2021).
- GetSimple. Available online: http://get-simple.info/ (accessed on 1 September 2021).
- Kohana. KodiCMS. Available online: https://github.com/KodiCMS-Kohana/cms (accessed on 1 September 2021).
- pH7Software. ph7cms. Available online: https://github.com/pH7Software/pH7-Social-Dating-CMS (accessed on 1 September 2021).
- Symphonycms. Available online: https://github.com/symphonycms/symphonycms (accessed on 1 September 2021).
- GreenCMS. Available online: https://github.com/GreenCMS/GreenCMS/ (accessed on 1 September 2021).
- Dahse, J.; Holz, T. Simulation of Built-in PHP Features for Precise Static Code Analysis. NDSS 2014, 14, 23–26. [Google Scholar]
- Seay. Available online: https://github.com/f1tz/cnseay (accessed on 1 September 2021).
- Tomikoski. Fast Web Fuzzer. Available online: https://github.com/ffuf/ffuf (accessed on 1 September 2021).
- Xmendez. Wfuzz–The Web Fuzzer. Available online: https://github.com/xmendez/wfuzz (accessed on 1 September 2021).
- d4rckh. Very Advanced Fuzzer. Available online: https://github.com/d4rckh/vaf (accessed on 1 September 2021).
- SpiderLabs. ModSecurity. Available online: https://github.com/SpiderLabs/ModSecurity (accessed on 20 December 2021).
- Xmendez. Suhosin. Available online: https://github.com/sektioneins/suhosin (accessed on 20 December 2021).
- Livshits, V.B.; Lam, M.S. Finding Security Vulnerabilities in Java Applications with Static Analysis. USENIX Secur. Symp. 2005, 14, 18. [Google Scholar]
- Jovanovic, N.; Kruegel, C.; Kirda, E. Pixy: A static analysis tool for detecting Web application vulnerabilities. In Proceedings of the 2006 IEEE Symposium on Security and Privacy (S P’06), Oakland, CA, USA, 21–24 May 2006. [Google Scholar] [CrossRef]
- d’Amore, F.; Gentile, M. Automatic and Context-Aware Cross-Site Scripting Filter Evasion; Department of Computer, Control, and Management Engineering Antonio Ruberti: Rome, Italy, 2012. [Google Scholar]
- Van Rooij, O.; Charalambous, M.A.; Kaizer, D.; Papaevripides, M.; Athanasopoulos, E. webFuzz: Grey-Box Fuzzing for Web Applications. In Computer Security–ESORICS 2021; Lecture Notes in Computer Science; Bertino, E., Shulman, H., Waidner, M., Eds.; Springer International Publishing: Cham, Switzerland, 2021; Volume 12972, pp. 152–172. [Google Scholar] [CrossRef]
- Huang, J.; Zhang, J.; Liu, J.; Li, C.; Dai, R. UFuzzer: Lightweight Detection of PHP-Based Unrestricted File Upload Vulnerabilities Via Static-Fuzzing Co-Analysis. In Proceedings of the 24th International Symposium on Research in Attacks, Intrusions and Defenses, San Sebastian, Spain, 6–8 October 2021; ACM: San Sebastian, Spain, 2021; pp. 78–90. [Google Scholar] [CrossRef]
- Lee, T.; Wi, S.; Lee, S.; Son, S. FUSE: Finding File Upload Bugs via Penetration Testing. In Proceedings of the Network and Distributed Systems Security (NDSS) Symposium 2020, San Diego, CA, USA, 23–26 February 2020. [Google Scholar]
- Benedikt, M.; Freire, J.; Godefroid, P. VeriWeb: Automatically Testing Dynamic Web Sites. In Proceedings of the 11th International World Wide Web Conference(WWW’2002), Honolulu, HI, USA, 7–11 May 2002. [Google Scholar]
- Huang, Y.W.; Huang, S.K.; Lin, T.P.; Tsai, C.H. Web Application Security Assessment by Fault Injection and Behavior Monitoring. In Proceedings of the 12th International Conference on World Wide Web, Budapest, Hungary, 20–24 May 2003; Association for Computing Machinery: New York, NY, USA, 2003; pp. 148–159. [Google Scholar] [CrossRef]
- Saxena, P.; Hanna, S.; Poosankam, P.; Song, D. FLAX: Systematic Discovery of Client-side Validation Vulnerabilities in Rich Web Applications. In Proceedings of the 17th Annual Network and Distributed System Security Symposium (NDSS), San Diego, CA, USA, 28 February–3 March 2010. [Google Scholar]
Type of Experiment | Target Web Application | Version | Vul-ID |
---|---|---|---|
RQ1 | DVWA [22] | 1.9 | – |
bWAPP [23] | 2.2 | – | |
Pikachu [24] | 1.0 | – | |
RQ2 | Zzzcms [25] | 2.03 | CVE-2021-32605 |
Pbootcms [26] | 1.3.2 | CNVD-2021-33224 | |
cmsuno [27] | 1.6.2 | CVE-2020-25557 | |
MyuCMS [28] | 2.1 | CNVD-2019-43630 | |
FineCms [29] | 5.0.9 | CVE-2017-11585 | |
Maccms [30] | 8.x | CVE-2017-17733 | |
Seacms [31] | 6.28 | – | |
RQ3 | CREMB [32] | 2.6.13 | – |
CREMB [32] | 3.1.0 | – | |
imcat [33] | 5.2 | – | |
WMCMS [34] | 4.346 | – | |
xiaohuanxiongcms [35] | 5.0 | – | |
Maxsite cms [36] | 108 | – | |
GetSimple [37] | 3.3.16 | – | |
Kodicms [38] | 13.82.135 | – | |
ph7cms [39] | 16.2.2 | – | |
symphonycms [40] | 2.7.10 | c– | |
GreenCMS [41] | 2.3.0603 | – |
Target Web Applications | RIPS | Seay | Cefuzz |
---|---|---|---|
DVWA | ✓ | ✓ | ✓ |
bWAPP | ✓ | ✓ | ✓ |
Pikachu | ✓ | ✓ | ✓ |
Target Web Applications | RIPS | Seay | Cefuzz |
---|---|---|---|
zzzcms | ✗ | ✗ | ✓ |
Pbootcms | ✗ | ✓ | ✓ |
cmsuno | ✓ | ✓ | ✓ |
MyuCMS | ✗ | ✓ | ✓ |
FineCms | ✗ | ✗ | ✓ |
Maccms | ✗ | ✓ | ✓ |
Seacms | ✓ | ✗ | ✓ |
Web Applications | Version | Types | Vul-ID |
---|---|---|---|
CREMB | 2.6.13 | Command Injection | CNVD-2020-31496 |
CREMB | 3.1.0 | Command Injection | CNVD-2020-31078 |
imcat | 5.2 | Command Injection | CNVD-2020-33075 |
WMCMS | 4.346 | Code Execution | CNVD-2020-31070 |
xiaohuanxiongcms | 5.0 | Code Execution | CNVD-2021-80217 |
xiaohuanxiongcms | 5.0 | Code Execution | CNVD-2021-80221 |
xiaohuanxiongcms | 5.0 | Code Execution | CNVD-2021-80223 |
Maxsite cms | 108 | Code Execution | CNVD-2021-80212 |
GetSimple | 3.3.16 | Code Execution | CNVD-2020-62880 |
KodiCMS | 13.82.135 | Code Execution | CNVD-2021-79629 |
ph7cms | 16.2.2 | Code Execution | CNVD-2021-79627 |
symphonycms | 2.7.10 | Code Execution | CNVD-2021-81498 |
GreenCMS | 2.3.0603 | Code Execution | CNVD-2021-81522 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 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
Zhao, J.; Lu, Y.; Zhu, K.; Chen, Z.; Huang, H. Cefuzz: An Directed Fuzzing Framework for PHP RCE Vulnerability. Electronics 2022, 11, 758. https://doi.org/10.3390/electronics11050758
Zhao J, Lu Y, Zhu K, Chen Z, Huang H. Cefuzz: An Directed Fuzzing Framework for PHP RCE Vulnerability. Electronics. 2022; 11(5):758. https://doi.org/10.3390/electronics11050758
Chicago/Turabian StyleZhao, Jiazhen, Yuliang Lu, Kailong Zhu, Zehan Chen, and Hui Huang. 2022. "Cefuzz: An Directed Fuzzing Framework for PHP RCE Vulnerability" Electronics 11, no. 5: 758. https://doi.org/10.3390/electronics11050758
APA StyleZhao, J., Lu, Y., Zhu, K., Chen, Z., & Huang, H. (2022). Cefuzz: An Directed Fuzzing Framework for PHP RCE Vulnerability. Electronics, 11(5), 758. https://doi.org/10.3390/electronics11050758