Skip to content

ZMQ interface vulnerable #1

Description

@fmikulu

I try to use ZMQ API in my C++ app in this way:

  • Connect via zmq.socket(REQ) and expect zmq.socket(REP) on the netconnect side
  • Listen by zmq.poll() and cancel recv() if there is no reply for some time

Request:

{
       "src_mid": "netconnect-interface",
       "func": "status",
       "params": {
       }
}

Replied: (printout as a string):

{\"mod_name\":\"netconnect-interface\",\"status\":\"success\",\"message\":{\"wifi_client\":{\"config\":{\"wifi_client\":{\"key\":\"asdfg\",\"ssid\":\"ASDFG\"},\"ipv4\":{\"dhcp\":true},\"name\":\"wlan0\"},\"ifname\":\"wlan0\",\"status\":\"CONNECTING\",\"error\":null},\"gw\":{\"ifname\":\"eth0\",\"ip\":\"192.168.1.1\"},\"wifi_ap\":{\"config\":null,\"ifname\":\"wlan0\",\"status\":\"INACTIVE\",\"error\":null},\"ncstatus\":{\"test_host\":\"www.google.com\",\"online\":true,\"last_online_check\":1568974489,\"dns\":[\"8.8.8.8\",\"8.8.4.4\"]},\"lan\":{\"config\":{\"ipv4\":{\"dhcp\":true,\"ip\":\"10.10.10.10\",\"dns\":[\"8.8.8.8\",\"8.8.4.4\"],\"gw\":\"10.10.10.1\",\"netmask\":\"255.255.255.0\"},\"name\":\"eth0\"},\"ifname\":\"eth0\",\"status\":\"CONNECTED\",\"error\":null},\"lte\":{\"config\":null,\"ifname\":null,\"status\":\"INACTIVE\",\"error\":null}}}

It seems OK, but Request:

{
       "src_mid": "netconnect-interface",
       "func": "info",
       "params": "lan"
}

There's no reply and netconnect seems broken. It doesn't reply nor to tests:

develop@aurora-gateway:~/projects/LersenProjects/netconnect-backend$ sudo make test TEST=LAN.test_info
/bin/bash -c ". build/venv/bin/activate; python tests/test_base.py LAN.test_info"
E
======================================================================
ERROR: test_info (__main__.LAN)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/test_base.py", line 161, in test_info
    print(i_a.connection_info('lan'))
  File "./build/bin/interface_netconnect.py", line 33, in connection_info
    ret = self._send_cmd('connection_info', [conn], timeout=COMMAND_TIMEOUT)
  File "./build/bin/interface_general.py", line 88, in _send_cmd
    ret = req_socket.recv_json()
  File "/home/develop/projects/LersenProjects/netconnect-backend/build/venv/lib/python3.5/site-packages/zmq/sugar/socket.py", line 673, in recv_json
    msg = self.recv(flags)
  File "zmq/backend/cython/socket.pyx", line 791, in zmq.backend.cython.socket.Socket.recv
  File "zmq/backend/cython/socket.pyx", line 827, in zmq.backend.cython.socket.Socket.recv
  File "zmq/backend/cython/socket.pyx", line 191, in zmq.backend.cython.socket._recv_copy
  File "zmq/backend/cython/socket.pyx", line 186, in zmq.backend.cython.socket._recv_copy
  File "zmq/backend/cython/checkrc.pxd", line 19, in zmq.backend.cython.checkrc._check_rc
zmq.error.Again: Resource temporarily unavailable

----------------------------------------------------------------------
Ran 1 test in 5.024s

FAILED (errors=1)
Makefile:21: recipe for target 'test' failed
make: *** [test] Error 1
develop@aurora-gateway:~/projects/LersenProjects/netconnect-backend$

It works fine again after Aurora reboot

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions