-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Papercut ng mf CVE-2023-27350 #338
Papercut ng mf CVE-2023-27350 #338
Conversation
Hi @maoning ! This PR has been open for a couple months. Just wanted to check if everything was okay with it or if there were any changes you needed me to make! Thanks! :) |
...E_2023_27350/src/main/java/com/google/tsunami/plugins/papercut/PapercutNGMFVulnDetector.java
Outdated
Show resolved
Hide resolved
...E_2023_27350/src/main/java/com/google/tsunami/plugins/papercut/PapercutNGMFVulnDetector.java
Outdated
Show resolved
Hide resolved
...E_2023_27350/src/main/java/com/google/tsunami/plugins/papercut/PapercutNGMFVulnDetector.java
Outdated
Show resolved
Hide resolved
...E_2023_27350/src/main/java/com/google/tsunami/plugins/papercut/PapercutNGMFVulnDetector.java
Outdated
Show resolved
Hide resolved
...E_2023_27350/src/main/java/com/google/tsunami/plugins/papercut/PapercutNGMFVulnDetector.java
Outdated
Show resolved
Hide resolved
...E_2023_27350/src/main/java/com/google/tsunami/plugins/papercut/PapercutNGMFVulnDetector.java
Outdated
Show resolved
Hide resolved
...E_2023_27350/src/main/java/com/google/tsunami/plugins/papercut/PapercutNGMFVulnDetector.java
Outdated
Show resolved
Hide resolved
@Isaac-GC Sorry for the delay, the main comment I had in the review is about testing the real code execution in the plugin. I would like to see this plugin merged in before end of the year. Once you have the updated version, I will try to finish the review asap. |
@Isaac-GC I have patched in your plugin and tested against the vulnerable container you provided, your plugin doesn't report the vulnerability as expected. There are 2 main issues after some debugging:
Could you double check on your end to verify the nmap output (from a local Tsunami run). If your nmap does return http service, could you let me know your nmap version? I'm curious about the differences in our nmap output.
Also, please test out the plugin with a local instance of the callback server and verify the detector works e2e (triggering callback interaction and reporting a vulnerability). Let me know if you have any issue configuring the callback server with your Tsunami instance. |
...0/src/main/java/com/google/tsunami/plugins/papercut/PapercutNGMFVulnDetectorWithPayload.java
Outdated
Show resolved
Hide resolved
@Isaac-GC Let me know if you have further questions about the comments and if there's any issue with callback server usage. I would like to have your plugin merged soon :) |
Hi @maoning, apologies on the delay! I just pushed the latest version of the code and should be good to be tested on your side. (I confirmed it worked as expected with all of the vulnerable papercut versions). The PR summary was also updated to reflect a change in the ports used by the docker containers. Instead of using the default port of 9191, I modified the server properties to have the container port instead be reflected as 80 (which is a more real world scenario, albeit without HTTPS just for testing purposes) There were some issues encountered that were primarily session based (see the below summary) and some issues with how the parameter strings were handled built from the initial push. But everything seems to be working now :) If possible or if you would think it is beneficial, please consider adding ability to use the CookieJar implementation from the OkHttp library as one of the capabilities for the client connection. While this plugin may be an edge-case in regards to using/needing session management, I still feel having that potentially being added into the Tsunami Scanner will greatly increase the overall capabilities/possibilities for the tool. LMK your thoughts on this! Thanks! :) Adding this here for anyone in the future that may review this pull request or reference this CVE: Upon connecting to the application initially with the To handle the url path parameters in clear/easy way when using the OkHTTP library, please reference Line 110 in PapercutNGMFHelper.class |
Hey @maoning! I know you said you wanted to merge the plug-in soon, just wanted to check if there were any issues on you encountered or any changes you'd like to me to make! Thanks! |
Thanks @Isaac-GC for the wait as well as your detailed response, supporting the cookie jar feature from okhttp in Tsunami is a great idea! I will track it as a feature request for Tsunami. I have re-tested your updated plugin, everything is working well now. I will leave some comment about the minor styling issues in the code review for future references. For the sake of the time, I will merge in your code and fix them up quickly on my side. We have recently updated our patch reward tracking workflow. Could you resubmit this plugin via the form at https://bughunters.google.com/report/tsunami? The reward is expected to be distributed 2-3 weeks after the code merge (slightly delayed by the holidays). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The directory should be named with all lower case letters papercut_ng_mf_cve_2023_27350
. The java class name should be all in camel case, PapercutNgMfHelper
for instance.
public String JSESSION_ID = ""; | ||
private String root_url = ""; | ||
private String base_app_url = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor styling issue: these should all be in camel case, match pattern '^[a-z][a-zA-Z0-9]*_?$'. [MemberName]
Only the static variables are in capitalized format with underscores.
headers.addHeader("Accept", "*/*"); | ||
|
||
// Add content-type helper | ||
if (isPostRequest) headers.addHeader("Content-Type", "application/x-www-form-urlencoded"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Styling nit: add curly brackets for if/else statement.
try { | ||
response = this.httpClient.send(request, this.networkService); | ||
this.updateJsessionId(response); // Update JSESSION_ID if needed | ||
this.previousUrl = (this.base_app_url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remote bracket
|
||
// Post/send above params | ||
helper.sendPostRequest(helper.buildParameterString(setupCompletedPage)); | ||
// helper.sendGetRequest("service=page/Dashboard"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug comment
} | ||
|
||
@Test | ||
public void detect_whenVulnerable_returnsVulnerability() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a test for detection without callback server.
Papercut NG/MF Authentication Bypass and RCE Detector
Summary
The detector is intended to be more simplified and focus primarily on the authentication bypass. This is to stay aligned with the goal of the Tsunami Security Scanner by being simple, quick, and accurate.
While this detector does not specifically detect for RCE, it looks for the initial authentication bypass (falls under the same CVE) that is then used to perform the RCE. To do this, it requests/navigates to
<root_webserver_url>/app?service=page/SetupCompleted
, where one of two events may happen:200
and the textConfiguration Wizard : Setup Complete
is present. If this is seen, an attacker is capable of logging in as Admin and performing the RCE302
, followed by a200
and a webpage where the user is forced to log inTesting
Images and OCI image sources to test this plugin can be found at:
https://github.com/Isaac-GC/papercut_ng_mf_docker_images
These images simulate a near realistic production environment and are prebuilt/preconfigured to let you get started ASAP.
They currently consist of two version types:
Vulnerable
ghcr.io/isaac-gc/papercut_ng_mf:19.2.7.62195
ghcr.io/isaac-gc/papercut_ng_mf:20.1.4.57927
ghcr.io/isaac-gc/papercut_ng_mf:21.2.10.62186
ghcr.io/isaac-gc/papercut_ng_mf:22.0.1.62695
Non-vulnerable (patched)
ghcr.io/isaac-gc/papercut_ng_mf:20.1.8.66704
ghcr.io/isaac-gc/papercut_ng_mf:21.2.12.66701
ghcr.io/isaac-gc/papercut_ng_mf:22.0.12.66453
Using the images
docker pull ghcr.io/isaac-gc/papercut_ng_mf:22.0.1.62695
docker run -it --rm -p 80:80 ghcr.io/isaac-gc/papercut_ng_mf:22.0.1.62695