Mycroft security

Hi all, I’m new to Mycroft and so far loving the project. I’m running Mycroft on Ubuntu and setting up a Picroft.

When I start up Mycroft I get this warning:

CAUTION: The Mycroft bus is an open websocket with no built-in security
measures. You are responsible for protecting the local port
8181 with a firewall as appropriate.

What does this really mean? How do I protect local port 8181? I’m also curious about future security implications. If I had Mycroft connected to all my IoT devices in my home what security precautions would I need to take?
I ask these questions more out of curiosity than real concern. I’m curious about security with AI especially in domestic situations.

Thanks, Henry.

You can try doing:
sudo /sbin/iptables -A INPUT -p tcp -s localhost --dport 8181 -j ACCEPT
sudo /sbin/iptables iptables -A INPUT -p tcp --dport 8181 -j DROP

Perhaps add that to your script if you want (or to your boot scripts–see

That would block traffic that’s not from localhost.

The other stuff…
You would want to secure your home network as much as you can, ie, wpa2 (or wpa3 when that gets here) with strong passwords, regular firmware updates, limit access to it as much as possible via mac/dhcp restrictions, monitor your network regularly, shut it down when you’re not home if you can, etc. I go one step further and run an isolated (ie, not connected to the internet) network for the iot bits.

Mycroft is regularly updated, so update your instance when you see new releases, update the underlying OS and packages as well.


As a noob concerned with security, I’m trying to understand this warning. It appears port 8181 is open to internal LAN networks. It looks like the port to (remote server set in the ~/mycroft-core/mycroft/configuration/mycroft.conf) is communicating over secure web port 443 along with other common secure traffic such as the browser to httpS sites.

This other post mentions using UFW on linux to set the firewall config, yet doesnt describe what those would be. Assuming the iptable setting above are answering the same or similar question, UFW can be set on Kubuntu with GUFW to Deny both incoming and outgoing traffice on port 8181, but that only secures the intranet local network. What does this break or disable? Talking to mycroft remotely when setup, obviously(?), but also the Kubuntu Plasmoid? What other services would it break from functioning. Will try again now that better setup…

The other post (What is port 8181 for?!) also does mention an attack that looks worrisome, but ‘only’ seems to apply to data used by mycroft. I suppose if someone has access to your internal network you may have bigger problems to worry about, depending on what data you store inside mycroft.

What are the best methods to secure the traffic going to and from I did see this topic here and replied with the method to disable initiation of all connection to the main website from the README: Easiest way to use Mycroft completely offline. Is it just as secure as other data travelling over secure port 443?

Locations of the config files:
* Default - mycroft-core/mycroft/configuration/mycroft.conf
* Remote (from - /var/tmp/mycroft_web_cache.json
* System - /etc/mycroft/mycroft.conf
* User - $HOME/.mycroft/mycroft.conf

Traffic between your Mycroft instance and the backend at is sent using the industry standard TLS (aka “SSL”) encryption protocol. So that’s the same type of connection you use to connect with your email provider or bank.

Locking the 8181 port down to localhost means that nothing outside your machine can communicate with it. So a Plasmoid, if it’s running on the same device should be fine. A web gui running on a separate computer or server will be blocked.

Thanks again @gez-mycroft. Thats what I was assuming. The error message looks like it is aimed more for folks using the Mycroft Mark devices on their internal network. Especially in response to the privacy and security concerns in comparison to Google Home and Alexa, which are opaque and could be compromised like the Chromecasts were.

Also, circling back to the iptables, it looks like this accepts the Source localhost and drops all others, both on TCP. A similar rule can be created in UFW or GUFW if that is more readable or more persistent for others.
sudo /sbin/iptables -s localhost -A INPUT -p tcp --dport 8181 -j ACCEPT
sudo /sbin/iptables iptables -A INPUT -p tcp --dport 8181 -j DROP

1 Like

@baconator Something didnt look right about those commands, but I usually use GUFW instead of commands to set firewall rules… I did put those two lines in my script, but it looks like the second line is ‘malformed’ and doesnt work, and the first line repeatedly creates a rule in sudo iptables --list every time the startup script is run. As for permanence, I think there is an /etc file to put these commands in for system startup… or people can use GUFW.

I believe its just a typo that the word iptables occurs twice, but Im not sure if the source localhost -s localhost was intended to be included in the DROP command or if it defaults to all sources to be dropped without specifying.

This command did work:
sudo /sbin/iptables -A INPUT -p tcp --dport 8181 -j DROP

Use the -D flag to delete rules multiple times. Dont know if there is a ‘delete all’ command.
sudo /sbin/iptables -D INPUT -p tcp -s localhost --dport 8181 -j ACCEPT

Then check with:
sudo iptables --list | grep 8181

to understand why that port needs to be closed in the firewall see

1 Like

This may be of interest:
`Context Sensitive Access Control in Smart Home Environments

In this paper, we propose the creation of the PALS system, that builds upon existing work in an attribute-based access control model, captures physical context collected from sensed data (attributes), and performs dynamic reasoning over these attributes and context-driven policies using Semantic Web technologies to execute access control decisions. Reasoning over user context, details of the information collected by the cloud service provider, and device type our mechanism generates as a consequent access control decisions. Our system’s access control decisions are supplemented by another sub-system that detects intrusions into smart home systems based on both network and behavioral data. The combined approach serves to determine indicators that a smart home system is under attack, as well as limit what data breach such attacks can achieve.

1 Like

Maybe someone can double check these, but to clarify I believe the correct firewall rules to block port 8181 except from localhost are either:

using iptables:
sudo /sbin/iptables -A INPUT -p tcp -s localhost --dport 8181 -j ACCEPT
sudo /sbin/iptables -A INPUT -p tcp --dport 8181 -j DROP

using ufw:
sudo ufw allow in from to any port 8181
sudo ufw deny in from any to any port 8181  

using gufw (tested):
add         a 'simple' rule with Rule Name, allow, in, both, 8181
add an 'advanced' rule wth Rule Name, insert position 1, allow, in, all interfaces, log or not, both, from port 8181, to, port 8181 (or leave blank).

Im not positive on the destination IP, whether it should be to all or not…

1 Like

Worked for my using ufw! Thanks!