SlideShare a Scribd company logo
1 of 10
CVE
2021-42013
www.safe.security
Aman Saxena
Apaar Farmaha
Shlok Yadav
CVE-2021-42013
01
Introduction
Table of Contents
02
Vulnerability Details
03
Mitigation
04
Exploitation
05
References
2
Safe Securities, Inc.
Safe Securities, Inc. 2
CVE-2021-
42013
Introduction
Safe Securities, Inc. 3
The Apache HTTP Server is a free and open-source
cross-platform web server software, released under the
terms of Apache License 2.0. Apache is developed and
maintained by an open community of developers under
the auspices of the Apache Software Foundation.
The vast majority of Apache HTTP Server instances run on
a Linux distribution, but current versions also run on
Microsoft Windows, OpenVMS, and a wide variety of
Unix-like systems.
This document aims at explaining some recent
vulnerabilities in Apache HTTP Server that leads to attacks
like Path Traversal and Remote Code Execution.
CVE-2021-42013
Vulnerability Details
A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An
attacker could use a path traversal attack to map URLs to files outside the expected
document root. If files outside of the document root are not protected by “require all denied”
these requests can succeed. Additionally this flaw could leak the source of interpreted files like
CGI scripts. This issue is known to be exploited in the wild. This issue was assigned
CVE-2021-41773.
Although a fix for CVE-2021-41773 was released with Apache HTTP Server 2.4.50, it was found to
be insufficient. An attacker could use a path traversal attack to map URLs to files outside the
directories configured by Alias-like directives. If files outside of these directories are not
protected by the usual default configuration “require all denied”, these requests can succeed.
If CGI scripts are also enabled for these aliased paths, this could allow for remote code
execution.
CVSS v3
Base Score 9.8
Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Attack Vector Network
Attack Complexity Low
Privileges Required None
User Interaction None
Scope Unchanged
Confidentiality High
Integrity Impact High
Availability Impact High
Safe Securities, Inc. 4
CVE-2021-42013
Scope of Impact
● Apache HTTP Server version 2.4.49
● Apache HTTP Server version 2.4.50
Mitigation
It was found that the fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient. An
attacker could use a path traversal attack to map URLs to files outside the directories
configured by Alias-like directives.
If files outside of these directories are not protected by the usual default configuration "require
all denied", these requests can succeed. If CGI scripts are also enabled for these aliased paths,
this could allow for remote code execution.
Rest, the fix to this is fairly straightforward. Update your version of Apache HTTP Server to the
latest version. As of this writing, 2.4.51 is the appropriate version.
Alternatively, to mitigate, one could update the directory stanza to the default:
However, the likelihood that making that change might break your website is high.
5
Safe Securities, Inc.
Safe Securities, Inc. 5
CVE-2021-42013
Exploitation
Scefiario
● Emulation of a server (Ubuntu 20.04 LTS) running Apache HTTP Server 2.4.50, using
Docker.
Following assumptions are made with the configuration of Apache HTTP Server 2.4.50:
○ For path traversal vulnerability to work, the default httpd.conf must have the
following lines as part of misconfiguration:
○ For remote code execution to work, the default httpd.conf must have CGI
enabled with following lines
Provided, docker is already installed, the following commands would provision an
Ubuntu 20.04 LTS container installed with Apache HTTP Server 2.4.50 running on 80/tcp
considering the above configurations and output the IPv4 address of the container :
● Host machine acting as an attacker machine with capabilities of running a bash script.
Safe Securities, Inc. 6
CVE-2021-42013
Executiofi
1
. Create a new file named cve-2021-42013.sh on attacker machine with the following
exploit code:
2. Set the cve-2021-42013.sh file as executable and run it by executing the following
commands:
3. To test for and confirm path traversal, a valid directory needs to be discovered which in
this case is configured as /icons. So, executing the following command would trigger
path traversal vulnerability and print the contents of /etc/passwd:
Safe Securities, Inc. 7
CVE-2021-42013
4. To test for and confirm remote code execution, CGI should be configured and enabled
which in this case is true. So, executing the following command would trigger remote
code execution and print the output of the id command:
5. From an attacker perspective, remote code execution is critical to get access to an
interactive shell. So, executing the following command would trigger a conventional
reverse shell over tcp based on bash to attacker’s system on port 80/tcp:
Safe Securities, Inc. 8
CVE-2021-
42013
References
Safe Securities, Inc. 9
● https://nvd.nist.gov/vuln/detail/CVE-2021-42013
● https://cve.mitre.org/cgi-bin/cvename.cgi?name=C
VE-2021-42013
● https://github.com/walnutsecurity/cve-2021-42013
www.safe.security |info@safe.security
Palo Alto
3000,EI Camino Real,
Building 4,Suite 200,CA
94306

More Related Content

Similar to document.pptx

Meeting 14. web server ii
Meeting 14. web server iiMeeting 14. web server ii
Meeting 14. web server iiSyaiful Ahdan
 
Apache web server tutorial for linux
Apache web server tutorial for linuxApache web server tutorial for linux
Apache web server tutorial for linuxSahad Sali
 
Cohesive networks Support Docs: VNS3:turret WAF Guide
Cohesive networks Support Docs: VNS3:turret WAF GuideCohesive networks Support Docs: VNS3:turret WAF Guide
Cohesive networks Support Docs: VNS3:turret WAF GuideCohesive Networks
 
Using aphace-as-proxy-server
Using aphace-as-proxy-serverUsing aphace-as-proxy-server
Using aphace-as-proxy-serverHARRY CHAN PUTRA
 
A Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsA Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsSalman Baset
 
Ceh v5 module 11 hacking webservers
Ceh v5 module 11 hacking webserversCeh v5 module 11 hacking webservers
Ceh v5 module 11 hacking webserversVi Tính Hoàng Nam
 
Configuration of Self Signed SSL Certificate For CentOS 8
Configuration of Self Signed SSL Certificate For CentOS 8Configuration of Self Signed SSL Certificate For CentOS 8
Configuration of Self Signed SSL Certificate For CentOS 8Kaan Aslandağ
 
Apache windows
Apache windowsApache windows
Apache windowsmexxixxo
 
Malicious file upload attacks - a case study
Malicious file upload attacks - a case studyMalicious file upload attacks - a case study
Malicious file upload attacks - a case studyOktawian Powazka
 
VAPT_FINAL SLIDES.pptx
VAPT_FINAL SLIDES.pptxVAPT_FINAL SLIDES.pptx
VAPT_FINAL SLIDES.pptxkarthikvcyber
 
Apache struts vulnerabilities compromise corporate web servers 
Apache struts vulnerabilities compromise corporate web servers Apache struts vulnerabilities compromise corporate web servers 
Apache struts vulnerabilities compromise corporate web servers Jeff Suratt
 
VAPT PRESENTATION full.pptx
VAPT PRESENTATION full.pptxVAPT PRESENTATION full.pptx
VAPT PRESENTATION full.pptxDARSHANBHAVSAR14
 
Introduction to Apache Web Services using latex
 Introduction to Apache Web Services using latex Introduction to Apache Web Services using latex
Introduction to Apache Web Services using latexManash Kumar Mondal
 
Shellshock - A Software Bug
Shellshock - A Software BugShellshock - A Software Bug
Shellshock - A Software Bugvwchu
 
APACHE
APACHEAPACHE
APACHEARJUN
 

Similar to document.pptx (20)

Meeting 14. web server ii
Meeting 14. web server iiMeeting 14. web server ii
Meeting 14. web server ii
 
Apache web server tutorial for linux
Apache web server tutorial for linuxApache web server tutorial for linux
Apache web server tutorial for linux
 
Cohesive networks Support Docs: VNS3:turret WAF Guide
Cohesive networks Support Docs: VNS3:turret WAF GuideCohesive networks Support Docs: VNS3:turret WAF Guide
Cohesive networks Support Docs: VNS3:turret WAF Guide
 
Apache ppt
Apache pptApache ppt
Apache ppt
 
Using aphace-as-proxy-server
Using aphace-as-proxy-serverUsing aphace-as-proxy-server
Using aphace-as-proxy-server
 
A Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container PlatformsA Survey of Container Security in 2016: A Security Update on Container Platforms
A Survey of Container Security in 2016: A Security Update on Container Platforms
 
Web Security
Web SecurityWeb Security
Web Security
 
Hafnium attack
Hafnium attackHafnium attack
Hafnium attack
 
Ceh v5 module 11 hacking webservers
Ceh v5 module 11 hacking webserversCeh v5 module 11 hacking webservers
Ceh v5 module 11 hacking webservers
 
Configuration of Self Signed SSL Certificate For CentOS 8
Configuration of Self Signed SSL Certificate For CentOS 8Configuration of Self Signed SSL Certificate For CentOS 8
Configuration of Self Signed SSL Certificate For CentOS 8
 
Apache windows
Apache windowsApache windows
Apache windows
 
Malicious file upload attacks - a case study
Malicious file upload attacks - a case studyMalicious file upload attacks - a case study
Malicious file upload attacks - a case study
 
VAPT_FINAL SLIDES.pptx
VAPT_FINAL SLIDES.pptxVAPT_FINAL SLIDES.pptx
VAPT_FINAL SLIDES.pptx
 
Apache struts vulnerabilities compromise corporate web servers 
Apache struts vulnerabilities compromise corporate web servers Apache struts vulnerabilities compromise corporate web servers 
Apache struts vulnerabilities compromise corporate web servers 
 
VAPT PRESENTATION full.pptx
VAPT PRESENTATION full.pptxVAPT PRESENTATION full.pptx
VAPT PRESENTATION full.pptx
 
Introduction to Apache Web Services using latex
 Introduction to Apache Web Services using latex Introduction to Apache Web Services using latex
Introduction to Apache Web Services using latex
 
Shellshock - A Software Bug
Shellshock - A Software BugShellshock - A Software Bug
Shellshock - A Software Bug
 
Pentest and Security Discussion
Pentest and Security DiscussionPentest and Security Discussion
Pentest and Security Discussion
 
Web Hacking
Web HackingWeb Hacking
Web Hacking
 
APACHE
APACHEAPACHE
APACHE
 

Recently uploaded

FULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
FULL ENJOY - 9953040155 Call Girls in Indirapuram | DelhiFULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
FULL ENJOY - 9953040155 Call Girls in Indirapuram | DelhiMalviyaNagarCallGirl
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhisoniya singh
 
Aminabad @ Book Call Girls in Lucknow - 450+ Call Girl Cash Payment 🍵 8923113...
Aminabad @ Book Call Girls in Lucknow - 450+ Call Girl Cash Payment 🍵 8923113...Aminabad @ Book Call Girls in Lucknow - 450+ Call Girl Cash Payment 🍵 8923113...
Aminabad @ Book Call Girls in Lucknow - 450+ Call Girl Cash Payment 🍵 8923113...akbard9823
 
Hazratganj / Call Girl in Lucknow - Phone 🫗 8923113531 ☛ Escorts Service at 6...
Hazratganj / Call Girl in Lucknow - Phone 🫗 8923113531 ☛ Escorts Service at 6...Hazratganj / Call Girl in Lucknow - Phone 🫗 8923113531 ☛ Escorts Service at 6...
Hazratganj / Call Girl in Lucknow - Phone 🫗 8923113531 ☛ Escorts Service at 6...akbard9823
 
FULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
FULL ENJOY - 9953040155 Call Girls in Shahdara | DelhiFULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
FULL ENJOY - 9953040155 Call Girls in Shahdara | DelhiMalviyaNagarCallGirl
 
Call girls in Kanpur - 9761072362 with room service
Call girls in Kanpur - 9761072362 with room serviceCall girls in Kanpur - 9761072362 with room service
Call girls in Kanpur - 9761072362 with room servicediscovermytutordmt
 
FULL ENJOY - 9953040155 Call Girls in Wazirabad | Delhi
FULL ENJOY - 9953040155 Call Girls in Wazirabad | DelhiFULL ENJOY - 9953040155 Call Girls in Wazirabad | Delhi
FULL ENJOY - 9953040155 Call Girls in Wazirabad | DelhiMalviyaNagarCallGirl
 
Hazratganj ] (Call Girls) in Lucknow - 450+ Call Girl Cash Payment 🧄 89231135...
Hazratganj ] (Call Girls) in Lucknow - 450+ Call Girl Cash Payment 🧄 89231135...Hazratganj ] (Call Girls) in Lucknow - 450+ Call Girl Cash Payment 🧄 89231135...
Hazratganj ] (Call Girls) in Lucknow - 450+ Call Girl Cash Payment 🧄 89231135...akbard9823
 
Islamabad Escorts # 03080115551 # Escorts in Islamabad || Call Girls in Islam...
Islamabad Escorts # 03080115551 # Escorts in Islamabad || Call Girls in Islam...Islamabad Escorts # 03080115551 # Escorts in Islamabad || Call Girls in Islam...
Islamabad Escorts # 03080115551 # Escorts in Islamabad || Call Girls in Islam...wdefrd
 
Lucknow 💋 Cheap Call Girls In Lucknow Finest Escorts Service 8923113531 Avail...
Lucknow 💋 Cheap Call Girls In Lucknow Finest Escorts Service 8923113531 Avail...Lucknow 💋 Cheap Call Girls In Lucknow Finest Escorts Service 8923113531 Avail...
Lucknow 💋 Cheap Call Girls In Lucknow Finest Escorts Service 8923113531 Avail...anilsa9823
 
Charbagh ! (Call Girls) in Lucknow Finest Escorts Service 🥗 8923113531 🏊 Avai...
Charbagh ! (Call Girls) in Lucknow Finest Escorts Service 🥗 8923113531 🏊 Avai...Charbagh ! (Call Girls) in Lucknow Finest Escorts Service 🥗 8923113531 🏊 Avai...
Charbagh ! (Call Girls) in Lucknow Finest Escorts Service 🥗 8923113531 🏊 Avai...gurkirankumar98700
 
FULL ENJOY - 9953040155 Call Girls in Burari | Delhi
FULL ENJOY - 9953040155 Call Girls in Burari | DelhiFULL ENJOY - 9953040155 Call Girls in Burari | Delhi
FULL ENJOY - 9953040155 Call Girls in Burari | DelhiMalviyaNagarCallGirl
 
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call GirlsCall Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call Girlsparisharma5056
 
Lucknow 💋 Escorts Service Lucknow Phone No 8923113531 Elite Escort Service Av...
Lucknow 💋 Escorts Service Lucknow Phone No 8923113531 Elite Escort Service Av...Lucknow 💋 Escorts Service Lucknow Phone No 8923113531 Elite Escort Service Av...
Lucknow 💋 Escorts Service Lucknow Phone No 8923113531 Elite Escort Service Av...anilsa9823
 
Alex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson StoryboardAlex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson Storyboardthephillipta
 
Lucknow 💋 Call Girl in Lucknow Phone No 8923113531 Elite Escort Service Avail...
Lucknow 💋 Call Girl in Lucknow Phone No 8923113531 Elite Escort Service Avail...Lucknow 💋 Call Girl in Lucknow Phone No 8923113531 Elite Escort Service Avail...
Lucknow 💋 Call Girl in Lucknow Phone No 8923113531 Elite Escort Service Avail...anilsa9823
 
Deira Call Girls # 0522916705 # Call Girls In Deira Dubai || (UAE)
Deira Call Girls # 0522916705 #  Call Girls In Deira Dubai || (UAE)Deira Call Girls # 0522916705 #  Call Girls In Deira Dubai || (UAE)
Deira Call Girls # 0522916705 # Call Girls In Deira Dubai || (UAE)wdefrd
 
Roadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMRoadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMroute66connected
 
Deconstructing Gendered Language; Feminist World-Making 2024
Deconstructing Gendered Language; Feminist World-Making 2024Deconstructing Gendered Language; Feminist World-Making 2024
Deconstructing Gendered Language; Feminist World-Making 2024samlnance
 
Editorial sephora annual report design project
Editorial sephora annual report design projectEditorial sephora annual report design project
Editorial sephora annual report design projecttbatkhuu1
 

Recently uploaded (20)

FULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
FULL ENJOY - 9953040155 Call Girls in Indirapuram | DelhiFULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
FULL ENJOY - 9953040155 Call Girls in Indirapuram | Delhi
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Vasant Kunj | Delhi
 
Aminabad @ Book Call Girls in Lucknow - 450+ Call Girl Cash Payment 🍵 8923113...
Aminabad @ Book Call Girls in Lucknow - 450+ Call Girl Cash Payment 🍵 8923113...Aminabad @ Book Call Girls in Lucknow - 450+ Call Girl Cash Payment 🍵 8923113...
Aminabad @ Book Call Girls in Lucknow - 450+ Call Girl Cash Payment 🍵 8923113...
 
Hazratganj / Call Girl in Lucknow - Phone 🫗 8923113531 ☛ Escorts Service at 6...
Hazratganj / Call Girl in Lucknow - Phone 🫗 8923113531 ☛ Escorts Service at 6...Hazratganj / Call Girl in Lucknow - Phone 🫗 8923113531 ☛ Escorts Service at 6...
Hazratganj / Call Girl in Lucknow - Phone 🫗 8923113531 ☛ Escorts Service at 6...
 
FULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
FULL ENJOY - 9953040155 Call Girls in Shahdara | DelhiFULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
FULL ENJOY - 9953040155 Call Girls in Shahdara | Delhi
 
Call girls in Kanpur - 9761072362 with room service
Call girls in Kanpur - 9761072362 with room serviceCall girls in Kanpur - 9761072362 with room service
Call girls in Kanpur - 9761072362 with room service
 
FULL ENJOY - 9953040155 Call Girls in Wazirabad | Delhi
FULL ENJOY - 9953040155 Call Girls in Wazirabad | DelhiFULL ENJOY - 9953040155 Call Girls in Wazirabad | Delhi
FULL ENJOY - 9953040155 Call Girls in Wazirabad | Delhi
 
Hazratganj ] (Call Girls) in Lucknow - 450+ Call Girl Cash Payment 🧄 89231135...
Hazratganj ] (Call Girls) in Lucknow - 450+ Call Girl Cash Payment 🧄 89231135...Hazratganj ] (Call Girls) in Lucknow - 450+ Call Girl Cash Payment 🧄 89231135...
Hazratganj ] (Call Girls) in Lucknow - 450+ Call Girl Cash Payment 🧄 89231135...
 
Islamabad Escorts # 03080115551 # Escorts in Islamabad || Call Girls in Islam...
Islamabad Escorts # 03080115551 # Escorts in Islamabad || Call Girls in Islam...Islamabad Escorts # 03080115551 # Escorts in Islamabad || Call Girls in Islam...
Islamabad Escorts # 03080115551 # Escorts in Islamabad || Call Girls in Islam...
 
Lucknow 💋 Cheap Call Girls In Lucknow Finest Escorts Service 8923113531 Avail...
Lucknow 💋 Cheap Call Girls In Lucknow Finest Escorts Service 8923113531 Avail...Lucknow 💋 Cheap Call Girls In Lucknow Finest Escorts Service 8923113531 Avail...
Lucknow 💋 Cheap Call Girls In Lucknow Finest Escorts Service 8923113531 Avail...
 
Charbagh ! (Call Girls) in Lucknow Finest Escorts Service 🥗 8923113531 🏊 Avai...
Charbagh ! (Call Girls) in Lucknow Finest Escorts Service 🥗 8923113531 🏊 Avai...Charbagh ! (Call Girls) in Lucknow Finest Escorts Service 🥗 8923113531 🏊 Avai...
Charbagh ! (Call Girls) in Lucknow Finest Escorts Service 🥗 8923113531 🏊 Avai...
 
FULL ENJOY - 9953040155 Call Girls in Burari | Delhi
FULL ENJOY - 9953040155 Call Girls in Burari | DelhiFULL ENJOY - 9953040155 Call Girls in Burari | Delhi
FULL ENJOY - 9953040155 Call Girls in Burari | Delhi
 
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call GirlsCall Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
Call Girl Service In Dubai #$# O56521286O #$# Dubai Call Girls
 
Lucknow 💋 Escorts Service Lucknow Phone No 8923113531 Elite Escort Service Av...
Lucknow 💋 Escorts Service Lucknow Phone No 8923113531 Elite Escort Service Av...Lucknow 💋 Escorts Service Lucknow Phone No 8923113531 Elite Escort Service Av...
Lucknow 💋 Escorts Service Lucknow Phone No 8923113531 Elite Escort Service Av...
 
Alex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson StoryboardAlex and Chloe by Daniel Johnson Storyboard
Alex and Chloe by Daniel Johnson Storyboard
 
Lucknow 💋 Call Girl in Lucknow Phone No 8923113531 Elite Escort Service Avail...
Lucknow 💋 Call Girl in Lucknow Phone No 8923113531 Elite Escort Service Avail...Lucknow 💋 Call Girl in Lucknow Phone No 8923113531 Elite Escort Service Avail...
Lucknow 💋 Call Girl in Lucknow Phone No 8923113531 Elite Escort Service Avail...
 
Deira Call Girls # 0522916705 # Call Girls In Deira Dubai || (UAE)
Deira Call Girls # 0522916705 #  Call Girls In Deira Dubai || (UAE)Deira Call Girls # 0522916705 #  Call Girls In Deira Dubai || (UAE)
Deira Call Girls # 0522916705 # Call Girls In Deira Dubai || (UAE)
 
Roadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NMRoadrunner Lodge, Motel/Residence, Tucumcari NM
Roadrunner Lodge, Motel/Residence, Tucumcari NM
 
Deconstructing Gendered Language; Feminist World-Making 2024
Deconstructing Gendered Language; Feminist World-Making 2024Deconstructing Gendered Language; Feminist World-Making 2024
Deconstructing Gendered Language; Feminist World-Making 2024
 
Editorial sephora annual report design project
Editorial sephora annual report design projectEditorial sephora annual report design project
Editorial sephora annual report design project
 

document.pptx

  • 2. CVE-2021-42013 01 Introduction Table of Contents 02 Vulnerability Details 03 Mitigation 04 Exploitation 05 References 2 Safe Securities, Inc. Safe Securities, Inc. 2
  • 3. CVE-2021- 42013 Introduction Safe Securities, Inc. 3 The Apache HTTP Server is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation. The vast majority of Apache HTTP Server instances run on a Linux distribution, but current versions also run on Microsoft Windows, OpenVMS, and a wide variety of Unix-like systems. This document aims at explaining some recent vulnerabilities in Apache HTTP Server that leads to attacks like Path Traversal and Remote Code Execution.
  • 4. CVE-2021-42013 Vulnerability Details A flaw was found in a change made to path normalization in Apache HTTP Server 2.4.49. An attacker could use a path traversal attack to map URLs to files outside the expected document root. If files outside of the document root are not protected by “require all denied” these requests can succeed. Additionally this flaw could leak the source of interpreted files like CGI scripts. This issue is known to be exploited in the wild. This issue was assigned CVE-2021-41773. Although a fix for CVE-2021-41773 was released with Apache HTTP Server 2.4.50, it was found to be insufficient. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration “require all denied”, these requests can succeed. If CGI scripts are also enabled for these aliased paths, this could allow for remote code execution. CVSS v3 Base Score 9.8 Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H Attack Vector Network Attack Complexity Low Privileges Required None User Interaction None Scope Unchanged Confidentiality High Integrity Impact High Availability Impact High Safe Securities, Inc. 4
  • 5. CVE-2021-42013 Scope of Impact ● Apache HTTP Server version 2.4.49 ● Apache HTTP Server version 2.4.50 Mitigation It was found that the fix for CVE-2021-41773 in Apache HTTP Server 2.4.50 was insufficient. An attacker could use a path traversal attack to map URLs to files outside the directories configured by Alias-like directives. If files outside of these directories are not protected by the usual default configuration "require all denied", these requests can succeed. If CGI scripts are also enabled for these aliased paths, this could allow for remote code execution. Rest, the fix to this is fairly straightforward. Update your version of Apache HTTP Server to the latest version. As of this writing, 2.4.51 is the appropriate version. Alternatively, to mitigate, one could update the directory stanza to the default: However, the likelihood that making that change might break your website is high. 5 Safe Securities, Inc. Safe Securities, Inc. 5
  • 6. CVE-2021-42013 Exploitation Scefiario ● Emulation of a server (Ubuntu 20.04 LTS) running Apache HTTP Server 2.4.50, using Docker. Following assumptions are made with the configuration of Apache HTTP Server 2.4.50: ○ For path traversal vulnerability to work, the default httpd.conf must have the following lines as part of misconfiguration: ○ For remote code execution to work, the default httpd.conf must have CGI enabled with following lines Provided, docker is already installed, the following commands would provision an Ubuntu 20.04 LTS container installed with Apache HTTP Server 2.4.50 running on 80/tcp considering the above configurations and output the IPv4 address of the container : ● Host machine acting as an attacker machine with capabilities of running a bash script. Safe Securities, Inc. 6
  • 7. CVE-2021-42013 Executiofi 1 . Create a new file named cve-2021-42013.sh on attacker machine with the following exploit code: 2. Set the cve-2021-42013.sh file as executable and run it by executing the following commands: 3. To test for and confirm path traversal, a valid directory needs to be discovered which in this case is configured as /icons. So, executing the following command would trigger path traversal vulnerability and print the contents of /etc/passwd: Safe Securities, Inc. 7
  • 8. CVE-2021-42013 4. To test for and confirm remote code execution, CGI should be configured and enabled which in this case is true. So, executing the following command would trigger remote code execution and print the output of the id command: 5. From an attacker perspective, remote code execution is critical to get access to an interactive shell. So, executing the following command would trigger a conventional reverse shell over tcp based on bash to attacker’s system on port 80/tcp: Safe Securities, Inc. 8
  • 9. CVE-2021- 42013 References Safe Securities, Inc. 9 ● https://nvd.nist.gov/vuln/detail/CVE-2021-42013 ● https://cve.mitre.org/cgi-bin/cvename.cgi?name=C VE-2021-42013 ● https://github.com/walnutsecurity/cve-2021-42013
  • 10. www.safe.security |info@safe.security Palo Alto 3000,EI Camino Real, Building 4,Suite 200,CA 94306