Skip to content

[BUG] 500 errors when using autoroute in the web interface #150

@hellocharli

Description

@hellocharli

Describe the bug
Autoroute setup in the web interface creates broken interfaces

To Reproduce
Steps to reproduce the behavior:

  1. Start ligolo-proxy on Kali linux
  2. Connect ligolo-agent from Ubuntu server (same behavior observed on Windows 11)
  3. Open web interface and log in
  4. Click "autoroute", click the dice, and select a route
  5. Click "Setup routes and start tunnel"
  6. Observe error in the bottom right corner - (500) Error: file exists
    The following is output on the server (verbose flag enabled)
ligolo-ng » INFO[0017]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/main.go:157 main.main.func3() Agent joined.                                 id=bc24110df96b name=root@ligolo remote="10.20.20.220:40208"
INFO[0031]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/app.go:148 github.com/nicocha30/ligolo-ng/cmd/proxy/app.StartTunnel() Starting tunnel to root@ligolo (bc24110df96b)
DEBU[0031]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/app.go:160 github.com/nicocha30/ligolo-ng/cmd/proxy/app.StartTunnel() Creating route brainydiamond on interface 10.30.30.218/24

(no indication of error in proxy console)

ligolo-ng » iflist
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Interface list                                                                                       │
├───┬───────────────┬─────────────────────────────────────────┬────────────────────────────────────────┤
│ # │ TAP NAME      │ DST ROUTES                              │ STATE                                  │
├───┼───────────────┼─────────────────────────────────────────┼────────────────────────────────────────┤
│ 0 │ brainydiamond │ 10.30.30.0/24,fe80::/64,10.30.30.218/24 │ Active - 2 routes / Pending - 1 routes │
└───┴───────────────┴─────────────────────────────────────────┴────────────────────────────────────────┘
Interfaces and routes with "Pending" state will be created on tunnel start.
ligolo-ng » tunnel_list
┌──────────────────────────────────────────────────────────────────────────┐
│ Active sessions and tunnels                                              │
├───┬─────────────────────────────────────────────────┬───────────┬────────┤
│ # │ AGENT                                           │ INTERFACE │ STATUS │
├───┼─────────────────────────────────────────────────┼───────────┼────────┤
│ 1 │ root@ligolo - 10.20.20.220:40208 - bc24110df96b │           │ Online │
└───┴─────────────────────────────────────────────────┴───────────┴────────┘
ligolo-ng » session
? Specify a session : 1 - root@ligolo - 10.20.20.220:40208 - bc24110df96b
[Agent : root@ligolo] » start --tun brainydiamond
INFO[0277]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/app.go:148 github.com/nicocha30/ligolo-ng/cmd/proxy/app.StartTunnel() Starting tunnel to root@ligolo (bc24110df96b)
error: unable to start tunnel: unable to open tun interface 'brainydiamond' (tun.New device or resource busy)

Attempting to start the tunnel from the web interface using the "Setup tunneling" button and selecting "Bind to brainydiamond" pops up this error in the bottom right of the web interface: (500) Error: unable to open tun interface 'brainydiamond' (tun.New device or resource busy)

and this is printed in the proxy console:

INFO[0451]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/app.go:148 github.com/nicocha30/ligolo-ng/cmd/proxy/app.StartTunnel() Starting tunnel to root@ligolo (bc24110df96b)

(no indication of error in the proxy console)

Interface and route are configured on the proxy host but pings do not go through

charlie@kali ~> ip route show
default via 10.20.20.1 dev eth0 proto dhcp src 10.20.20.8 metric 100
10.20.20.0/24 dev eth0 proto kernel scope link src 10.20.20.8 metric 100
10.30.30.0/24 dev brainydiamond
charlie@kali ~> ping 10.30.30.225
PING 10.30.30.225 (10.30.30.225) 56(84) bytes of data.
^C
--- 10.30.30.225 ping statistics ---
10 packets transmitted, 0 received, 100% packet loss, time 9202ms

Doing the same from the command line creates a working tunnel

[Agent : root@ligolo] » autoroute
? Select routes to add: 10.30.30.218/24
? Create a new interface or use an existing one? Create a new interface
INFO[1118]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/interfaces.go:317 github.com/nicocha30/ligolo-ng/cmd/proxy/app.init.0.func11() Generating a random interface name...
INFO[1118]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/interfaces.go:325 github.com/nicocha30/ligolo-ng/cmd/proxy/app.init.0.func11() Using interface name hardycidre
INFO[1118]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/interfaces.go:345 github.com/nicocha30/ligolo-ng/cmd/proxy/app.init.0.func11() Creating routes for hardycidre...
? Start the tunnel? Yes
DEBU[1119]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/app.go:141 github.com/nicocha30/ligolo-ng/cmd/proxy/app.StartTunnel() Creating tun interface hardycidre
INFO[1119]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/app.go:148 github.com/nicocha30/ligolo-ng/cmd/proxy/app.StartTunnel() Starting tunnel to root@ligolo (bc24110df96b)
DEBU[1119]/home/runner/work/ligolo-ng/ligolo-ng/cmd/proxy/app/app.go:160 github.com/nicocha30/ligolo-ng/cmd/proxy/app.StartTunnel() Creating route hardycidre on interface 10.30.30.218/24
---
charlie@kali ~> ip route show
default via 10.20.20.1 dev eth0 proto dhcp src 10.20.20.8 metric 100
10.20.20.0/24 dev eth0 proto kernel scope link src 10.20.20.8 metric 100
10.30.30.0/24 dev hardycidre
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
charlie@kali ~> ping 10.30.30.225
PING 10.30.30.225 (10.30.30.225) 56(84) bytes of data.
64 bytes from 10.30.30.225: icmp_seq=1 ttl=64 time=2.31 ms
64 bytes from 10.30.30.225: icmp_seq=2 ttl=64 time=2.69 ms
64 bytes from 10.30.30.225: icmp_seq=3 ttl=64 time=2.45 ms
64 bytes from 10.30.30.225: icmp_seq=4 ttl=64 time=2.61 ms
^C
--- 10.30.30.225 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 2.307/2.516/2.693/0.148 ms

Doing the steps individually from the web interface also creates a working tunnel

  1. Click "Interfaces" page on the web interface
  2. Add new random-named interface from the web interface
  3. Click "Add new route" and enter your route (10.30.30.0/24 in my case)
  4. Go back to the "Agents" tab, click "setup tunneling", and click "bind to {random name}
  5. Observe no errors and working pings
charlie@kali ~> ip route show
default via 10.20.20.1 dev eth0 proto dhcp src 10.20.20.8 metric 100
10.20.20.0/24 dev eth0 proto kernel scope link src 10.20.20.8 metric 100
10.30.30.0/24 dev scruffygrandmot
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
charlie@kali ~> ping 10.30.30.225
PING 10.30.30.225 (10.30.30.225) 56(84) bytes of data.
64 bytes from 10.30.30.225: icmp_seq=1 ttl=64 time=2.52 ms
64 bytes from 10.30.30.225: icmp_seq=2 ttl=64 time=2.18 ms
^C
--- 10.30.30.225 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 2.180/2.350/2.521/0.170 ms

Creating the interface on the website manually and then attempting to autoroute with "use an existing interface" through the web interface also results in (500) Error: file exists

Proxy information:

  • OS: Kali Linux rolling, fully updated
  • Architecture amd64
  • Version Ligolo-ng v0.8.2

Agent information:

  • OS: Ubuntu 24.10, Windows 11
  • Architecture amd64
  • Version Ligolo-ng v0.8.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions