Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

订阅源联系隐私© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
chisel — 基于HTTP的快速TCP/UDP隧道,采用SSH加密,支持反向端口转发、SOCKS5代理和客户端认证,用于安全的网络穿透和防火墙规避。 | Kitploit
工具/GitHubGitHub/jpillora/chisel
通用工具Web代理与拦截IDS/IPS规避数据泄露网络安全渗透测试命令与控制实用工具与框架红队远程访问工具远程访问木马命令与控制 分类第 17 名
16.4k1.6k2611个月前Kitploit 审核通过
分享
数据泄露 分类第 3 名
通用工具 分类第 8 名
IDS/IPS规避 分类第 9 名
远程访问工具 分类第 12 名
远程访问木马 分类第 13 名
实用工具与框架 分类第 11 名
Web代理与拦截 分类第 8 名
GitHubjpillora/chisel

chisel

基于HTTP的快速TCP/UDP隧道,采用SSH加密,支持反向端口转发、SOCKS5代理和客户端认证,用于安全的网络穿透和防火墙规避。

查看仓库
# Chisel

[![GoDoc](https://godoc.org/github.com/jpillora/chisel?status.svg)](https://godoc.org/github.com/jpillora/chisel) [![CI](https://github.com/jpillora/chisel/workflows/CI/badge.svg)](https://github.com/jpillora/chisel/actions?workflow=CI)

Chisel 是一个快速的 TCP/UDP 隧道,通过 HTTP 传输,并使用 SSH 进行安全保护。单一可执行文件同时包含客户端和服务端。使用 Go (golang) 编写。Chisel 主要用于穿透防火墙,但也可用于为你的网络提供安全的接入端点。

![overview](https://assets.kitploit.com/production/public/readmes/1084/7f9bb728fdb834aad865b50d9798c4b62bb22f9fa37915bc4d5a5ca9c6f7aed0.png)

## 目录

- [特性](#features)
- [安装](#install)
- [演示](#demo)
- [用法](#usage)
- [贡献](#contributing)
- [更新日志](#changelog)
- [许可证](#license)

## 特性

- 易于使用
- [高性能](https://github.com/jpillora/chisel/blob/master/test/bench/perf.md)\*
- 使用 SSH 协议(通过 `crypto/ssh`)的[加密连接](#security)
- [认证连接](#authentication);通过用户配置文件对客户端连接进行认证,通过指纹匹配对服务端连接进行认证。
- 客户端使用[指数退避](https://github.com/jpillora/backoff)自动重连(可通过 `--min/max-retry-interval` 调整);keepalive ping 会超时,因此静默失效的连接(休眠/唤醒、NAT 超时、服务器重启)会被检测并重新建立
- 客户端可以在一个 TCP 连接上创建多个隧道端点
- 客户端可以选择通过 SOCKS 或 HTTP CONNECT 代理
- 反向端口转发(连接通过服务端并从客户端出去)
- 服务端可选兼作[反向代理](http://golang.org/pkg/net/http/httputil/#NewSingleHostReverseProxy)
- 服务端可选允许 [SOCKS5](https://en.wikipedia.org/wiki/SOCKS) 连接(参见[下方指南](#socks5-guide))
- 客户端可选允许来自反向端口转发的 [SOCKS5](https://en.wikipedia.org/wiki/SOCKS) 连接
- 客户端通过 stdio 连接,支持 `ssh -o ProxyCommand`,从而提供基于 HTTP 的 SSH

## 安装

### 二进制文件

[![Releases](https://img.shields.io/github/release/jpillora/chisel.svg)](https://github.com/jpillora/chisel/releases) [![Releases](https://img.shields.io/github/downloads/jpillora/chisel/total.svg)](https://github.com/jpillora/chisel/releases)

参见[最新版本](https://github.com/jpillora/chisel/releases/latest),或立即使用 `curl https://i.jpillora.com/chisel! | bash` 下载并安装

二进制文件使用最新的 Go 版本构建,这设定了最低操作系统版本要求:Windows 10 / Server 2016、macOS 12、Linux 内核 3.2、FreeBSD 12.2。对于较旧的系统(例如 Windows 7),请使用 [v1.8.1 版本](https://github.com/jpillora/chisel/releases/tag/v1.8.1)或更早版本。

### Docker

[![Docker Pulls](https://img.shields.io/docker/pulls/jpillora/chisel.svg)](https://hub.docker.com/r/jpillora/chisel/) [![Image Size](https://img.shields.io/docker/image-size/jpillora/chisel/latest)](https://hub.docker.com/r/jpillora/chisel/tags)

```sh
docker run --rm -it jpillora/chisel --help
```

镜像为多架构,并同时发布到 Docker Hub(`jpillora/chisel`)和 GitHub Container Registry(`ghcr.io/jpillora/chisel`)。

### Fedora

该软件包由 Fedora 社区维护。如果您遇到与 RPM 使用相关的问题,请使用此[问题跟踪器](https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&classification=Fedora&component=chisel&list_id=11614537&product=Fedora&product=Fedora%20EPEL)。

```sh
sudo dnf -y install chisel
```

### 来源

```sh
$ go install github.com/jpillora/chisel@latest
```

## 演示

你可以在几分钟内运行自己的演示服务器(旧的 Heroku 演示随着 Heroku 免费套餐的取消而消失)。[`example/fly.toml`](https://github.com/jpillora/chisel/blob/master/example/fly.toml) 将这个 `chisel server` 部署到 [fly.io](https://fly.io) 的免费额度上:

```sh
$ chisel server --port $PORT --backend http://example.com
# listens on $PORT, proxies normal web requests to http://example.com
```

使用 `fly launch --copy-config` 从 `example/` 目录部署它,然后通过隧道连接到服务器旁边运行的任何服务,例如:

```sh
$ chisel client https://<your-app>.fly.dev 3000
# connects to your chisel server,
# tunnels your localhost:3000 to the server's localhost:3000
```

在浏览器中访问你的应用 URL 会命中服务器的默认后端代理,并显示一份 [example.com](http://example.com) 的副本。

## 用法

<!-- render these help texts by hand,
  or use https://github.com/jpillora/md-tmpl
    with $ md-tmpl -w README.md -->

<!--tmpl,code=plain:echo "$ chisel --help" && go run main.go --help | sed 's#0.0.0-src (go1\..*)#X.Y.Z#' -->
``` plain 
$ chisel --help

  Usage: chisel [command] [--help]

  Version: X.Y.Z

  Commands:
    server - runs chisel in server mode
    client - runs chisel in client mode

  Read more:
    https://github.com/jpillora/chisel

```
<!--/tmpl-->


<!--tmpl,code=plain:echo "$ chisel server --help" && go run main.go server --help | cat | sed 's#0.0.0-src (go1\..*)#X.Y.Z#' -->
``` plain 
$ chisel server --help

  Usage: chisel server [options]

  Options:

    --host, Defines the HTTP listening host – the network interface
    (defaults the environment variable HOST and falls back to 0.0.0.0).

    --port, -p, Defines the HTTP listening port (defaults to the environment
    variable PORT and falls back to port 8080).

    --key, (deprecated use --keygen and --keyfile instead)
    An optional string to seed the generation of a ECDSA public
    and private key pair. All communications will be secured using this
    key pair. Share the subsequent fingerprint with clients to enable detection
    of man-in-the-middle attacks (defaults to the CHISEL_KEY environment
    variable, otherwise a new key is generate each run).

    --keygen, A path to write a newly generated PEM-encoded SSH private key file.
    If users depend on your --key fingerprint, you may also include your --key to
    output your existing key. Use - (dash) to output the generated key to stdout.

    --keyfile, An optional path to a PEM-encoded SSH private key. When
    this flag is set, the --key option is ignored, and the provided private key
    is used to secure all communications. (defaults to the CHISEL_KEY_FILE
    environment variable). Since ECDSA keys are short, you may also set keyfile
    to the inline key string itself, exactly as printed by --keygen (a base64
    string with a "ck-" prefix); no extra base64 encoding is needed.

    --authfile, An optional path to a users.json file. This file should
    be an object with users defined like:
      {
        "<user:pass>": ["<addr-regex>","<addr-regex>"]
      }
    when <user> connects, their <pass> will be verified and then
    each of the remote addresses will be compared against the list
    of address regular expressions for a match. Patterns are NOT
    anchored by default: "10.0.0.1:80" also matches
    "210.0.0.1:8080", and "." matches any character. Anchor your
    patterns, e.g. "^10\.0\.0\.1:80$". The empty string ""
    matches every address. Addresses will
    always come in the form "<remote-host>:<remote-port>" for normal remotes,
    "R:<local-interface>:<local-port>" for reverse port forwarding
    remotes, and "socks" for SOCKS5 proxy access. Note that SOCKS5
    access previously bypassed this list; existing authfiles which
    should allow SOCKS5 must add an entry matching "socks" (the
    empty wildcard "" matches everything, including "socks"). This
    file will be automatically reloaded on change. Reloads apply
    to new connections and to new tunnels of connected clients;
    established tunnels are not interrupted.

    --auth, An optional string representing a single user with full
    access, in the form of <user:pass>. It is equivalent to creating an
    authfile with {"<user:pass>": [""]}. If unset, it will use the
    environment variable AUTH.

    --keepalive, An optional keepalive interval. Since the underlying
    transport is HTTP, in many instances we'll be traversing through
    proxies, often these proxies will close idle connections. You must
    specify a time with a unit, for example '5s' or '2m'. Defaults
    to '25s' (set to 0s to disable).

    --backend, Specifies another HTTP server to proxy requests to when
    chisel receives a normal HTTP request. Useful for hiding chisel in
    plain sight. --proxy is accepted as an alias for this flag.

    --socks5, Allow clients to access the internal SOCKS5 proxy. See
    chisel client --help for more information.

    --reverse, Allow clients to specify reverse port forwarding remotes
    in addition to normal remotes.

    --tls-key, Enables TLS and provides optional path to a PEM-encoded
    TLS private key. When this flag is set, you must also set --tls-cert,
    and you cannot set --tls-domain.

    --tls-cert, Enables TLS and provides optional path to a PEM-encoded
    TLS certificate. When this flag is set, you must also set --tls-key,
    and you cannot set --tls-domain.

    --tls-domain, Enables TLS and automatically acquires a TLS key and
    certificate using LetsEncrypt. Setting --tls-domain requires port 443.
    You may specify multiple --tls-domain flags to serve multiple domains.
    The resulting files are cached in the "$HOME/.cache/chisel" directory.
    You can modify this path by setting the CHISEL_LE_CACHE variable,
    or disable caching by setting this variable to "-". You can optionally
    provide a certificate notification email by setting CHISEL_LE_EMAIL.

    --tls-ca, a path to a PEM encoded CA certificate bundle or a directory
    holding multiple PEM encode CA certificate bundle files, which is used to 
    validate client connections. The provided CA certificates will be used 
    instead of the system roots. This is commonly used to implement mutual-TLS. 

    --pid Generate pid file in current working directory

    -v, Enable verbose logging

    --help, This help text

  Signals:
    The chisel process is listening for:
      a SIGINT or SIGTERM to begin a graceful shutdown
        (a second signal forces an immediate exit),
      a SIGUSR2 to print process stats, and
      a SIGHUP to short-circuit the client reconnect timer

  Version:
    X.Y.Z

  Read more:
    https://github.com/jpillora/chisel

```
<!--/tmpl-->


<!--tmpl,code=plain:echo "$ chisel client --help" && go run main.go client --help | sed 's#0.0.0-src (go1\..*)#X.Y.Z#' -->
``` plain 
$ chisel client --help

  Usage: chisel client [options] <server> <remote> [remote] [remote] ...

  <server> is the URL to the chisel server.

  <remote>s are remote connections tunneled through the server, each of
  which come in the form:

    <local-host>:<local-port>:<remote-host>:<remote-port>/<protocol>

    ■ local-host defaults to 0.0.0.0 (all interfaces).
    ■ local-port defaults to remote-port.
    ■ remote-port is required*.
    ■ remote-host defaults to 127.0.0.1 (server localhost).
    ■ protocol defaults to tcp.

  which shares <remote-host>:<remote-port> from the server to the client
  as <local-host>:<local-port>, or:

    R:<local-interface>:<local-port>:<remote-host>:<remote-port>/<protocol>

  which does reverse port forwarding, sharing <remote-host>:<remote-port>
  from the client to the server's <local-interface>:<local-port>.

    example remotes

      3000
      example.com:3000
      3000:google.com:80
      192.168.0.5:3000:google.com:80
      socks
      5000:socks
      udpsocks
      5000:udpsocks
      R:2222:localhost:22
      R:socks
      R:5000:socks
      R:5000:udpsocks
      stdio:example.com:22
      1.1.1.1:53/udp

    When the chisel server has --socks5 enabled, remotes can
    specify "socks" or "udpsocks" in place of remote-host and
    remote-port. Both default to the local host and port
    127.0.0.1:1080. Connections to this remote will terminate
    at the server's internal SOCKS5 proxy. When the server also
    has --authfile set, SOCKS5 access requires an entry matching
    the token "socks" in the user's address list.

    When the chisel server has --reverse enabled, remotes can
    be prefixed with R to denote that they are reversed. That
    is, the server will listen and accept connections, and they
    will be proxied through the client which specified the remote.
    Reverse remotes specifying "R:socks" will listen on the server's
    default socks port (1080) and terminate the connection at the
    client's internal SOCKS5 proxy.

    The "socks" remote supports TCP CONNECT only. Use "udpsocks"
    for TCP CONNECT and UDP ASSOCIATE, including "R:udpsocks".
    It binds TCP and UDP on the same configured interface and port;
    the UDP relay never uses a randomly allocated listening port.
    UDP requires support on both Chisel peers. Destination names are
    resolved at the exit node. If UDP cannot bind, TCP remains available
    and UDP ASSOCIATE fails; no alternate port is used. Clients using
    a zero UDP source port allow one pending association per source IP
    until the first valid datagram pins it. BIND, UDP fragmentation,
    and udpsocks over stdio are not supported.

    When stdio is used as local-host, the tunnel will connect standard
    input/output of this program with the remote. This is useful when 
    combined with ssh ProxyCommand. You can use
      ssh -o ProxyCommand='chisel client chiselserver stdio:%h:%p' \
          [email protected]
    to connect to an SSH server through the tunnel.

  Options:

    --fingerprint, A *strongly recommended* fingerprint string
    to perform host-key validation against the server's public key.
    Fingerprint mismatches will close the connection.
    Fingerprints are generated by hashing the ECDSA public key using
    SHA256 and encoding the result in base64.
    Fingerprints must be 44 characters containing a trailing equals (=).
    Legacy MD5 colon fingerprints (deprecated) are still accepted,
    but only in their full 16-octet form; truncated prefixes are
    rejected.

    --auth, An optional username and password (client authentication)
    in the form: "<user>:<pass>". These credentials are compared to
    the credentials inside the server's --authfile. defaults to the
    AUTH environment variable.

    --keepalive, An optional keepalive interval. Since the underlying
    transport is HTTP, in many instances we'll be traversing through
    proxies, often these proxies will close idle connections. You must
    specify a time with a unit, for example '5s' or '2m'. Defaults
    to '25s' (set to 0s to disable).

    --max-retry-count, Maximum number of times to retry before exiting.
    Defaults to unlimited.

    --min-retry-interval, Minimum wait time before retrying after a
    disconnection. Defaults to 1 second.

    --max-retry-interval, Maximum wait time before retrying after a
    disconnection. Defaults to 5 minutes.

    --proxy, An optional HTTP CONNECT or SOCKS5 proxy which will be
    used to reach the chisel server. Authentication can be specified
    inside the URL. Credentials must be URL-encoded; for example a
    "#" in the password must be written as "%23".
    For example, http://admin:[email protected]:8081
            or: socks://admin:[email protected]:1080
    The socks://, socks5:// and socks5h:// schemes are equivalent:
    DNS is always resolved by the proxy.

    --header, Set a custom header in the form "HeaderName: HeaderContent".
    Can be used multiple times. (e.g --header "Foo: Bar" --header "Hello: World")

    --hostname, Optionally set the 'Host' header (defaults to the host
    found in the server url).

    --sni, Override the ServerName when using TLS (defaults to the 
    hostname).

    --tls-ca, An optional root certificate bundle used to verify the
    chisel server. Only valid when connecting to the server with
    "https" or "wss". By default, the operating system CAs will be used.

    --tls-skip-verify, Skip server TLS certificate verification of
    chain and host name (if TLS is used for transport connections to
    server). If set, client accepts any TLS certificate presented by
    the server and any host name in that certificate. This only affects
    transport https (wss) connection. Chisel server's public key
    may be still verified (see --fingerprint) after inner connection
    is established.

    --tls-key, a path to a PEM encoded private key used for client 
    authentication (mutual-TLS).

    --tls-cert, a path to a PEM encoded certificate matching the provided 
    private key. The certificate must have client authentication 
    enabled (mutual-TLS).

    --pid Generate pid file in current working directory

    -v, Enable verbose logging

    --help, This help text

  Signals:
    The chisel process is listening for:
      a SIGINT or SIGTERM to begin a graceful shutdown
        (a second signal forces an immediate exit),
      a SIGUSR2 to print process stats, and
      a SIGHUP to short-circuit the client reconnect timer

  Version:
    X.Y.Z

  Read more:
    https://github.com/jpillora/chisel

```
<!--/tmpl-->

### 安全

加密始终启用。当你启动 chisel 服务器时,它会生成一个内存中的 ECDSA 公钥/私钥对。公钥指纹(base64 编码的 SHA256)将在服务器启动时显示。服务器可以选择通过 `--keyfile` 选项指定密钥文件,而不是生成随机密钥。当客户端连接时,它们也会显示服务器的公钥指纹。客户端可以使用 `--fingerprint` 选项强制指定特定的指纹。旧版 MD5 指纹仍然被接受,但必须是完整的 16 字节冒号形式——截断的前缀会被拒绝。更多信息请参阅上方的 `--help`。

服务器还会在认证前限制入站 websocket 消息大小(`CHISEL_WS_READ_LIMIT`,默认 512 KiB),因此未认证的对等方无法通过超大消息耗尽内存。默认值舒适地高于 `x/crypto/ssh` 的 256 KiB 最大传输包,因此任何有效的 SSH 包都不会被拒绝。只有 `0` 会禁用该限制;负值会回退到安全默认值。

### 认证

使用 `--authfile` 选项,服务器可以选择提供一个 `user.json` 配置文件来创建可接受用户的列表。然后客户端使用 `--auth` 选项进行认证。示例认证配置文件请参阅 [users.json](https://github.com/jpillora/chisel/blob/master/example/users.json)。更多信息请参阅上方的 `--help`。

关于 authfile 行为的说明:

- 该文件会被监视并**实时重新加载**——包括通过重命名保存的编辑器(vim)和 kubernetes configmap 更新。重新加载会应用于新连接以及已连接客户端的新隧道;被移除的用户会立即失去对新隧道的访问权限,但已建立的隧道不会中断。
- 地址模式是正则表达式且**未锚定**——请使用 `^` 和 `$` 锚定它们(服务器在加载时会对未锚定的模式发出警告)。空字符串 `""` 匹配所有内容。
- SOCKS5 访问由匹配令牌 `socks` 的条目控制。**破坏性变更**:SOCKS5 之前完全绕过 authfile;使用 `--socks5` 和 `--authfile` 运行的服务器必须向应保留代理访问权限的用户授予 `socks`(通配符 `""` 条目仍然有效)。
- 不带冒号的认证字符串(`user:pass`)现在在服务器和客户端上都是**致命启动错误**——之前它们会静默禁用认证。
- `--auth` 用户会在 authfile 重新加载后保留,并在与文件用户名称冲突时胜出。

在内部,这是通过 SSH 提供的 _Password_ 认证方法完成的。在此处了解更多关于 `crypto/ssh` 的信息 http://blog.gopheracademy.com/go-and-ssh/。会话打开/关闭(包含用户、源地址和远程)以及失败的登录尝试会以 info 级别记录日志。

### TLS 指南

最简单的安全设置是 `--tls-domain`,它会自动配置 LetsEncrypt 证书(需要端口 443 和指向服务器的 DNS 记录):

```sh
chisel server --port 443 --tls-domain chisel.example.com --auth user:pass
chisel client --auth user:pass https://chisel.example.com R:2222:localhost:22
```

要使用你自己的证书(自签名或内部 CA),请生成密钥/证书对,并将双方指向正确的文件:

```sh
chisel server --port 443 --tls-key key.pem --tls-cert cert.pem
chisel client --tls-ca ca.pem https://chisel.example.com 3000
```

对于双向 TLS,还需向服务器传递 `--tls-ca`,并向每个客户端传递 `--tls-cert`/`--tls-key`。请注意,TLS 从外部包裹 chisel 的传输层;内层 SSH 层仍然进行加密和身份验证,因此 `--fingerprint` 验证在有或没有 TLS 的情况下都能正常工作。

### 使用 Docker 的 SOCKS5 指南

1. 将新的私钥打印到终端

    ```sh
    chisel server --keygen -
    # 或将其保存到磁盘 --keygen /path/to/mykey
    ```

1. 启动你的 chisel 服务器

    ```sh
    jpillora/chisel server --keyfile '<ck-base64 string or file path>' -p 9312 --socks5
    ```

1. 连接你的 chisel 客户端(使用服务器的指纹)

    ```sh
    chisel client --fingerprint '<see server output>' <server-address>:9312 socks
    ```

1. 将你的 SOCKS5 客户端(例如操作系统/浏览器)指向:

    ```
    <client-address>:1080
    ```

1. 现在你拥有了一个通过 HTTP 的加密、经过身份验证的 SOCKS5 连接

注意:如果服务器还使用了 `--authfile`,用户需要有一个与令牌 `socks` 匹配的条目才能使用代理(参见[身份验证](#authentication))。

有关设置命令、反向模式和 UDP 客户端示例,请参阅 [SOCKS5 UDP 用户指南](https://github.com/jpillora/chisel/blob/master/example/udpsocks.md)。

普通的 `socks` 远程仅支持 TCP CONNECT,不绑定任何 UDP 套接字。要同时启用 TCP CONNECT 和 UDP ASSOCIATE,请使用 `udpsocks`(或反向模式下的 `R:udpsocks`),例如 `1080:udpsocks`。两种类型都默认使用 `127.0.0.1:1080`,并使用相同的 SOCKS 访问权限。`udpsocks` 监听器在配置的同一接口和端口上绑定 TCP 和 UDP,在多个关联之间共享一个 UDP 中继套接字,而不会分配随机监听端口。UDP 客户端保持其 TCP 控制连接打开,并将 SOCKS 封装的数据报发送到该端口。数据报目标名称在出口节点解析,UDP 流量通过加密的 SSH 隧道传输。UDP 需要升级两个 Chisel 对等端;TCP SOCKS 仍与旧版对等端兼容。

通过防火墙或容器暴露 `udpsocks` 监听器时,请在其配置的端口上同时允许 TCP 和 UDP。UDP ASSOCIATE 返回接受 TCP 连接的本地 IP,该 IP 必须能被 SOCKS 客户端访问。对于 Linux Docker 监听器,请使用 `--network host` 配合远程 `0.0.0.0:1080:udpsocks`,以避免通告隔离的容器地址。容器端口映射需要同时包含 `-p 1080:1080/tcp` 和 `-p 1080:1080/udp`,并且要能访问通告的中继 IP。如果 UDP 端口被占用,Chisel 会记录 UDP 不可用,保留 TCP 服务,并拒绝 UDP ASSOCIATE 而不使用备用端口;释放端口后请重启代理。

关联接受来自其 TCP 对等端 IP 的数据包。声明的 UDP 源端口会保留该端点;零源端口由其第一个有效数据报固定。每个 IP 只允许一个未固定的关联,因此共享同一 IP 的客户端应声明其 UDP 源端口,或在打开另一个关联之前发送第一个数据报。重复的源端口保留会被拒绝。关闭控制连接或丢失 SSH 会结束关联;重新连接需要新的 UDP ASSOCIATE。不支持 BIND、UDP 分片和 `stdio:udpsocks`。

### 使用 Authfile 的反向 SOCKS

要让特定客户端充当 SOCKS 出口节点,请授予它反向 SOCKS 监听器地址(`R:socks` 监听服务器的 `127.0.0.1:1080`):

```json
{
  "exituser:password": ["^R:127\\.0\\.0\\.1:1080$"]
}
```

```sh
chisel server --reverse --authfile users.json
chisel client --auth exituser:password <server-address> R:socks
# server-side consumers point SOCKS5 clients at 127.0.0.1:1080,
# and their traffic exits via the chisel client's network
```

在客户端命令中使用 `R:udpsocks` 可在同一服务器端口上同时启用 UDP ASSOCIATE;authfile 授权保持不变。

另请参阅分步 [反向隧道示例](https://github.com/jpillora/chisel/blob/master/example/reverse-tunneling-authenticated.md)。

### 在 CDN(Cloudflare)后运行

chisel 可通过支持 WebSockets 的 CDN 工作。对于 Cloudflare:启用 WebSockets,将 DNS 记录设为代理(橙云),并使用 `https://` 连接客户端。CDN 会终止 TLS,但内层 SSH 层意味着 `--fingerprint` 验证仍能端到端认证你的 chisel 服务器——CDN 无法读取或修改隧道流量。将 `--keepalive` 保持在其默认值 `25s`,以低于 CDN 空闲超时,并注意会剥离 `Upgrade` 头的代理根本无法承载 chisel。

### 使用环境变量进行调优

较少使用的调节项是环境变量,全部以 `CHISEL_` 前缀读取(例如 `CHISEL_WS_TIMEOUT=10s`):

| 变量            | 端          | 默认值             | 用途                                               |
| --------------- | ----------- | ------------------ | -------------------------------------------------- |
| `WS_TIMEOUT`    | 客户端      | `45s`              | websocket 握手超时                                 |
| `SSH_TIMEOUT`   | 客户端      | `30s`              | ssh 握手超时                                       |
| `CONFIG_TIMEOUT`| 服务端      | `10s`              | 等待客户端的配置请求                               |
| `SSH_WAIT`      | 两端        | `35s`              | 新隧道等待活动连接的时间                           |
| `PING_TIMEOUT`  | 两端        | keepalive 间隔     | keepalive ping 回复超时(若 `--keepalive 0` 则不发送 ping) |
| `DIAL_TIMEOUT`  | 两端        | `30s`              | tcp 目标拨号、SOCKS 握手和 SOCKS UDP DNS 超时      |
| `WS_READ_LIMIT` | 两端        | `524288`           | 入站 websocket 消息最大字节数(0 = 无限制;负数 = 默认值) |
| `WS_BUFF_SIZE`  | 两端        | go 默认值          | websocket 读/写缓冲区大小                          |
| `UDP_MAX_SIZE`  | 两端        | `9012`             | udp 数据包最大字节数(包含 SOCKS UDP 头)          |
| `UDP_DEADLINE`  | 两端        | `15s`              | udp 流读取截止时间和返回对端过期时间;SOCKS UDP 目标空闲超时 |
| `UDP_MAX_CONNS` | 两端        | `100`              | udp 流或返回对端的最大数量;每个监听器的 SOCKS UDP 关联数及每个关联的目标数 |
| `SHUTDOWN_GRACE`| 服务端      | `5s`               | 关闭时 http 请求排空时间                           |

`HOST`、`PORT`、`AUTH` 和 `CHISEL_KEY`/`CHISEL_KEY_FILE` 已在上述 `--help` 文本中说明。

SOCKS UDP 使用硬性关联和目标限制,超出限制的数据包会被丢弃。每个关联最多排队 16 个出站数据报;队列满时丢弃数据包,不会阻塞其他客户端。对于 SOCKS UDP,非正数的大小/连接限制或空闲截止时间将使用默认值,数据包大小上限为 65507 字节。操作系统可能施加更小的 UDP 发送限制:macOS 默认为 9216 字节(`net.inet.udp.maxdgram`)。Chisel 默认的 9012 字节限制在该范围内。

#### 注意事项

由于需要 WebSockets 支持:

- IaaS 提供商都将支持 WebSockets(除非在你前面强制使用了不支持 WebSockets 的 HTTP 代理,那样的话我认为你已被降级为 PaaS)
- PaaS 提供商对 WebSockets 的支持各不相同
  - Heroku 完全支持
  - Openshift 完全支持,但连接仅接受端口 8443 和 8080
  - Google App Engine 标准环境**不**支持(灵活环境支持)

## 贡献

- http://golang.org/doc/code.html
- http://golang.org/doc/effective_go.html
- `github.com/jpillora/chisel/share` 包含共享包
- `github.com/jpillora/chisel/server` 包含服务端包
- `github.com/jpillora/chisel/client` 包含客户端包

## 更新日志

- `1.0` - 初始版本
- `1.1` - 用 ECDSA SSH 替换简单的对称加密
- `1.2` - 添加 SOCKS5(服务端)和 HTTP CONNECT(客户端)支持
- `1.3` - 添加反向隧道支持
- `1.4` - 添加任意 HTTP 头支持
- `1.5` - 添加反向 SOCKS 支持(由 @aus 提供)
- `1.6` - 添加客户端 stdio 支持(由 @BoleynSu 提供)
- `1.7` - 添加 UDP 支持
- `1.8` - 迁移到 `scratch` Docker 镜像
- `1.9` - 升级到 Go 1.21。从 `--key` 种子切换为使用 `--key{gen,file}` 的 P256 密钥字符串(由 @cmenginnz 提供)
- `1.10` - 升级到 Go 1.22。在发布中添加 `.rpm` `.deb` 和 `.apk`。修复错误的版本比较。
- `1.11` - 升级到 Go 1.25.1。更新所有依赖。
- `1.12` - 可靠性与安全性改进:
  - keepalive ping 现在会超时(`CHISEL_PING_TIMEOUT`),因此失效连接在睡眠/唤醒、NAT 超时和服务器重启后能迅速重连
  - authfile 重载可承受编辑器重命名和 kubernetes configmap 替换,并实时应用于已连接的客户端(新隧道;已建立的隧道不会中断)
  - **破坏性变更**:使用 `--socks5` + `--authfile` 时,SOCKS5 访问现在需要匹配 `socks` 的 authfile 条目(通配符 `""` 条目仍然有效)
  - **破坏性变更**:截断的旧式 MD5 指纹被拒绝——`--fingerprint` 必须是完整的 SHA256 形式(或完整的 16 字节 MD5 冒号形式)
  - **破坏性变更**:不含冒号的认证字符串(例如 `--auth user`)现在是致命的启动错误,而不是静默禁用认证
  - TCP 半关闭通过隧道传播,不可达目标会拒绝隧道,而不是呈现一个死连接(`CHISEL_DIAL_TIMEOUT`,默认 30s)
  - 在 SIGTERM 时优雅关闭并排空 HTTP 请求(`CHISEL_SHUTDOWN_GRACE`);第二次信号强制退出
  - UDP 出口节点在超过 100 个并发流时不再中断或泄漏(`CHISEL_UDP_MAX_CONNS`)
  - 入站 websocket 消息在认证前进行大小限制(`CHISEL_WS_READ_LIMIT`)
  - 当客户端在 SSH 握手与其配置请求之间断开时,服务端不再 panic(#608)
  - 当 `--max-retry-count` 耗尽时,客户端以非零状态退出;新增 `--min-retry-interval`(默认 1s);`--proxy` 接受 `socks5://`
  - `go install` 构建会报告其真实版本;会话和失败的登录以 info 级别记录
  - 发布二进制文件使用 Go 1.27.0 构建;`x/crypto/ssh` 更新到 v0.55.0 以解决 GO-2026-6303
  - 发布现在提供 ko 构建的、基于 scratch 的多架构镜像,包含 CA 根证书,发布到 GHCR 和 Docker Hub;发布分两阶段——打标签会构建草稿 GitHub 发布及带版本标签的镜像,发布草稿会将 Docker 的 `latest` / `X` / `X.Y` 标签提升

### 升级到 1.12

从 1.11.x 或更早版本升级时,有四项变更可能需要采取行动:

1. **SOCKS5 + `--authfile`**(自 v1.11.7 起强制执行):应保留代理访问权限的用户需要匹配令牌 `socks` 的 authfile 条目(通配符 `""` 仍然有效)。参见 [认证](#authentication)。被拒绝的请求会在服务端记录为 `Denied connection to socks (ACL)`。
2. **`--fingerprint`**:截断的旧式 MD5 指纹被拒绝。使用服务端和客户端打印的完整 SHA256 指纹(完整的 16 字节 MD5 冒号形式仍被接受,但已弃用)。
3. **`--auth`** 值必须为 `<user>:<pass>`——不含冒号的字符串现在会在启动时失败,而不是静默禁用认证。
4. **退出码**:带 `--max-retry-count` 的 `chisel client` 现在在连接尝试耗尽时以非零状态退出;检查 `$?` 的脚本和 systemd `Restart=on-failure` 单元会注意到这一点。

## 许可证

[MIT](https://github.com/jpillora/chisel/blob/master/LICENSE) © Jaime Pillora
下载工具

最受欢迎

查看全部 →

发现我们社区最常用的工具。

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 终极 OSINT 工具包:调查图谱、置信度评分、别名家族、地图、时间线和报告。49 个模块、400+ 个站点,无需 API 密钥。

    1.1k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock 一键执行应用(CVE-2026-43499)

    597
  • 3

    looking-glass

    anonghosty/looking-glass

    CSIRT 平台,可将 Shadowserver 报告导入 MongoDB,并将其重放为交互式地图、分析、发现、公告和高管仪表板。

    396
  • 4

    ARTEX

    baarai/artex

    基于LLM的多智能体自主渗透测试平台,具备规划器/执行器智能体、资产与探索图谱、MITM流量记录以及漏洞复测功能。

    319
  • 5

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    AI原生网络安全的行动系统——在这里,意图转化为受治理的执行,证据沉淀为运营记忆,每一次操作都让下一次更出色。

    274
  • 6

    Aliens_eye

    arxhr007/aliens_eye

    由 AI 驱动的 OSINT 引擎,可在网络上发现并映射 7,700+ 个社交媒体身份

    260

探索所有工具

浏览我们的工具集合

查看所有工具 →