Skip to content
RCE Disclosed report Intermediate CVE-2023-6004

Command Injection using malicious hostname in expanded proxycommand

The libssh client did not properly validate the syntax of a hostname before substituting it into the command used by the ProxyCommand and ProxyJump features. An attacker who controls a hostname could inject malicious code into that command, leading to code execution on the client, though user interaction is required.

vx01 Follow

Originally disclosed on HackerOne

Bounty$540 Low 3.9 View original
  • Triaged in 22 hours
  • Fixed in 40 days
  • Paid in 40 days
  • Disclosed after 2 months

Summary by the program

Subject: Security weakness in ProxyCommand handling CVE ID#: CVE-2023-6004 Versions: 0.10.x, 0.9.x, 0.8.x Summary: ProxyCommand/ProxyJump features enable to inject malicious code through hostname

Description Using the ProxyCommand or the ProxyJump feature enables users to exploit unchecked hostname syntax on the client, which enables to inject malicious code into the command of the above-mentioned features through the hostname parameter.

User interaction is required to exploit this issue.

Credits Originally reported by Vinci (https:// github.com/vin01). Patches provided by Norbert Pocs of the libssh team.

Full Security Advisory: https://www.libssh.org/security/advisories/CVE-2023-6004.txt

The report

Using the ProxyCommand or the ProxyJump feature enables users to exploit unchecked hostname syntax on the client, which enables to inject malicious code into the command of the above-mentioned features through the hostname parameter.

User interaction is required to exploit this issue.

Advisory from libssh: https://www.libssh.org/security/advisories/CVE-2023-6004.txt

Advisory from OpenSSH which also suffered from this flaw: https://www.openssh.com/txt/release-9.6

Impact

Code execution via malicious input hostname or other tokens

The original report as published on HackerOne, by vx01. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the client passed the hostname into the ProxyCommand/ProxyJump command line without validating or escaping its syntax, so shell metacharacters in the hostname were interpreted as commands.

Impact

An attacker could achieve code execution on the client through a malicious hostname or other tokens, but user interaction is required and the text does not show a working exploit.

What the attacker needed

Victim uses ProxyCommand or ProxyJump; attacker controls the hostname; victim is tricked into connecting

The fix

Patches were provided by the libssh team; the text does not describe the code change itself.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you connect to a server, your SSH client can be told to run a helper program first, and it builds that program's command line partly from the server name you typed. If the client does not check that name carefully, a crafted name can add extra commands that the computer then runs. This report says libssh failed to check the name, so a bad hostname could run code on your machine, but only if you are tricked into using it.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.