Skip to content

Conversation

@fokx
Copy link

@fokx fokx commented Sep 29, 2025

Altough you suggest me to contribute to wind in the previous PR,
I think this PR is crucial as it fixes a security pitfall of tuic.

Also, this implements SOCKS5 outbound, which is marked as TODO in the previous PR.

This PR includes:

  • Can configure ACL of tuic-server's outbound. See server's README.md for more.
    The syntax is inspired by Hysteria
  • The default outbound ACL will REJECT access to server's localhost.
    Currently, Tuic allows the client to access services not publicly exposed(i.e. bind to 127.0.0.1 / ::1) on the server. However, users having access to Tuic are not necessarily supposed to have SSH access to server, thus, this may lead to unwanted and unaware intrusions into local services.
    To expose services on the server to client users deliberately, explicitly whitelist those ports or use '*' to allow access to all ports on localhost.
  • implement SOCKS5 outbound

I think after this PR, Tuic's outbound and ACL feature is on par with Hysteria.

…st by default, implement SOCKS5 outbound

* Can configure ACL of tuic-server's outbound. See server's README.md for more.
The syntax is inspired by [Hysteria](https://v2.hysteria.network/docs/advanced/ACL/)
* The default outbound ACL will REJECT access to server's localhost.
Currently, Tuic allows the client to access services not publicly exposed(i.e. bind to 127.0.0.1 / ::1) on the server. However, users having access to Tuic are not necessarily supposed to have SSH access to server, thus, this may lead to unwanted and unaware intrusions into local services.
To expose services on the server to client users deliberately, explicitly whitelist those ports or use '*' to allow access to all ports on localhost.
* implement SOCKS5 outbound
@Itsusinn Itsusinn changed the title Add ACL in tuic-server and reject client's access to server's localhost by default, implement SOCKS5 outbound feat: Add ACL in tuic-server and reject client's access to server's localhost by default, implement SOCKS5 outbound Sep 30, 2025
@Itsusinn Itsusinn requested a review from Copilot September 30, 2025 16:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds crucial security features to tuic-server by implementing Access Control Lists (ACL) with SOCKS5 outbound support. The main purpose is to fix a security vulnerability where clients could access server localhost services and to provide more granular control over outbound connections.

  • Implements a comprehensive ACL system for controlling client access to outbound destinations
  • Adds SOCKS5 outbound support for proxying connections through external SOCKS5 servers
  • Adds default security policy that blocks client access to server's localhost services

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tuic/src/protocol/mod.rs Adds port() method to Address enum for ACL port matching
tuic-server/src/main.rs Adds acl module import
tuic-server/src/connection/handle_task.rs Implements ACL decision logic and SOCKS5 connection handling
tuic-server/src/config.rs Adds ACL configuration parsing with support for both TOML tables and multiline string formats
tuic-server/src/acl.rs New module implementing ACL rule parsing, matching logic, and data structures
tuic-server/README.md Documents ACL configuration syntax and SOCKS5 outbound options
tuic-server/Cargo.toml Adds ip_network dependency for CIDR matching
Comments suppressed due to low confidence (1)

tuic-server/src/connection/handle_task.rs:1

  • Consistent with previous comments - cloning protocol is unnecessary here. AclProtocol should implement Copy trait.
use std::{

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Itsusinn Itsusinn merged commit 41f1a6e into Itsusinn:dev Oct 2, 2025
39 of 40 checks passed
@fokx fokx deleted the acl branch October 16, 2025 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants