(CVE-2024-38856)ofbiz_12.14_filter绕过到rce
0x01 Vulnerability description
In apache ofbiz 12.14, there is remote command execution. Users can use a specific url to bypass filter detection, resulting in unauthorized execution of goorvy code.
0x02 poc
First convert Reverse Shell to a form that can be recognized by java
1 |
|
1 |
|
Using unicode coding
1 |
|
1 |
|
Using nc snooping on Linux 8888
1 |
|
Shell is successfully obtained after the corresponding packet is sent.
0x03 Code analysis
If the url I submitted is control/main/ProgramExport, filter will do the following
org.apache.ofbiz.webapp.control.ControlFilter
1 |
|
You can see in lines 137-148 that this is a fix for (CVE-2024-32113) Path traversal leading to RCE.
1 |
|
Then look down, line 174 redirectPath and go to the position of “/“ for splicing, and finally get / control/main
1 |
|
Finally, filter is called to check “/ control/main”, but “/ control/main” does not require authentication, so bypass the filter check.。
After a series of processing, come to
org.apache.ofbiz.webapp.control.RequestHandler#doRequest.java
1 |
|
Get the path at line 275 to get the final url, get the ProgramExport, and assign the value to overrideViewUri.
1 |
|
From lines 741 to 743, get the name “view” from overrideViewUri, and then call renderView to render.
/webtools/groovyScripts/entity/ProgramExport.groovy
1 |
|
Between lines 55 and 80, we can see that the ProgramExport receives the parameter groovyProgram to pass the value. Then call the SecuredUpload.isValidText function to check the blacklist.
org.apache.ofbiz.security.SecuredUpload#isValidText
1 |
|
Blacklist in DENIEDWEBSHELLTOKENS
framework/security/config/security.properties
1 |
|
As you can see, it is based on character matching, and we only need to unicode the payload to bypass it.
At this point, the entire exploit is completed.
声明
此文章 仅用于教育目的。请负责任地使用它,并且仅在您有明确测试权限的系统上使用。滥用此 PoC 可能会导致严重后果。