CVE-2016-5725: Improper Limitation of a Pathname to a Restricted Directory in JCraft JSch

com.jcraft:jsch Updated 02 Oct 2025

Summary

13/05/2022
Yes i
Moderate
5.9

CVE-2016-5725: Improper Limitation of a Pathname to a Restricted Directory in JCraft JSch. Affects com.jcraft:jsch versions < 0.1.54. Fixed in 0.1.54. How to fix ↓

Also tracked for

The same CVE-2016-5725 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

JCraft JSch is a Java implementation of the SSH2 protocol. It provides a simple interface for connecting to SSH servers and performing secure file transfers. JSch is widely used in various applications and libraries for SSH communication. However, versions before 0.1.54 on Windows are vulnerable to a directory traversal attack when the mode is set to ChannelSftp.OVERWRITE. This vulnerability allows remote SFTP servers to write to arbitrary files by exploiting a '..' (dot dot backslash) sequence in the response to a recursive GET command.

Vulnerability Detail

The vulnerability arises from a lack of proper limitation on the pathname during file transfers. By including the '..' sequence in the response, an attacker can navigate to parent directories and overwrite files outside the intended directory. This can lead to unauthorized modification or disclosure of sensitive information. The severity of this vulnerability is rated as MODERATE with a CVSS score of 5.9.

How To Fix

Minimum fixed version

0.1.54

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating the library is not immediately feasible, a temporary workaround can be implemented by disabling the ChannelSftp.OVERWRITE mode. By avoiding the use of this mode, the vulnerability can be mitigated. However, this workaround may impact the functionality of certain file transfer operations, so it is advised to update to the latest version of the library as soon as possible.

Conclusion

In conclusion, the JCraft JSch library versions before 0.1.54 on Windows are vulnerable to a directory traversal attack. This can be mitigated by updating the library to the latest version or temporarily disabling the ChannelSftp.OVERWRITE mode. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for com.jcraft:jsch →

Share this vulnerability

FAQ

JCraft JSch is a Java implementation of the SSH2 protocol, providing a secure way to communicate with SSH servers and perform file transfers.

The vulnerability allows remote SFTP servers to write to arbitrary files, potentially leading to unauthorized modification or disclosure of sensitive information.

To fix this vulnerability, update the JCraft JSch library to version 0.1.54 or later.

A temporary workaround is to disable the ChannelSftp.OVERWRITE mode, but it is recommended to update the library instead.

The severity of this vulnerability is rated as MODERATE with a CVSS score of 5.9.

How To Fix

Minimum fixed version

0.1.54

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback

Follow Vulert in Google

Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.