T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/mqtt_bridge.py:36
- Finding
- Location and Device Metadata Publishing Is Enabled by Default<![CDATA[ ## Vulnerability Details **File Location**: `scripts/mqtt_bridge.py:36-47`, `scripts/mqtt_bridge.py:184-240`, `scripts/mqtt_bridge.py:340-347`, `scripts/mqtt_bridge.py:387-397` **Vulnerability Type**: Privacy-sensitive external transmission enabled without explicit consent **Risk Level**: High ### Vulnerable Code ```python # Spanish Map MQTT (publish position) MQTT_MAP_BROKER = "mqtt.meshtastic.es" MQTT_MAP_PORT = 1883 MQTT_MAP_USER = "meshdev" MQTT_MAP_PASS = "large4cats" # My location (set your coordinates) MY_LAT = 0.0 # Set your latitude MY_LON = 0.0 # Set your longitude # State MAP_ENABLED = True # Toggle via socket command ``` ```python def publish_map_report(): """Publish position to Spanish map (protobuf format)""" global mesh_interface, mqtt_map, MAP_ENABLED if not MAP_ENABLED: log.info("📍 Map report skipped (disabled)") return if not mesh_interface or not mqtt_map: log.warning("Map report skipped: no connection") return try: from meshtastic.protobuf import mqtt_pb2, mesh_pb2, portnums_pb2 my_node = mesh_interface.getMyNodeInfo() if not my_node: return pos = my_node.get('position', {}) lat, lon = pos.get('latitude'), pos.get('longitude') if not lat or not lon: log.info("Map report skipped: no GPS fix") return my_info = mesh_interface.myInfo metadata = mesh_interface.metadata user = my_node.get('user', {}) node_num = my_info.my_node_num # Fuzzy position (~2km) lat_fuzzy = round(lat * 50) / 50 lon_fuzzy = round(lon * 50) / 50 # Create MapReport protobuf map_report = mqtt_pb2.MapReport() map_report.long_name = user.get('longName', 'Unknown') map_report.short_name = user.get('shortName', '??') map_report.latitude_i = int(lat_fuzzy * 1e7) ...[truncated 3591 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Change the source default to `MAP_ENABLED = False`. 2. Parse one authoritative configuration file and enforce `mqtt_publish.enabled`. 3. Do not connect to the map broker until the user explicitly enables publishing. 4. Present the exact fields, destination broker, publication interval, and privacy implications before obtaining consent. 5. Persist the opt-in state securely so restarting the process does not silently re-enable publishing. 6. Permit users to omit node names, altitude, hardware, firmware, and gateway identifiers. 7. Allow configurable fuzzing and consider randomized or coarser location reporting rather than a stable grid point. 8. Add an integration test asserting that no map connection or publication occurs with the default configuration. ]]>
