Skip to content

[BUG] Creating a TCP listener using Web API does not work! #148

@skytect

Description

@skytect

Describe the bug
In my network, when I use listener_add to forward a TCP port using the CLI it works. If I try to use the Web UI or a POST request to /api/v1/listeners it doesn't.

To Reproduce
Steps to reproduce the behavior:

Set up environment.
A (192.168.3.2) <- B (10.10.3.2)

  1. On A, start proxy with ./ligolo-proxy -selfcert -laddr 0.0.0.0:8000
  2. On B, start agent with ligolo-agent -ignorecert -connect 192.168.3.2:8000
  3. On A, start webserver with python -m http.server 8010

Attempt to use ligolo-ng to forward port using CLI.

  1. On proxy on A, select agent with session
  2. On proxy on A, run listener_add --addr 0.0.0.0:8010 --to 127.0.0.1:8010
  3. On B, test with curl http://10.10.3.2:8010 -v and expect a response with some HTML.
  4. On proxy on A, stop the listener with listener_stop

Attempt to use ligolo-ng to forward port using Web API.

  1. On A, use the Web UI to create a listener with the exact same parameters. Alternatively, send a POST request to http://127.0.0.1:<API_PORT>/api/v1/listeners with the JSON:
{
    "agentId": 1,
    "listenerAddr": "0.0.0.0:8010",
    "network": "tcp",
    "redirectAddr": "127.0.0.1:8010"
}
  1. On B, test with curl http://10.10.3.2:8010 -v and expect a response with some HTML.

Expected behavior

With the CLI, the test in step 5 provides the expected HTML.

curl -v output:

*   Trying 10.10.3.2:8010
* Connected to 10.10.3.2 (10.10.3.2) port 8010
> GET / HTTP/1.1
> Host: 10.10.3.2:8010
> User-Agent: curl/8.4.0
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: SimpleHTTP/0.6 Python/3.12.10
< Date: Thu, 22 May 2025 02:00:00 GMT
< Content-type: text/html; charset=utf-8
< Content-Length: 532
<
<! DOCTYPE HTML>
...

With the Web API, the test in step 8 does not provide the expected HTML.

curl -v output:

*   Trying 10.10.3.2:8010
* Connected to 10.10.3.2 (10.10.3.2) port 8010
> GET / HTTP/1.1
> Host: 10.10.3.2:8010
> User-Agent: curl/8.4.0
> Accept: */*
>

*it hangs here*

It seems to successfully initiate the connection but doesn't receive the response?

Proxy information:

  • OS: Kali GNU/Linux 2025.1
  • Architecture amd64
  • Version Ligolo-ng v0.8.1

Agent information:

  • OS: Windows 10 Pro 22H2 19045.3803
  • Architecture amd64
  • Version Ligolo-ng v0.8.1

Additional context
I added some log statements in the proxy code and determined that the agent is receiving the same information, so it is likely some form of network error on the agent's side.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions