OpenSSH scp client prints server escape codes, letting a malicious host hide files

Note: This data is for reference and cybersecurity research purposes only.CyStack advises users not to use this information for unlawful purposes.

Overview

Original source data

In OpenSSH 7.9, due to accepting and displaying arbitrary stderr output from the server, a malicious server (or Man-in-The-Middle attacker) can manipulate the client output, for example to use ANSI control codes to hide additional files being transferred.

Affected products and scope

The record names OpenSSH itself, WinSCP, NetApp Element Software, NetApp ONTAP Select Deploy and NetApp Storage Automation Store, and Siemens SCALANCE X204RNA and SCALANCE X204RNA EEC firmware. Those later products are listed because they ship or embed the affected client, so the exposure follows the component into the appliance. The record does not give version ranges, so until the vendor's fixed build is in place, treat any deployment that uses the affected scp client as in scope. The problem as described is in how the client displays server output, not in the server daemon.

Technical details

The weakness is missing output neutralisation on the client side. The scp client receives stderr from the server and writes it to the terminal as-is, so any bytes the server sends arrive at the terminal emulator as instructions rather than as inert text. ANSI escape codes are in-band control sequences: they move the cursor, change colours, erase lines, and rewrite text that has already been printed, and the terminal has no way to tell them apart from legitimate program output. Because the client does not escape or strip them, the server side of the session decides what the user sees. The record points at the scp client and its progress reporting in the OpenSSH source.

Exploitability

Reachable over the network, but the attacker must control or intercept the server end of the connection, and the user has to run scp against it. No authentication is required on the client side and no privileges are needed on the target; the record scores it as high complexity with user interaction required. Public exploit code exists for this issue. The record does not show it being exploited in the wild.

Technical impact

An attacker controlling the server side of an scp session can shape the client's terminal display: hide files that are being transferred, mask or rewrite messages, and generally present a session that differs from what is actually happening. The gain is deception of the operator. There is no code execution, no privilege escalation, and no direct access to data beyond what the session already moves. The effect ends when the terminal output stops being trusted or the session is examined by other means.

Business impact

The attacker does not get code execution here, but they get something useful: control over what the person at the keyboard believes. A transfer that copies one file can be made to look identical to a transfer that copies several, with the extra ones erased from the display. Administrators who pull configuration, backups, or vendor packages from external systems are the ones exposed. If the operator's understanding of what was copied is wrong, files can land on a host without anyone noticing, and later reviews of the session, if they rely on the same terminal output, will confirm the false picture. Products that bundle an affected client, including the storage and industrial appliances named in this record, carry the same exposure into environments where file transfers are usually scripted and rarely watched.

Remediation

Apply the vendor's fixed release. A patch is recorded as available, and NetApp and Siemens have published their own advisories for the products they list, so check those before assuming a bundled client has been updated. Where the fix is not yet deployed, restrict scp use to servers you control and treat the terminal output of a transfer as untrusted when the far end is external. The record does not describe a configuration setting that switches the behaviour off, so there is no client-side toggle to fall back on.

Detection

Inventory workstations, jump hosts, and appliances that include an scp client, and compare them against the fixed builds from each vendor. Where session recording or a wrapper captures scp output, review transcripts of transfers from external or partner systems for escape sequences and for display changes that do not match the files actually listed on arrival. Host key change warnings during a transfer are worth investigating as a possible interception attempt. On the receiving side, compare what was reported to the operator with what exists on disk.

Sources (15)
Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.